Home

Awesome

torch-srgan

This code only provides the implementation of SRResNet. SRGAN is implemented but the result is not very good.

Torch implementation of Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network that generates high-resolution images from low-resolution input images, for example:

<img src="docs/comic_mse.png" width="900px"/>

Setup

Prerequisites

Getting Started

git clone https://github.com/huangzehao/torch-srgan
cd torch-srgan

Train

python make_data.py --train_dir $(train_data_folder) --val_dir $(val_data_folder) --output_file $(output_hdf5_file)
cd models
bash VGG19.sh
mkdir checkpoint val
# SRResNet MSE
CUDA_VISIBLE_DEVICES=0 th train.lua -h5_file $(output_hdf5_file) -num_epoch 50 -loss 'pixel'
# SRResNet MSE VGG22 (need VGG19 model)
CUDA_VISIBLE_DEVICES=0 th train.lua -h5_file $(output_hdf5_file) -num_epoch 50 -loss 'percep' -percep_layer 'conv2_2' -use_tanh
# SRResNet MSE VGG54 (need VGG19 model)
CUDA_VISIBLE_DEVICES=0 th train.lua -h5_file $(output_hdf5_file) -num_epoch 50 -loss 'percep' -percep_layer 'conv5_4' -use_tanh

Test

# SRResNet MSE
CUDA_VISIBLE_DEVICES=0 th test.lua -img ./imgs/comic_input.bmp -output ./output.bmp -model ./models/SRResNet_MSE_100.t7
# SRResNet MSE VGG22
CUDA_VISIBLE_DEVICES=0 th test.lua -img ./imgs/comic_input.bmp -output ./output.bmp -model ./models/SRResNet_MSE_VGG22_100.t7 -use_tanh
# SRResNet MSE VGG54
CUDA_VISIBLE_DEVICES=0 th test.lua -img ./imgs/comic_input.bmp -output ./output.bmp -model ./models/SRResNet_MSE_VGG54_100.t7 -use_tanh

Acknowledgments

Code borrows heavily from fast-neural-style and cifar.torch. Thanks for their excellent work!