Bibek_Rawal
Back to Projects
Deep LearningGenerative AI

Super Resolution GAN

A faithful implementation of the SRGAN paper to upscale low-resolution images into highly detailed high-resolution images, moving beyond standard interpolation techniques.

PythonTensorFlowGANsVGG19Perceptual Loss
Super Resolution Image Generator Hero

The Challenge of Super Resolution

Estimating a high-resolution (HR) image from its low-resolution (LR) counterpart is incredibly challenging. Traditional methods like interpolation or standard convolutional networks rely on calculating average values (optimizing for Mean Squared Error). While mathematically sound, these methods produce overly smooth, blurry textures that humans easily identify as unnatural.

To solve this, I implemented the approach detailed in the SRGAN paper, utilizing a Generative Adversarial Network (GAN) and a novel perceptual loss function.

Network Architecture

The SRGAN architecture consists of two deeply interconnected networks fighting against each other:

The Generator

Trained to generate SR images from LR images. It utilizes 16 residual blocks (Convolution, Batch Normalization, PReLU) and two pixel-shuffler upscaling blocks to increase the resolution by 4x.

Generator Architecture

The Discriminator

Trained to classify whether the image is an artificial SR image or a real HR image. It uses Leaky ReLUs and dense layers to output a single probability.

Discriminator Architecture

Perceptual Loss Function

Instead of directly calculating the MSE between pixels, SRGAN calculates MSE on the feature maps produced by a pre-trained VGG19 network. This "Content Loss" combined with the Discriminator's "Adversarial Loss" creates the final Perceptual Loss, ensuring the generated images not only match the pixels but also the structural features of the real images.

Content Loss Equation
Adversarial Loss Equation

Results & Progression

Due to compute constraints, the model was trained for 30 epochs on a custom dataset of 1,200 images. Despite the limited training, the progression is clear. The model quickly learns to sharpen edges and hallucinate convincing details that traditional interpolation misses.

Training progression comparison

Progression from LR to 5 epochs (Gen1), 15 epochs (Gen2), and 30 epochs (Gen3).

Conclusion

While longer training would resolve minor color grading artifacts, the structural improvement is profound. Implementing a research paper from scratch was an invaluable learning experience that solidified my understanding of adversarial training and perceptual loss.