(CVPR-2021) Official PyTorch code for our paper DASR: Unsupervised Real-world Image Super Resolution via Domain-distance Aware Training.
These days, unsupervised super-resolution (SR) has been soaring due to its practical and promising potential in real scenarios. The philosophy of off-the-shelf approaches lies in the augmentation of unpaired data, \ie first generating synthetic low-resolution (LR) images
- Pytorch == 1.1.0
- torchvision == 0.3.0
- opencv-python
- tensorboardX
DASR:
|
|----codes
| |---- DSN
| |---- SRN
| |---- PerceptualSimilarity
|
|----DSN_experiments
|----SRN_experiments
|----DSN_tb_logger
|----SRN_tb_logger
|----DSN_results
|----SRN_results
Please specify the path to your dataset in paths.yml
.
We followed the AIM2019 challenge descriptions that source domain
indicates the
noisy and low-resolution and target domain
indicates the clean
and high resolution images. The images in source domain and target domain
are unpaired.
Auto reproduce process can be presented as
Training DSN --> Generating LRs and domain distance maps --> Training SRN
.
Our results can be reproduced by running a single command:
cd DASR/codes
python Auto_Reproduce.py --dataset aim2019/realsr \
--artifact tdsr/(tddiv2k/tdrealsr)
Auto-reproducing process will take about 48 hours on Nvidia GTX 1080.
We provide pretrained models for AIM2019/ RealSR and CameraSR datasets.
DSN | SRN | |
---|---|---|
AIM | DeResnet | ESRGAN |
RealSR | DeResnet | ESRGAN |
CameraSR | DeResnet | ESRGAN |
Testing is similar to the BasicSR codes.
We add some extra options including LPIPS
,Forward_chop
, etc.
Please specify the pre-trained model and data path in
test_sr.json
correctly.
cd DASR/codes/SRN
python test.py -opt options/test/test_sr.json
We build our DSN codes based on our previous work FSSR (github | paper).
The DSN model can be trained with:
cd DASR/codes/DSN
python train.py --dataset aim2019 --artifacts tdsr \
--generator DeResnet --discriminator FSD \
--norm_layer Instance \
--filter wavelet --cat_or_sum cat \
--batch_size 8 --num_workers 8 --crop_size 256 \
--save_path 0603_DeResnet+wavcat+FSD+wtex0.03
Args:
-
--dataset
The dataset should be one of theaim2019
/realsr
/camerasr
. To train DSN on your own data, please specify the path in the correct format inpaths.yml
. -
--aritifact
Choose the type of degradation artifact that you specified inpaths.yml
. -
--generator
Choose the downsampling generator architecture, includingDeResnet
,DSGAN
. -
--discriminator
Choose the discriminator architecture includingnld_s1
(Nlayer discriminator with stride 1),nld_s2
andFSD
(Frequency separation discriminator). -
--norm_layer
Choose the normalization layer in discriminator, includingInstance
andBatch
. -
--filter
Choose the frequency separation filter, includingwavelet
,gaussion
andavg_pool
. -
--cat_or_sum
Choose the approach of combination of wavelet subbands, includingcat
andsum
.
The training loss and validation results are shown in DASR/DSN_tb_logger
by running with:
cd DASR/DSN_tb_logger
tensorboard --logdir=./
The training data for SRN can be generated with:
python create_dataset_modified.py --dataset aim2019 \
--checkpoint <path to your DSN model> \
--generator DeResnet --discriminator FSD --filter avg_pool\
--name 0603_DSN_LRs_aim2019
Please note that our generator and discriminator are saved in a single
.tar
files.
The generated low-resolution images and domain distance maps are
saved in DASR/DSN_results/<--name>/
.
We build our SRN codes based on BasicSR super-resolution toolkit.
The SRN model can be trained with:
cd DASR
python codes/train.py -opt codes/options/train/train_DASR.json
Please specify the configurations in train_DASR.json
file.
@article{wei2020unsupervised,
title={Unsupervised Real-world Image Super Resolution via Domain-distance Aware Training},
author={Wei, Yunxuan and Gu, Shuhang and Li, Yawei and Jin, Longcun},
journal={arXiv preprint arXiv:2004.01178},
year={2020}
}