NAVER BoostCamp Final Project

Overview

CV 14조 final project

Super Resolution and Deblur module

Inference code & Pretrained weight Repo

실행 방법

  1. streamlit run WebServer/Server_SRD.py --server.port=6006
  2. port만 변경해서 접속 (ex:6006->6014)

weight file 다운로드

  1. Super Resolution: bash SuperResolution/download-weights.sh
  2. Deblur: bash Deblur/SRNDeblur/checkpoints/download_model.sh
You might also like...
Cmsc11 arcade - Final Project for CMSC11

cmsc11_arcade Final Project for CMSC11 Developers: Limson, Mark Vincent Peñafiel

Code, final versions, and information on the Sparkfun Graphical Datasheets
Code, final versions, and information on the Sparkfun Graphical Datasheets

Graphical Datasheets Code, final versions, and information on the SparkFun Graphical Datasheets. Generated Cells After Running Script Example Complete

The reference baseline of final exam for XMU machine learning course

Mini-NICO Baseline The baseline is a reference method for the final exam of machine learning course. Requirements Installation we use /python3.7 /torc

A repository for storing njxzc final exam review material

文档地址,请戳我 👈 👈 👈 ☀️ 1.Reason 大三上期末复习软件工程的时候,发现其他高校在GitHub上开源了他们学校的期末试题,我很受触动。期末

Project Aquarium is a SUSE-sponsored open source project aiming at becoming an easy to use, rock solid storage appliance based on Ceph.

Project Aquarium Project Aquarium is a SUSE-sponsored open source project aiming at becoming an easy to use, rock solid storage appliance based on Cep

This project uses reinforcement learning on stock market and agent tries to learn trading. The goal is to check if the agent can learn to read tape. The project is dedicated to hero in life great Jesse Livermore.

Reinforcement-trading This project uses Reinforcement learning on stock market and agent tries to learn trading. The goal is to check if the agent can

Erpnext app for make employee salary on payroll entry based on one or more project with percentage for all project equal 100 %
Erpnext app for make employee salary on payroll entry based on one or more project with percentage for all project equal 100 %

Project Payroll this app for make payroll for employee based on projects like project on 30 % and project 2 70 % as account dimension it makes genral

BC3407-Group-5-Project - BC3407 Group Project With Python
BC3407-Group-5-Project - BC3407 Group Project With Python

BC3407-Group-5-Project As the world struggles to contain the ever-changing varia

UpChecker is a simple opensource project to host it fast on your server and check is server up, view statistic, get messages if it is down. UpChecker - just run file and use project easy

UpChecker UpChecker is a simple opensource project to host it fast on your server and check is server up, view statistic, get messages if it is down.

