Implementation of GAN architectures for generating digits.
GAN is a machine learning model architecture, which is used to generate images, inspired by the Minimax theory. Two neural networks (The generator & The discriminator) contest with each other. The generator, tries to fool the discriminator, by generating random fake images, without having any knowledge of the target images. The goal of the discriminator is to classify whether an image is real or fake. An image is considered as real if it comes from the dataset. An image is considered as fake if it is generated.
- Simple GAN
- DC-GAN
- Improved DC-GAN
- W-GAN
- AC-GAN
- Pix2Pix
https://arxiv.org/pdf/1406.2661.pdf
Uses Denses layers both in generator & discriminator model. There are 2 major problems of GANS:
- Mode Collapse: The generator learns simple features to fool the discriminator and exploits them.
- Blurry Images
https://arxiv.org/pdf/1511.06434v2.pdf
Uses Convolutionals (CNN) neural networks. The generator uses Conv2DTranspose layers to upscale the image, while the discriminator uses Conv2D with Strides to downscale the images.
https://arxiv.org/pdf/1801.09195.pdf
The improved model of the DC-GAN contains methods for improving the discriminator model. This makes it harder for the generator to fool the discriminator, which forces it to learn more features and improve image quality. Some of the improvements are:
- Adding Dropout Layers both in Generator & Discriminator. Dropout layers act as Noise, which aim to prevent mode collapsing.
- Adding additional Gaussian Noise to the input of discriminator.
- Adding Batch Normalization at the output of each layer.
- Replacing RELU with Leaky Relu.
- Replacing Sigmoid with Tanh activation function at the output of generator. Also, the dataset if normalized to values between -1 and 1.
- Training the discriminator some extra steps, before training the generator.
- Adding label smoothing in the Binary Crossentropy (BCE) loss function.
- Setting b1 parameter of ADAM to 0.5.
https://arxiv.org/pdf/1704.00028v3.pdf
Replaces BCE loss of Discriminator with Wasserstein loss. Also, It uses Gradient Penalty method to penalize the weights.
https://arxiv.org/pdf/1610.09585.pdf
Adds label information to the GAN intpus. The generator takes as an input the labels (targets) of the images. The discriminator has 2 output layers: One for classifying whether images are real or fake and one for classifying the label (target) of an image.
https://arxiv.org/pdf/1611.07004v3.pdf
I have implemented the patch gan as in the paper with the following improvements:
- The discriminator is trained extra steps.
- The discriminator contains noise in its inputs.
- Unet generator is replaced by Unet3+.