Need help with IKC?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

yuanjunchai
170 Stars 32 Forks Apache License 2.0 91 Commits 13 Opened issues

Description

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

Services available

!
?

Need anything else?

Contributors list

No Data

IKC: Blind Super-Resolution With Iterative Kernel Correction

ArXiv | BibTex | Project Website

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:
    bash
    git clone https://github.com/yuanjunchai/IKC.git
    cd IKC
    
  • Install PyTorch and dependencies from http://pytorch.org

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.

bash
python codes/scripts/generate_mod_LR_bic.py

About data

When train, datasetGT 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']['pretrainmodelG'] 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 datarootGT, datarootLQ. You could change opt['name'] to save different checkpoint filenames, and change opt['gpuids'] to assign specific GPU. ```bash python codes/trainSFTMD.py -optF codes/options/train/trainSFTMD.yml ```

  2. To train Predictor and Corrector models, you first should change optF['sftmd']['path']['pretrainmodelG'] to the path of pretrained SFTMD checkpoint. Also, datarootGT, datarootLQ of optP, optC should be filled with corresponding train&validation data paths. ```bash python codes/trainIKC.py -optF codes/options/train/trainSFTMD.yml -optP codes/options/train/trainPredictor.yml -optC codes/options/train/trainCorrector.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.
    bash
    python codes/scripts/generate_mod_LR_bic.py
    
  2. To test SFTMD model, change test datasets paths of

    codes/options/test/test_SFTMD.yml
    .

    bash
    python codes/test_SFTMD.py -opt_F codes/options/test/test_SFTMD.yml
    
  3. To test Predictor and Corrector models, change datasets paths of

    codes/options/test/test_Predictor.yml
    and
    codes/options/test/test_Corrector.yml
    .

    bash
    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 'datarootGT' is only used as PSNR calculation. If you'd like to use it in blind-SR, you could set 'datarootGT:~' 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}
}

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.