This repository gathers the code for image super resolution from the in-class CodaLab competition.
We use SwinIR, an image restoration toolbox (PyTorch) that provides training and testing codes for SwinIR, to train our model.
We need to do some pre-preparation for training and testing on our custom dataset.
To reproduce my submission without retrainig, do the following steps:
Ubuntu 18.04.5 LTS
Intel® Core™ i7-3770 CPU @ 3.40GHz × 8
GeForce GTX 1080/PCIe/SSE2
All requirements should be:
$ virtualenv SwinIR --python=3.6
$ source ./SwinIR/bin/activate
$ cd Image-Super-Resolution
$ pip install -r requirements.txt
Official images can be downloaded from CodaLab competition
The repository structure is:
Image-Super-Resolution(root)
+-- data
+-- models
+-- utils
+-- model_zoo # put model weight(.pth) here
+-- options # training hyper-parameters setting
| +-- train_swinir_sr_classical.json
+-- testing_lr_images # testing data
+-- training_hr_images # training data
+-- inference.py
+-- train.py
+-- requirements.txt
To train the model, run this command:
$ python train.py --opt options/train_swinir_sr_classical.json
Trained model will be saved in superresolution/swinir_sr_classical_patch48_x3/models
Please download this model if you want to reproduce my submission file, put it in model_zoo
and run the following code.
To reproduce my submission file or test the model you trained, run:
$ python inference.py --task classical_sr --scale 3 --model_path model_zoo/model_final.pth --folder_lq testing_lr_images/testing_lr_images
Prediction file will be saved in results/swinir_classical_sr_x3
If you use different hardware, the inference result may be a little different.
Our model achieves PSNR 28.3899dB
[1] SwinIR