SRGAN-VGG54 Single Image Super Resolution Matlab port.
■ Prerequisites ■
- Matlab 2021a
- Image Processing toolbox
- Statistics and Machine Learning toolbox
- Deep Learning Toolbox
- Parallel Computing Toolbox
■ How to Test ■
Run SRGAN_Test.m which calls SRGAN_2xSuperResolution.m
Trained net is loaded on the line 5 of SRGAN_2xSuperResolution.m
■ How to Perform SRGAN Super-Resolution to your image file ■
Input image MyPicture.jpg should be pristine (not blurred) image. SRGAN neural net will upscale the image by 2x.
img = imread("MyPicture.jpg");
imgSR = SRGAN_2xSuperResolution(img);
■ How to Train the network using Flickr2K dataset ■
Download Flickr2K dataset and place it on
Flickr2K/Flickr2K_HR for train data of 2650 images.
Run CreateTrainingSetAll_Flickr2K.m to create Flickr2K_RGB_MatlabF folder that contains converted mat files.
Run SRGAN_Train.m to train and create trained file.
Use your trained file on SRGAN_2xSuperResolution.m
Other dataset such as DIV2K should be fine to train.
■ Difference from original SRGAN ■
- Training input image size is 112x112 (not 48x48)
- Only 2x super resolution is implemented.
- VGG19_54 loss, MSE loss, and GAN loss weighting ratio for Generator training is different.
■ Training image displayed becomes complete white. How to fix it ■
- Reduce the learning rate.
- Set breakpoint at SRGAN_Train.m:353 and run it, read values of lossGenMSE, lossGenFromDisc, lossGenContent value balance on Workspace. If one value is significantly larger than other two, decrease it.
- First 1000 iteration or so after the training start to use GAN tends to unstable (but it should not become complete white) but the result should be stabilized eventually.
■ How to get more crisp image ■
Decrease lossGenMSE contribution of SRGAN_Train.m:353 to get more crisp image. But artifact increases.
■ Changelog ■
Version 20210703 1.0.0
■ References ■
Train Generative Adversarial Network (GAN) using Matlab
Monitor GAN Training Progress and Identify Common Failure Modes
VGG-19 convolutional neural network (Matlab)
Ledig, C., Theis, L., Husz ́ar, F., Caballero, J., Cunningham, A., Acosta, A., Aitken,A., Tejani, A., Totz, J., Wang, Z., et al.: Photo-realistic single image super-resolution using a generative adversarial network. In: CVPR (2017)
Single Image Super-Resolution Using Deep Learning
(VDSR is implemented using Matlab Deep Learning Toolbox)
Matlab PReLU layer