Skip to content

CVPR2019 (oral) Modulating Image Restoration with Continual Levels via Adaptive Feature Modification Layers (AdaFM). PyTorch implementation

Notifications You must be signed in to change notification settings

hejingwenhejingwen/AdaFM

Repository files navigation

Modulating Image Restoration with Continual Levels via Adaptive Feature Modification Layers paper, supplementary file

By Jingwen He, Chao Dong, and Yu Qiao

class AdaptiveFM(nn.Module):
    def __init__(self, in_channel, kernel_size):
        super(AdaptiveFM, self).__init__()
        padding = (kernel_size - 1) // 2
        self.transformer = nn.Conv2d(in_channel, in_channel, kernel_size, padding=padding, groups=in_channel)

    def forward(self, x):
        return self.transformer(x) + x

BibTex

@InProceedings{He_2019_CVPR,
author = {He, Jingwen and Dong, Chao and Qiao, Yu},
title = {Modulating Image Restoration With Continual Levels via Adaptive Feature Modification Layers},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2019}
}

Dependencies

Pretrained models

We provide a pretrained model for AdaFM-Net (experiments/pretrained_models) that deals with denoising from σ15 to σ75. Please run the following commands directly:

cd codes
python interpolate.py -opt options/test/test.json

The results can be found in the newly created directory AdaFM/results The noise level of the input image is σ45, and you are supposed to obtain similar interpolated results as follows:

Codes

The overall code framework mainly consists of four parts - Config, Data, Model and Network. We also provides some useful scripts. Please run all the following commands in “codes” directory.

How to Test

basic model and AdaFM-Net

  1. Modify the configuration file options/test/test.json (please refer to options for instructions.)
  2. Run command:
python test.py -opt options/test/test.json

modulation testing

  1. Modify the configuration file options/test/test.json
  2. Run command:
python interpolate.py -opt options/test/test.json

or:

  1. Use scripts/net_interp.py to obtain the interpolated network.
  2. Modify the configuration file options/test/test.json and run command: python test.py -opt options/test/test.json

How to Train

basic model

  1. Prepare datasets, usually the DIV2K dataset. More details are in codes/data.
  2. Modify the configuration file options/train/train_basic.json (please refer to options for instructions.)
  3. Run command:
python train.py -opt options/train/train_basic.json

AdaFM-Net

  1. Prepare datasets, usually the DIV2K dataset.
  2. Modify the configuration file options/train/train_adafm.json
  3. Run command:
python train.py -opt options/train/train_adafm.json

Acknowledgement

  • This code borrows heavily from BasicSR.

About

CVPR2019 (oral) Modulating Image Restoration with Continual Levels via Adaptive Feature Modification Layers (AdaFM). PyTorch implementation

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published