By Wenlong Zhang, Yihao Liu, Chao Dong, Yu Qiao
- 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.
This version is under testing. We will provide more details of RankSRGAN in near future.
- Clone this github repo.
git clone https://github.com/WenlongZhang0724/RankSRGAN.git
cd RankSRGAN
- Place your own low-resolution images in
./LR
folder. - Download pretrained models from Google Drive or Baidu Drive. Place the models in
./experiments/pretrained_models/
. We provide three Ranker models and three RankSRGAN models (see model list). - Run test. We provide RankSRGAN (NIQE, Ma, PI) model and you can config in the
test.py
.
python test.py -opt options/test/test_ranksrgan.json
- The results are in
./results
folder.
- Download DIV2K and Flickr2K from Google Drive or Baidu Drive
- Generate rank dataset ./datascripts/generate_rankdataset/
- Run command:
python train.py -opt options/train/Ranker.json
We use a PSNR-oriented pretrained SR model to initialize the parameters for better quality.
- Prepare datasets, usually the DIV2K dataset.
- Prerapre the PSNR-oriented pretrained model. You can use the
SRResNet_bicx4_in3nf64nb16.pth
as the pretrained model that can be downloaded from Google Drive or Baidu Drive. - Modify the configuration file
options/train/RankSRGAN_NIQE.json
- Run command:
python train.py -opt options/train/RankSRGAN_NIQE.json
or
python train_PI.py -opt options/train/RankSRGAN_NIQE.json
Using the train.py can output the convergence curves with NIQE and PSNR; Using the train_PI.py can output the convergence curves with NIQE, Ma, PI and PSNR.