Awesome
Modulating Image Restoration with Continual Levels via Adaptive Feature Modification Layers paper, supplementary file
By Jingwen He, Chao Dong, and Yu Qiao
<p align="center"> <img height="250" src="./figures/framework.PNG"> </p>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
- 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.
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
- Modify the configuration file
options/test/test.json
(please refer tooptions
for instructions.) - Run command:
python test.py -opt options/test/test.json
modulation testing
- Modify the configuration file
options/test/test.json
- Run command:
python interpolate.py -opt options/test/test.json
or:
- 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
How to Train
basic model
- 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
AdaFM-Net
- 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
Acknowledgement
- This code borrows heavily from BasicSR.