/IKC

Implementation of 'Blind Super-Resolution With Iterative Kernel Correction', based on BasicSR

Primary LanguagePythonApache License 2.0Apache-2.0

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.

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
pip install -r requirements.txt

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 LR/HR/Bicubic of train, test and validation datasets paths.

python codes/scripts/generate_mod_LR_bic.py

Getting Started

TODO: Download the pre-trained models using the following links and copy them under ./checkpoints directory.

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. 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

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}
}