TensorFlow implementation of Accelerating the Super-Resolution Convolutional Neural Network [1].
This implementation replaces the transpose conv2d layer by a sub-pixel layer [2].
Includes pretrained models for scales x2, x3 and x4. Which were trained on T91-image dataset, and finetuned on General100 dataset.
This repository was made during the 2019 GSoC program for the organization OpenCV. The trained models (.pb files) in this repo can easily be used for inference in OpenCV with the 'dnn_superres' module. See the OpenCV documentation for how to do this.
- Tensorflow
- Python
- Numpy
- cv2
- imutils
Download T91, General100 and Set14.
T91 is for training. General100 for finetuning. Set14 as the validation set.
Train:
-
from scratch
python main.py --train --scale <scale> --fromscratch --traindir /path-to-train_images/ --validdir /path-to-valid_images/
-
load previous
python main.py --train --scale <scale> --traindir /path-to-train_images/ --validdir /path-to-valid_images/
-
finetune
python main.py --train --scale <scale> --finetune --finetunedir /path-to-images/ --validdir /path-to-valid_images/
Test:
python main.py --test --image /image-path/
Export:
python3 main.py --export
Extra arguments (Fsrcnn small, batch size, lr etc.):
python main.py --h
(1) Original picture
(2) Input image
(3) Bicubic scaled (3x) image
(4) FSRCNN scaled (3x) image
FSRCNN-small is a network with fewer parameters. Thus it is faster but has lower performance.
- Chao Dong, Chen Change Loy, Xiaoou Tang. Accelerating the Super-Resolution Convolutional Neural Network, in Proceedings of European Conference on Computer Vision (ECCV), 2016
- Real-Time Single Image and Video Super-Resolution Using an Efficient Sub-Pixel Convolutional Neural Network. By Shi et. al.