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
@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}
}
- Python 3 (Recommend to use Anaconda)
- PyTorch >= 0.4.0
- NVIDIA GPU + CUDA
- Python packages:
pip install numpy opencv-python lmdb
- [option] Python packages:
pip install tensorboardX
, for visualizing curves.
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:
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.
- Modify the configuration file
options/test/test.json
(please refer tooptions
for instructions.) - Run command:
python test.py -opt options/test/test.json
- Modify the configuration file
options/test/test.json
- Run command:
python interpolate.py -opt options/test/test.json
- Use
scripts/net_interp.py
to obtain the interpolated network. - Modify the configuration file
options/test/test.json
and run command:python test.py -opt options/test/test.json
- Prepare datasets, usually the DIV2K dataset. More details are in
codes/data
. - Modify the configuration file
options/train/train_basic.json
(please refer tooptions
for instructions.) - Run command:
python train.py -opt options/train/train_basic.json
- Prepare datasets, usually the DIV2K dataset.
- Modify the configuration file
options/train/train_adafm.json
- Run command:
python train.py -opt options/train/train_adafm.json
- This code borrows heavily from BasicSR.