Giter Site home page Giter Site logo

alexander-rakhlin / ikc Goto Github PK

View Code? Open in Web Editor NEW

This project forked from yuanjunchai/ikc

0.0 2.0 0.0 33.56 MB

Implementation of 'Blind Super-Resolution With Iterative Kernel Correction' (CVPR2019)

License: Apache License 2.0

Python 95.59% Shell 0.09% MATLAB 4.33%

ikc's Introduction

IKC: Blind Super-Resolution With Iterative Kernel Correction

Here is the implementation of 'Blind Super-Resolution With Iterative Kernel Correction'.
Based on [BasicSR], [MMSR]. About more details, check BasicSR.
Thanks to Jinjin Gu and Xintao Wang.

Updates

[2019-09-22] IKC v0.1 is modified.
[2019-09-25] IKC v0.2 is modified. User could use .yaml to change different settings(scale, sigma, etc.)

Architecture

Kernel mismatch

Dependencies

  • Python 3 (Recommend to use Anaconda)
  • PyTorch >= 1.0
  • NVIDIA GPU + CUDA
  • Python packages: pip install numpy opencv-python lmdb pyyaml
  • TensorBoard:
    • PyTorch >= 1.1: pip install tb-nightly future
    • PyTorch == 1.0: pip install tensorboardX

Installation

  • Clone this repo:
git clone https://github.com/yuanjunchai/IKC.git
cd IKC

Dataset Preparation

We use DIV2K, Flickr2K, Set5, Set14, Urban100, BSD100 datasets. To train a model on the full dataset(DIV2K+Flickr2K, totally 3450 images), download datasets from official websites. After download, run codes/scripts/generate_mod_LR_bic.py to generate LRblur/LR/HR/Bicubic datasets paths and corresponding kernel map.

python codes/scripts/generate_mod_LR_bic.py

About data

When train, dataset_GT is used to produce actual LR and corresponding kernel in train_IKC.py and train_SFTMD.py. Therefore, dataset_LQ is not used.
When test, the operation is the same as above in test_SFTMD.py so as to get kernel maps.
However, you need to change dataset_LQ in test_IKC.py!!
Another method is use generate_mod_LR_bic.py.

Getting Started

Pretrained model

You could download the pre-trained models from ./checkpoints directory.
Remember: change opt['path']['pretrain_model_G'] of the .yaml to the models' path you saved.

Train

First, train SFTMD network, and then use pretrained SFTMD to train Predictor and Corrector networks iteratively.

  1. To train the SFTMD model, change image path of codes/options/train/train_SFTMD.yml, especially dataroot_GT, dataroot_LQ. You could change opt['name'] to save different checkpoint filenames, and change opt['gpu_ids'] to assign specific GPU.
python codes/train_SFTMD.py -opt_F codes/options/train/train_SFTMD.yml
  1. To train Predictor and Corrector models, you first should change opt_F['sftmd']['path']['pretrain_model_G'] to the path of pretrained SFTMD checkpoint. Also, dataroot_GT, dataroot_LQ of opt_P, opt_C should be filled with corresponding train&validation data paths.
python codes/train_IKC.py -opt_F codes/options/train/train_SFTMD.yml -opt_P codes/options/train/train_Predictor.yml -opt_C codes/options/train/train_Corrector.yml

Test

  1. At first, you'd better run codes/scripts/generate_mod_LR_bic.py to generate LRblur/LR/HR/Bicubic datasets paths and corresponding kernel map.
python codes/scripts/generate_mod_LR_bic.py
  1. To test SFTMD model, change test datasets paths of codes/options/test/test_SFTMD.yml.
python codes/test_SFTMD.py -opt_F codes/options/test/test_SFTMD.yml
  1. To test Predictor and Corrector models, change datasets paths of codes/options/test/test_Predictor.yml and codes/options/test/test_Corrector.yml.
python codes/test_IKC.py -opt_F codes/options/test/test_SFTMD.yml -opt_P codes/options/test/test_Predictor.yml -opt_C codes/options/test/test_Corrector.yml

The 'dataroot_GT' is only used as PSNR calculation. If you'd like to use it in blind-SR, you could set 'dataroot_GT:~' and just use your own LR data.

Citation

@InProceedings{gu2019blind,
    author = {Gu, Jinjin and Lu, Hannan and Zuo, Wangmeng and Dong, Chao},
    title = {Blind super-resolution with iterative kernel correction},
    booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
    month = {June},
    year = {2019}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.