Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network
Christian Ledig, Lucas Theis, Ferenc Huszar, Jose Caballero, Andrew Cunningham, Alejandro Acosta, Andrew Aitken, Alykhan Tejani, Johannes Totz, Zehan Wang, Wenzhe Shi
Introduction
The highly challenging task of estimating a high-resolution (HR) image from its low-resolution (LR) counterpart is referred to as super-resolution (SR). SR received substantial attention from within the computer vision research community and has a wide range of applications .
The ill-posed nature of the underdetermined SR problem is particularly pronounced for high upscaling factors, for which texture detail in the reconstructed SR images is typically absent.
The optimization target of supervised SR algorithms is commonly the minimization of the mean squared error (MSE) between the recovered HR image and the ground truth. This is convenient as minimizing MSE also maximizes the peak signal-to-noise ratio (PSNR), which is a common measure used to evaluate and compare SR algorithms . However, the ability of MSE (and PSNR) to capture perceptually relevant differences, such as high texture detail, is very limited as they are defined based on pixel-wise image differences . This is illustrated in Figure 2, where highest PSNR does not necessarily reflect the perceptually better SR result. The perceptual difference between the super-resolved and original image means that the recovered image is not photo-realistic as defined by Ferwerda .
In this work we propose a super-resolution generative adversarial network (SRGAN) for which we employ a deep residual network (ResNet) with skip-connection and diverge from MSE as the sole optimization target. Different from previous works, we define a novel perceptual loss using high-level feature maps of the VGG network combined with a discriminator that encourages solutions perceptually hard to distinguish from the HR reference images. An example photo-realistic image that was super-resolved with a upscaling factor is shown in Figure 1.
Recent overview articles on image SR include Nasrollahi and Moeslund or Yang et al. . Here we will focus on single image super-resolution (SISR) and will not further discuss approaches that recover HR images from multiple images .
Prediction-based methods were among the first methods to tackle SISR. While these filtering approaches, e.g. linear, bicubic or Lanczos filtering, can be very fast, they oversimplify the SISR problem and usually yield solutions with overly smooth textures. Methods that put particularly focus on edge-preservation have been proposed .
More powerful approaches aim to establish a complex mapping between low- and high-resolution image information and usually rely on training data. Many methods that are based on example-pairs rely on LR training patches for which the corresponding HR counterparts are known. Early work was presented by Freeman et al. . Related approaches to the SR problem originate in compressed sensing . In Glasner et al. the authors exploit patch redundancies across scales within the image to drive the SR. This paradigm of self-similarity is also employed in Huang et al. , where self dictionaries are extended by further allowing for small transformations and shape variations. Gu et al. proposed a convolutional sparse coding approach that improves consistency by processing the whole image rather than overlapping patches.
To reconstruct realistic texture detail while avoiding edge artifacts, Tai et al. combine an edge-directed SR algorithm based on a gradient profile prior with the benefits of learning-based detail synthesis. Zhang et al. propose a multi-scale dictionary to capture redundancies of similar image patches at different scales. To super-resolve landmark images, Yue et al. retrieve correlating HR images with similar content from the web and propose a structure-aware matching criterion for alignment.
Neighborhood embedding approaches upsample a LR image patch by finding similar LR training patches in a low dimensional manifold and combining their corresponding HR patches for reconstruction . In Kim and Kwon the authors emphasize the tendency of neighborhood approaches to overfit and formulate a more general map of example pairs using kernel ridge regression. The regression problem can also be solved with Gaussian process regression , trees or Random Forests . In Dai et al. a multitude of patch-specific regressors is learned and the most appropriate regressors selected during testing.
Recently convolutional neural network (CNN) based SR algorithms have shown excellent performance. In Wang et al. the authors encode a sparse representation prior into their feed-forward network architecture based on the learned iterative shrinkage and thresholding algorithm (LISTA) . Dong et al. used bicubic interpolation to upscale an input image and trained a three layer deep fully convolutional network end-to-end to achieve state-of-the-art SR performance. Subsequently, it was shown that enabling the network to learn the upscaling filters directly can further increase performance both in terms of accuracy and speed . With their deeply-recursive convolutional network (DRCN), Kim et al. presented a highly performant architecture that allows for long-range pixel dependencies while keeping the number of model parameters small. Of particular relevance for our paper are the works by Johnson et al. and Bruna et al. , who rely on a loss function closer to perceptual similarity to recover visually more convincing HR images.
1.2 Design of convolutional neural networks
The state of the art for many computer vision problems is meanwhile set by specifically designed CNN architectures following the success of the work by Krizhevsky et al. .
It was shown that deeper network architectures can be difficult to train but have the potential to substantially increase the network’s accuracy as they allow modeling mappings of very high complexity . To efficiently train these deeper network architectures, batch-normalization is often used to counteract the internal co-variate shift. Deeper network architectures have also been shown to increase performance for SISR, e.g. Kim et al. formulate a recursive CNN and present state-of-the-art results. Another powerful design choice that eases the training of deep CNN s is the recently introduced concept of residual blocks and skip-connections . Skip-connections relieve the network architecture of modeling the identity mapping that is trivial in nature, however, potentially non-trivial to represent with convolutional kernels.
In the context of SISR it was also shown that learning upscaling filters is beneficial in terms of accuracy and speed . This is an improvement over Dong et al. where bicubic interpolation is employed to upscale the LR observation before feeding the image to the CNN.
1.3 Loss functions
Pixel-wise loss functions such as MSE struggle to handle the uncertainty inherent in recovering lost high-frequency details such as texture: minimizing MSE encourages finding pixel-wise averages of plausible solutions which are typically overly-smooth and thus have poor perceptual quality . Reconstructions of varying perceptual quality are exemplified with corresponding PSNR in Figure 2. We illustrate the problem of minimizing MSE in Figure 3 where multiple potential solutions with high texture details are averaged to create a smooth reconstruction.
In Mathieu et al. and Denton et al. the authors tackled this problem by employing generative adversarial networks (GANs) for the application of image generation. Yu and Porikli augment pixel-wise MSE loss with a discriminator loss to train a network that super-resolves face images with large upscaling factors (). GANs were also used for unsupervised representation learning in Radford et al. . The idea of using GANs to learn a mapping from one manifold to another is described by Li and Wand for style transfer and Yeh et al. for inpainting. Bruna et al. minimize the squared error in the feature spaces of VGG19 and scattering networks.
Dosovitskiy and Brox use loss functions based on Euclidean distances computed in the feature space of neural networks in combination with adversarial training. It is shown that the proposed loss allows visually superior image generation and can be used to solve the ill-posed inverse problem of decoding nonlinear feature representations. Similar to this work, Johnson et al. and Bruna et al. propose the use of features extracted from a pre-trained VGG network instead of low-level pixel-wise error measures. Specifically the authors formulate a loss function based on the euclidean distance between feature maps extracted from the VGG19 network. Perceptually more convincing results were obtained for both super-resolution and artistic style-transfer . Recently, Li and Wand also investigated the effect of comparing and blending patches in pixel or VGG feature space.
2 Contribution
GANs provide a powerful framework for generating plausible-looking natural images with high perceptual quality. The GAN procedure encourages the reconstructions to move towards regions of the search space with high probability of containing photo-realistic images and thus closer to the natural image manifold as shown in Figure 3.
In this paper we describe the first very deep ResNet architecture using the concept of GANs to form a perceptual loss function for photo-realistic SISR. Our main contributions are:
We set a new state of the art for image SR with high upscaling factors () as measured by PSNR and structural similarity (SSIM) with our 16 blocks deep ResNet (SRResNet) optimized for MSE.
We propose SRGAN which is a GAN-based network optimized for a new perceptual loss. Here we replace the MSE-based content loss with a loss calculated on feature maps of the VGG network , which are more invariant to changes in pixel space .
We confirm with an extensive mean opinion score (MOS) test on images from three public benchmark datasets that SRGAN is the new state of the art, by a large margin, for the estimation of photo-realistic SR images with high upscaling factors ().
We describe the network architecture and the perceptual loss in Section 2. A quantitative evaluation on public benchmark datasets as well as visual illustrations are provided in Section 3. The paper concludes with a discussion in Section 4 and concluding remarks in Section 5.
Method
In SISR the aim is to estimate a high-resolution, super-resolved image from a low-resolution input image . Here is the low-resolution version of its high-resolution counterpart . The high-resolution images are only available during training. In training, is obtained by applying a Gaussian filter to followed by a downsampling operation with downsampling factor . For an image with color channels, we describe by a real-valued tensor of size and , by respectively.
Our ultimate goal is to train a generating function that estimates for a given LR input image its corresponding HR counterpart. To achieve this, we train a generator network as a feed-forward CNN parametrized by . Here denotes the weights and biases of a -layer deep network and is obtained by optimizing a SR-specific loss function . For training images , with corresponding , , we solve:
In this work we will specifically design a perceptual loss as a weighted combination of several loss components that model distinct desirable characteristics of the recovered SR image. The individual loss functions are described in more detail in Section 2.2.
Following Goodfellow et al. we further define a discriminator network which we optimize in an alternating manner along with to solve the adversarial min-max problem:
The general idea behind this formulation is that it allows one to train a generative model with the goal of fooling a differentiable discriminator that is trained to distinguish super-resolved images from real images. With this approach our generator can learn to create solutions that are highly similar to real images and thus difficult to classify by . This encourages perceptually superior solutions residing in the subspace, the manifold, of natural images. This is in contrast to SR solutions obtained by minimizing pixel-wise error measurements, such as the MSE.
At the core of our very deep generator network , which is illustrated in Figure 4 are residual blocks with identical layout. Inspired by Johnson et al. we employ the block layout proposed by Gross and Wilber . Specifically, we use two convolutional layers with small kernels and 64 feature maps followed by batch-normalization layers and ParametricReLU as the activation function. We increase the resolution of the input image with two trained sub-pixel convolution layers as proposed by Shi et al. .
To discriminate real HR images from generated SR samples we train a discriminator network. The architecture is shown in Figure 4. We follow the architectural guidelines summarized by Radford et al. and use LeakyReLU activation () and avoid max-pooling throughout the network. The discriminator network is trained to solve the maximization problem in Equation 2. It contains eight convolutional layers with an increasing number of filter kernels, increasing by a factor of 2 from 64 to 512 kernels as in the VGG network . Strided convolutions are used to reduce the image resolution each time the number of features is doubled. The resulting 512 feature maps are followed by two dense layers and a final sigmoid activation function to obtain a probability for sample classification.
2 Perceptual loss function
The definition of our perceptual loss function is critical for the performance of our generator network. While is commonly modeled based on the MSE , we improve on Johnson et al. and Bruna et al. and design a loss function that assesses a solution with respect to perceptually relevant characteristics. We formulate the perceptual loss as the weighted sum of a content loss () and an adversarial loss component as:
In the following we describe possible choices for the content loss and the adversarial loss .
The pixel-wise MSE loss is calculated as:
This is the most widely used optimization target for image SR on which many state-of-the-art approaches rely . However, while achieving particularly high PSNR, solutions of MSE optimization problems often lack high-frequency content which results in perceptually unsatisfying solutions with overly smooth textures (c.f. Figure 2).
Instead of relying on pixel-wise losses we build on the ideas of Gatys et al. , Bruna et al. and Johnson et al. and use a loss function that is closer to perceptual similarity. We define the VGG loss based on the ReLU activation layers of the pre-trained 19 layer VGG network described in Simonyan and Zisserman . With we indicate the feature map obtained by the j-th convolution (after activation) before the i-th maxpooling layer within the VGG19 network, which we consider given. We then define the VGG loss as the euclidean distance between the feature representations of a reconstructed image and the reference image :
Here and describe the dimensions of the respective feature maps within the VGG network.
2.2 Adversarial loss
In addition to the content losses described so far, we also add the generative component of our GAN to the perceptual loss. This encourages our network to favor solutions that reside on the manifold of natural images, by trying to fool the discriminator network. The generative loss is defined based on the probabilities of the discriminator over all training samples as:
Here, is the probability that the reconstructed image is a natural HR image. For better gradient behavior we minimize instead of .
Experiments
We perform experiments on three widely used benchmark datasets Set5 , Set14 and BSD100, the testing set of BSD300 . All experiments are performed with a scale factor of between low- and high-resolution images. This corresponds to a reduction in image pixels. For fair comparison, all reported PSNRdB and SSIM measures were calculated on the y-channel of center-cropped, removal of a 4-pixel wide strip from each border, images using the daala packagehttps://github.com/xiph/daala (commit: 8d03668). Super-resolved images for the reference methods, including nearest neighbor, bicubic, SRCNN and SelfExSR , were obtained from online material supplementary to Huang et al.https://github.com/jbhuang0604/SelfExSR and for DRCN from Kim et al.http://cv.snu.ac.kr/research/DRCN/ . Results obtained with SRResNet (for losses: and ) and the SRGAN variants are available onlinehttps://twitter.box.com/s/lcue6vlrd01ljkdtdkhmfvk7vtjhetog. Statistical tests were performed as paired two-sided Wilcoxon signed-rank tests and significance determined at .
The reader may also be interested in an independently developed GAN-based solution on GitHubhttps://github.com/david-gpu/srez. However it only provides experimental results on a limited set of faces, which is a more constrained and easier task.
2 Training details and parameters
We trained all networks on a NVIDIA Tesla M40 GPU using a random sample of 350 thousand images from the ImageNet database . These images are distinct from the testing images. We obtained the LR images by downsampling the HR images (BGR, ) using bicubic kernel with downsampling factor . For each mini-batch we crop 16 random HR sub images of distinct training images. Note that we can apply the generator model to images of arbitrary size as it is fully convolutional. We scaled the range of the LR input images to . The MSE loss was thus calculated on images of intensity range $\frac{1}{12.75}\approx 0.006\beta_{1}=0.910^{-4}10^{6}10^{5}10^{-4}10^{5}10^{-5}k=1B=16$) residual blocks. During test time we turn batch-normalization update off to obtain an output that deterministically depends only on the input . Our implementation is based on Theano and Lasagne .
3 Mean opinion score (MOS) testing
We have performed a MOS test to quantify the ability of different approaches to reconstruct perceptually convincing images. Specifically, we asked 26 raters to assign an integral score from 1 (bad quality) to 5 (excellent quality) to the super-resolved images. The raters rated 12 versions of each image on Set5, Set14 and BSD100: nearest neighbor (NN), bicubic, SRCNN , SelfExSR , DRCN , ESPCN , SRResNet-MSE, SRResNet-VGG22∗ (∗not rated on BSD100), SRGAN-MSE∗, SRGAN-VGG22∗, SRGAN-VGG54 and the original HR image. Each rater thus rated 1128 instances (12 versions of 19 images plus 9 versions of 100 images) that were presented in a randomized fashion. The raters were calibrated on the NN (score 1) and HR (5) versions of 20 images from the BSD300 training set. In a pilot study we assessed the calibration procedure and the test-retest reliability of 26 raters on a subset of 10 images from BSD100 by adding a method’s images twice to a larger test set. We found good reliability and no significant differences between the ratings of the identical images. Raters very consistently rated NN interpolated test images as 1 and the original HR images as 5 (c.f. Figure 5).
The experimental results of the conducted MOS tests are summarized in Table 1, Table 2 and Figure 5.
4 Investigation of content loss
We investigated the effect of different content loss choices in the perceptual loss for the GAN-based networks. Specifically we investigate for the following content losses :
SRGAN-MSE: , to investigate the adversarial network with the standard MSE as content loss.
SRGAN-VGG22: with , a loss defined on feature maps representing lower-level features .
SRGAN-VGG54: with , a loss defined on feature maps of higher level features from deeper network layers with more potential to focus on the content of the images . We refer to this network as SRGAN in the following.
We also evaluate the performance of the generator network without adversarial component for the two losses (SRResNet-MSE) and (SRResNet-VGG22). We refer to SRResNet-MSE as SRResNet. Note, when training SRResNet-VGG22 we added an additional total variation loss with weight to . Quantitative results are summarized in Table 1 and visual examples provided in Figure 6. Even combined with the adversarial loss, MSE provides solutions with the highest PSNR values that are, however, perceptually rather smooth and less convincing than results achieved with a loss component more sensitive to visual perception. This is caused by competition between the MSE-based content loss and the adversarial loss. We further attribute minor reconstruction artifacts, which we observed in a minority of SRGAN-MSE-based reconstructions, to those competing objectives. We could not determine a significantly best loss function for SRResNet or SRGAN with respect to MOS score on Set5. However, SRGAN-VGG54 significantly outperformed other SRGAN and SRResNet variants on Set14 in terms of MOS. We observed a trend that using the higher level VGG feature maps yields better texture detail when compared to (c.f. Figure 6). Further examples of perceptual improvements through SRGAN over SRResNet are provided in the supplementary material.
5 Performance of the final networks
We compare the performance of SRResNet and SRGAN to NN, bicubic interpolation, and four state-of-the-art methods. Quantitative results are summarized in Table 2 and confirm that SRResNet (in terms of PSNR/SSIM) sets a new state of the art on three benchmark datasets. Please note that we used a publicly available framework for evaluation (c.f. Section 3.1), reported values might thus slightly deviate from those reported in the original papers.
We further obtained MOS ratings for SRGAN and all reference methods on BSD100. Examples of images super-resolved with SRResNet and SRGAN are depicted in the supplementary material. The results shown in Table 2 confirm that SRGAN outperforms all reference methods by a large margin and sets a new state of the art for photo-realistic image SR. All differences in MOS (c.f. Table 2) are highly significant on BSD100, except SRCNN vs. SelfExSR. The distribution of all collected MOS ratings is summarized in Figure 5.
Discussion and future work
We confirmed the superior perceptual performance of SRGAN using MOS testing. We have further shown that standard quantitative measures such as PSNR and SSIM fail to capture and accurately assess image quality with respect to the human visual system . The focus of this work was the perceptual quality of super-resolved images rather than computational efficiency. The presented model is, in contrast to Shi et al. , not optimized for video SR in real-time. However, preliminary experiments on the network architecture suggest that shallower networks have the potential to provide very efficient alternatives at a small reduction of qualitative performance. In contrast to Dong et al. , we found deeper network architectures to be beneficial. We speculate that the ResNet design has a substantial impact on the performance of deeper networks. We found that even deeper networks () can further increase the performance of SRResNet, however, come at the cost of longer training and testing times (c.f. supplementary material). We further found SRGAN variants of deeper networks are increasingly difficult to train due to the appearance of high-frequency artifacts.
Of particular importance when aiming for photo-realistic solutions to the SR problem is the choice of the content loss as illustrated in Figure 6. In this work, we found to yield the perceptually most convincing results, which we attribute to the potential of deeper network layers to represent features of higher abstraction away from pixel space. We speculate that feature maps of these deeper layers focus purely on the content while leaving the adversarial loss focusing on texture details which are the main difference between the super-resolved images without the adversarial loss and photo-realistic images. We also note that the ideal loss function depends on the application. For example, approaches that hallucinate finer detail might be less suited for medical applications or surveillance. The perceptually convincing reconstruction of text or structured scenes is challenging and part of future work. The development of content loss functions that describe image spatial content, but more invariant to changes in pixel space will further improve photo-realistic image SR results.
Conclusion
We have described a deep residual network SRResNet that sets a new state of the art on public benchmark datasets when evaluated with the widely used PSNR measure. We have highlighted some limitations of this PSNR-focused image super-resolution and introduced SRGAN, which augments the content loss function with an adversarial loss by training a GAN. Using extensive MOS testing, we have confirmed that SRGAN reconstructions for large upscaling factors () are, by a considerable margin, more photo-realistic than reconstructions obtained with state-of-the-art reference methods.
References
A Supplementary Material
In this supplementary material we first briefly investigate the influence of network depth (number of residual blocks) on the performance (PSNR, time) of SRResNet in Section A.1. We then visualize on an example image how the SRGAN network performance evolves with increasing number of training iterations in Section A.2. Results of the MOS tests conducted on Set5, Set14, BSD100 are summarized in Section A.3. Finally we provide a visualization of all image reconstruction obtained with SRResNet and SRGAN with a upscaling factor for Set5 (Section A.4), Set14 (Section A.5) and five randomly selected images from BSD100 (Section A.6).
Images are best viewed and compared zoomed in. All original low-/high-resolution images and reconstructions ( upscaling) obtained with different methods (bicubic, SRResNet-MSE, SRResNet-VGG22, SRGAN-MSE, SRGAN-VGG22, SRGAN-VGG54) described in the paper are available for download at https://twitter.box.com/s/lcue6vlrd01ljkdtdkhmfvk7vtjhetog.
We investigated the influence of network depth, specifically the number of residual blocks, on performance (PSNR [dB] on BSD100 for SR) and inference time [s] of the network architecture described in Figure 4 of the main paper. Time was assessed on a NVIDIA M40 GPU and averaged over 100 reconstructions of a random low-resolution image with resolution 6464 with upscaling factor . The measurements are plotted in Figure 7 for a network with (blue) and without (red) skip-connection. As expected the time of a single forward pass through the network depends approximately linearly on the number of residual blocks. Whether a skip-connection is used or not has no substantial impact on inference time. However, we observed substantial gains in performance with the additional skip-connection. We chose a network architecture of 16 residual blocks with skip-connection for the evaluation presented in the main paper as we consider this as good trade-off between accuracy and speed including training time. While accuracy gains slowly saturate beyond 16 blocks there is, nevertheless, a clear benefit of using even deeper networks.
A.2 Evolution of Generator during SRGAN training
We further investigated how reconstructions of the SRGAN generator network evolve (visually) with increasing number of training iterations. Visual results obtained after different number of training iterations are illustrated in Figure 8. It is interesting that after only 20 thousand training iterations the generator substantially diverged from the SRResNet initialization and produces reconstruction with a lot of high frequency content, including noise. With increasing number of training iterations reconstructions of the baboon from Set14 appear closer to the reference image. However, there is visually little change during the last 50-100 thousand update iterations.
A.3 Mean opinion score (MOS) testing
In all conducted MOS tests we have asked 26 human raters to assign a score from 1 (Bad) to 5 (Excellent) to reconstructions of the downsampled versions of images from Set5, Set14 and BSD100. On BSD100 nine versions of each image were rated by each rater. On Set5 and Set14 the raters also rated three additional versions of the proposed methods to investigate different content losses. In total 26*100*9 + 26*14*12 + 26*5*12 = 29328 ratings were obtained, where each rater rated 1128 images. Images were presented in a completely randomized fashion without any indication of the employed super-resolution approach. The raters were calibrated on images not included in the testing set such that the nearest neighbor interpolated reconstruction should receive score 1 (Bad) and the original high-resolution image score 5 (Excellent). The distribution of MOS ratings on each individual data set is summarized in Figure 9. The average ordinal rank over all corresponding ratings of an image and rater are shown in Figure 10. Note that a score of 1 corresponds to the best rank and ranks are averaged for samples that would have the same ordinal ranking. While results on Set5 are somewhat inconclusive due to very small sample size and images with comparably little detail, ratings on Set14 and especially on the large BSD100 data set confirm that SRGAN is significantly better than any compared state-of-the-art method. In fact, MOS ratings obtained with SRGAN are closer to those of the original high-resolution images than to those obtained with any reference method.