Home

Awesome

Super Resolution Examples

SRGAN Architecture

<a href="https://github.com/tensorlayer/TensorLayerX"> <div align="center"> <img src="img/model.jpeg" width="80%" height="10%"/> </div> </a> <a href="https://github.com/tensorlayer/TensorLayerX"> <div align="center"> <img src="img/SRGAN_Result3.png" width="80%" height="50%"/> </div> </a>

Prepare Data and Pre-trained VGG

Run

πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯ You need install TensorLayerX at first!

πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯πŸ”₯ Please install TensorLayerX via source

pip install git+https://github.com/tensorlayer/tensorlayerx.git 

Train

config.TRAIN.img_path = "your_image_folder/"

Your directory structure should look like this:

srgan/
    └── config.py
    └── srgan.py
    └── train.py
    └── vgg.py
    └── model
          └── vgg19.npy
    └── DIV2K
          └── DIV2K_train_HR
          β”œβ”€β”€ DIV2K_train_LR_bicubic
          β”œβ”€β”€ DIV2K_valid_HR
          └── DIV2K_valid_LR_bicubic

python train.py

πŸ”₯Modify a line of code in train.py, easily switch to any framework!

import os
os.environ['TL_BACKEND'] = 'tensorflow'
# os.environ['TL_BACKEND'] = 'mindspore'
# os.environ['TL_BACKEND'] = 'paddle'
# os.environ['TL_BACKEND'] = 'pytorch'

🚧 We will support PyTorch as Backend soon.

Evaluation.

πŸ”₯ We have trained SRGAN on DIV2K dataset. πŸ”₯ Download model weights as follows.

SRGAN_gSRGAN_d
TensorFlowBaidu, GoogledriveBaidu, Googledrive
PaddlePaddleBaidu, GoogledriveBaidu, Googledrive
MindSpore🚧Coming soon!🚧Coming soon!
PyTorch🚧Coming soon!🚧Coming soon!

Download weights file and put weights under the folder srgan/models/.

Your directory structure should look like this:

srgan/
    └── config.py
    └── srgan.py
    └── train.py
    └── vgg.py
    └── model
          └── vgg19.npy
    └── DIV2K
          β”œβ”€β”€ DIV2K_train_HR
          β”œβ”€β”€ DIV2K_train_LR_bicubic
          β”œβ”€β”€ DIV2K_valid_HR
          └── DIV2K_valid_LR_bicubic
    └── models
          β”œβ”€β”€ g.npz  # You should rename the weigths file. 
          └── d.npz  # If you set os.environ['TL_BACKEND'] = 'tensorflow',you should rename srgan-g-tensorflow.npz to g.npz .

python train.py --mode=eval

Results will be saved under the folder srgan/samples/.

Results

<a href="http://tensorlayer.readthedocs.io"> <div align="center"> <img src="img/SRGAN_Result2.png" width="80%" height="50%"/> </div> </a>

Reference

Citation

If you find this project useful, we would be grateful if you cite the TensorLayer paper:

@article{tensorlayer2017,
author = {Dong, Hao and Supratak, Akara and Mai, Luo and Liu, Fangde and Oehmichen, Axel and Yu, Simiao and Guo, Yike},
journal = {ACM Multimedia},
title = {{TensorLayer: A Versatile Library for Efficient Deep Learning Development}},
url = {http://tensorlayer.org},
year = {2017}
}

@inproceedings{tensorlayer2021,
  title={TensorLayer 3.0: A Deep Learning Library Compatible With Multiple Backends},
  author={Lai, Cheng and Han, Jiarong and Dong, Hao},
  booktitle={2021 IEEE International Conference on Multimedia \& Expo Workshops (ICMEW)},
  pages={1--3},
  year={2021},
  organization={IEEE}
}

Other Projects

Discussion

License