This is pytorch implementation of Super Resolution Gan which enhances the resloution of input images (given they were low resolution) to higher resolution.
The dataset used is taken form kaggle and its consists of 12k high resolution images, i transformed these images into low-res and high-res images using torch transforms
here highres has 4 times thep pixel count of lowres.I could have used the original images as target but using them would be too taxing on the limited hardware.
The model architecture consists of Convolution block, Upsampling block, Dense-residual block(skip connections) repeated and connnected to form Generator and Discriminator just uses conv blocks with increasing channels.The network contains eight convolutional layers with of 3×3 filter kernels, increasing by a factor of 2 from 64 to 512 kernels. Strided convolutions are used to reduce the image resolution each time the number of features is doubled.
for generator L1 loss, VGG loss, Adversarial loss --> gen_loss = l1_loss + loss_for_vgg + adversarial_loss for discriminator is a combination of Gradient penalty and mean loss.
Model was trained on 12k images for 131 epochs with batch size of 16 and implementing pytorch mixed precision for improved performance in training time. During the training, A high-resolution image (HR) is downsampled to a low-resolution image (LR). The generator architecture than tries to upsample the image from low resolution to super-resolution, discriminator and tries to distinguish between a super-resolution and High-Resolution image and generate the adversarial loss* gradient penalty which then backpropagated into the generator. Results i got could be better with more epochs and training with higher-res target images.