Implementation of "Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network"
For earlier version, please check srgan release and tensorlayer.
For more computer vision applications, check TLXCV
config.py
(like number of epochs) are seleted basic on that dataset, if you change a larger dataset you can reduce the number of epochs. train_hr_imgs = tl.files.load_flickr25k_dataset(tag=None)
in main.py
. config.TRAIN.hr_img_path
in config.py
.π₯π₯π₯π₯π₯π₯ You need install TensorLayerX at first!
π₯π₯π₯π₯π₯π₯ Please install TensorLayerX via source
pip install git+https://github.com/tensorlayer/tensorlayerx.git
config.py
, if you download DIV2K - bicubic downscaling x4 competition dataset, you don't need to change it. 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.
π₯ We have trained SRGAN on DIV2K dataset. π₯ Download model weights as follows.
SRGAN_g | SRGAN_d | |
---|---|---|
TensorFlow | Baidu, Googledrive | Baidu, Googledrive |
PaddlePaddle | Baidu, Googledrive | Baidu, 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/.
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}
}