Skip to content
Implementation of SRGAN using Tensorflow
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
train_hr
train_lr
val_hr
val_lr
README.md
btgen.py
convert.py
main.py
model.py
pred.py
vgg.py

README.md

SRGAN-TensorFlow

Implementation of SRGAN using Tensorflow.

original paper: https://arxiv.org/abs/1609.04802

see also my ESRGAN implementation.

Usage

  1. Download vgg19.npy from here.

Put vgg19.npy in the folder where convert.py and convert.py are located.

like this

...
│
├──convert.py
├──vgg.py
├──vgg19.npy
...

run convert.py.

python convert.py

after running, A vgg model dedicated to tensorflow will be output.

...
│
├── convert.py
├── vgg.py
├── vgg19.npy
├── modelvgg
│     ├── checkpoint
│     ├── model.ckpt-0
│     ├── model.ckpt-0
│     └── model.ckpt-0
...
  1. Download dataset from DIV2K dataset.

download the following four.

  • Train Data Track 1 bicubic downscaling x4 (LR images)
  • Train Data (HR images)
  • Validation Data Track 1 bicubic downscaling x4 (LR images)
  • Validation Data (HR images)

(If your PC has enough RAM, I recommend also The flickr2K data set proposed in EDSR.)

Put the downloaded dataset in the train_lr, train_hr, val_lr and val_hr folders. like this

...
│
├── train_lr
│     ├── 0001x4.png
│     ├── 0002x4.png
│     ├── ...
│     └── 0800x4.png
├── train_hr
│     ├── 0001.png
│     ├── 0002.png
│     ├── ...
│     └── 0800.png 
├── val_lr
│     ├── 0801x4.png
│     ├── 0802x4.png
│     ├── ...
│     └── 0900x4.png
├── val_hr
│     ├── 0801.png
│     ├── 0802.png
│     ├── ...
│     └── 0900.png 
├── main.py
├── model.py
...
  1. Train SRGAN.
python main.py
  1. After training, inference can be performed.

Put the images you want to evaluate into a folder and run the following.

example:

...
│
├── main.py
├── pred.py
├── modelGAN
│     ├── checkpoint
│     ├── model.ckpt-50000
│     ├── model.ckpt-50000
│     └── model.ckpt-50000
├── test
│     ├── yourpic1.png
│     ├── favpic.jpg
│     ...
│     └── smallpic.png
...
python pred.py test

Result examples

leftmost: bicubic upsampling

Second from left: SRResNet(MSE + VGG)

Third from left: SRGAN(this implementation)

rightmost: original HR image

You can’t perform that action at this time.