Comments
  • 기존 repo의 commit을 유지

    기존 repo의 commit을 유지

    기존 repo의 commit 내용들을 유지하면서 코드를 가져오면 어떨까요? 그동안 코드를 commit과 pull request를 통해 관리했다는걸 어필하려면 이 방법이 좋을것같습니다. 또 나중에 부스트캠프 repo로 코드를 옮기고 기존 repo의 Integrated 브랜치를 삭제할 텐데 이때 기존 commit들이 삭제될것 같습니다.

    임시로 temp 브랜치에 기존 commit이 반영된 코드를 가져와봤습니다.

    opened by SoheeJeong 18
  • Requirements 관련

    Requirements 관련

    Requirements는 각 모듈 디렉토리 안에 따로 분리 부탁드립니다! 예를 들어 다음과 같습니다.

    Inpainting/requirements.txt Segmentation/requirements.txt SuperResolution/requirements.txt Deblur/requirements.txt

    opened by intelli8786 1
  • Super Resolution 모델 로드에 대한 이슈

    Super Resolution 모델 로드에 대한 이슈

    https://github.com/intelli8786/AI_BlemishesRemover/blob/edbd91a16ade0c5944a8726db4d235bc0c611381/SuperResolution/Wrapper.py#L43-L56

    현재 매 prediction마다 모델을 새로 로드하고 있습니다. 이는 Super Sampling scale 인자를 매 추론마다 받기 위함이었을 것이라고 생각됩니다. 결국 이 과정으로 인해 추론 속도가 매우 느려지는 문제가 있습니다.

    이 문제의 실험을 위해 다음과 같이 수정한 다음 추론 시간을 측정해보았습니다.

    #SuperResolution/Wrapper.py
    
    class SuperResolution():
        def __init__(self):
            model_dir = os.path.join(os.getcwd(),'SwinIR/experiments/pretrained_models')
    
            self.model_zoo = {
                'real_sr': {
                    4: os.path.join(model_dir, '003_realSR_BSRGAN_DFO_s64w8_SwinIR-M_x4_GAN.pth')
                },
                'classical_sr':{
                    2: os.path.join(model_dir, '001_classicalSR_DF2K_s64w8_SwinIR-M_x2.pth'),
                    3: os.path.join(model_dir, '001_classicalSR_DF2K_s64w8_SwinIR-M_x3.pth'),
                    4: os.path.join(model_dir, '001_classicalSR_DF2K_s64w8_SwinIR-M_x4.pth'),
                    8: os.path.join(model_dir, '001_classicalSR_DF2K_s64w8_SwinIR-M_x8.pth'),
                }
            }
     
            args = argparse.Namespace()
            args.folder_gt = None
            args.folder_lq = None
            args.large_model = None
            self.args = args
            self.device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
            self.tasks = {
                'Real-World Image Super-Resolution': 'real_sr',
                'Grayscale Image Denoising': 'gray_dn',
                'Color Image Denoising': 'color_dn',
                'JPEG Compression Artifact Reduction': 'jpeg_car'
            }
    
            self.args.task = 'classical_sr'
            self.args.noise = 15
            self.args.jpeg = 40
            self.args.training_patch_size = 64
            self.args.scale = 4
    
            if self.args.scale == 4:
                self.args.task = 'real_sr'
                self.args.training_patch_size = 128
            self.args.model_path = self.model_zoo[self.args.task][self.args.scale]
    
            self.model = define_model(self.args)
            self.model.eval()
            self.model = self.model.to(self.device)
    
    
        @st.cache
        def predict(self, image, task_type='Real-World Image Super-Resolution', jpeg=40, noise=15,scale=4):
    
            # setup folder and path
            _, _, border, window_size = setup(self.args)
            
            # read image
            img_gt = cv2.cvtColor(image, cv2.IMREAD_COLOR).astype(np.float32) / 255. # image to HWC-BGR, float32
            img_gt = np.transpose(img_gt if img_gt.shape[2] == 1 else img_gt[:, :, [2, 1, 0]],
                                    (2, 0, 1))  # HCW-BGR to CHW-RGB
            img_gt = torch.from_numpy(img_gt).float().unsqueeze(0).to(self.device)  # CHW-RGB to NCHW-RGB
    
            # inference
            with torch.no_grad():
                # pad input image to be a multiple of window_size
                _, _, h_old, w_old = img_gt.size()
                h_pad = (h_old // window_size + 1) * window_size - h_old
                w_pad = (w_old // window_size + 1) * window_size - w_old
                img_gt = torch.cat([img_gt, torch.flip(img_gt, [2])], 2)[:, :, :h_old + h_pad, :]
                img_gt = torch.cat([img_gt, torch.flip(img_gt, [3])], 3)[:, :, :, :w_old + w_pad]
                output = self.model(img_gt)
                output = output[..., :h_old * 4, :w_old * 4]
            output = output.data.squeeze().float().cpu().clamp_(0, 1).numpy()
            if output.ndim == 3:
                output = np.transpose(output[[2, 1, 0], :, :], (1, 2, 0))  # CHW-RGB to HCW-BGR
            output = (output * 255.0).round().astype(np.uint8)
            return output
    
    

    실제 실험해보니 추론 속도가 약 5초 가량에서 0.5초 이내로 줄어듦을 알 수 있었습니다.

    따라서, Scale이 변했을 때 이를 반영하기 위해 ChangeScale 메소드를 정의해주시고 RestAPI로 이 메소드를 호출해(ex : 127.0.0.1/super_change) Scale을 변경할 수 있도록 수정 부탁드립니다.

    opened by intelli8786 0
  • Deblur 모델에 대한 이슈

    Deblur 모델에 대한 이슈

    https://github.com/intelli8786/AI_BlemishesRemover/blob/edbd91a16ade0c5944a8726db4d235bc0c611381/Deblur/Wrapper.py#L8-L78

    Tensorflow 1.0 사용에 있어 포기해야 할 부분이 많다고 판단하였습니다.

    • 첫 번째는, 한 API서버에서 동시에 서비스 제공이 불가한 점이 문제입니다.
    • 두 번 째는 현재 Tensorflow 1.0 사용이 익숙하지 않아 매 prediction 마다 모델을 새로 로드하는 형태로 구현이 되어있다는 점입니다.
    • 세 번째는 현업에서 Tensorflow 1.0이 레거시로 넘어가기 시작하였기 때문에 트렌디함을 강조하기 어렵다는 문제가 있습니다.

    위와 같은 이유로 pytorch 기반 모델로 수정을 부탁드립니다.

    opened by intelli8786 1
Owner
JiSeong Kim
JiSeong Kim
It's final year project of Diploma Engineering. This project is based on Computer Vision.

Face-Recognition-Based-Attendance-System It's final year project of Diploma Engineering. This project is based on Computer Vision. Brief idea about ou

Neel 10 Nov 2, 2022
Deep Learning for Computer Vision final project

Deep Learning for Computer Vision final project

grassking100 1 Nov 30, 2021
Final project for Intro to CS class.

Financial Analysis Web App https://share.streamlit.io/mayurk1/fin-web-app-final-project/webApp.py 1. Project Description This project is a technical a

Mayur Khanna 1 Dec 10, 2021
Final term project for Bayesian Machine Learning Lecture (XAI-623)

Mixquality_AL Final Term Project For Bayesian Machine Learning Lecture (XAI-623) Youtube Link The presentation is given in YoutubeLink Problem Formula

JeongEun Park 3 Jan 18, 2022
Computer Vision Script to recognize first person motion, developed as final project for the course "Machine Learning and Deep Learning"

Overview of The Code BaseColab/MLDL_FPAR.pdf: it contains the full explanation of our work Base Colab: it contains the base colab used to perform all

Simone Papicchio 4 Jul 16, 2022
Final project code: Implementing MAE with downscaled encoders and datasets, for ESE546 FA21 at University of Pennsylvania

546 Final Project: Masked Autoencoder Haoran Tang, Qirui Wu 1. Training To train the network, please run mae_pretraining.py. Please modify folder path

Haoran Tang 0 Apr 22, 2022
Final project code: Implementing BicycleGAN, for CIS680 FA21 at University of Pennsylvania

680 Final Project: BicycleGAN Haoran Tang Instructions 1. Training To train the network, please run train.py. Change hyper-parameters and folder paths

Haoran Tang 0 Apr 22, 2022
Final Project for the CS238: Decision Making Under Uncertainty course at Stanford University in Autumn '21.

Final Project for the CS238: Decision Making Under Uncertainty course at Stanford University in Autumn '21. We optimized wind turbine placement in a wind farm, subject to wake effects, using Q-learning.

Manasi Sharma 2 Sep 27, 2022
Implementation of the final project of the course DDA6309 Probabilistic Graphical Model

Task-aware Joint CWS and POS (TCwsPos) This is the implementation of the final project of the course DDA6309 Probabilistic Graphical Models, The Chine

Peng 1 Dec 26, 2021
Final project for machine learning (CSC 590). Detection of hepatitis C and progression through blood samples.

Hepatitis C Blood Based Detection Final project for machine learning (CSC 590). Dataset from Kaggle. Using data from previous hepatitis C blood panels

Jennefer Maldonado 1 Dec 28, 2021