Generative Adversarial Networks, also known as GAN in generative modelling using deep learning methods, such as convolutional neural networks.
With the help of GAN(Generative Adversarial Network we can generate fake images or it can be in use Image Translation from one view to other Ex. Image of Summer view can be change in Winter view.
In the above image, Translation of Image can be view. GAN also generates fake images Ex.
GANs Architecture
GANs consist of two other models
1. Discriminative Modeling
2. Generative Modelling
Discriminative Modeling
The discriminator is a kind of classifier which classifies the images and gives the output as Real or Fake. So Discriminator tries to identify whether an input image is real or fake. It takes two inputs one is from datasets which contain Real images and another input Generator which tries to generate Fake images.
First, we have to train Discriminator with both kinds of images as we do in Supervised learning algorithms.
After training of Discriminator, this model is discard as after this we will try to train a Generator model.
Generative Modeling
Generator modelling is complete to generate Fake images. It takes input from the latent vector(as input) with the help of some computation it generates Fake images which go as input to the discriminator. The generator is not in use here to predict anything like Discriminator we are using a generator to produce a pattern(images). So the technique we use to train Generator is Unsupervised learning.
To understand the training of Generative Adversarial Network, we can take a toy data set (X1, X2. in this data set X1 is a value between the 0-2Pi and X2 is the function of sine X2=sin(X1).
Above Images shows the real data(image) which has curve over X1 and X2
Here G (Generator) takes input random data from latent vectors and try to produce data similar to real data.
D(Discriminator) takes two inputs one is from Real data (x1,x2) and second is from G(Generator). During the training of GAN network Discriminator and generator plays MinMax game. So during training we have to label the data. Real data (x1,x2) will be labelled as 1 and fake data (z1,z2) is label as 0.
Discriminator tries to identify input data as Real or Fake and Generator tries to fool Discriminator to predict fake data as real.
GAN can be imagine as a combine system of D(Discriminator) and G(Generator) which takes noise (latent vector) as input and classifies it. Which in this case can be interpret as a probability.
When G is able to fool D (D will predict fake images as real). We could also use a conventional supervised training framework here: the dataset to train the classification system compose of G and D would be provide by random input samples, and the label associate with each input sample would be One.
After the training when G and D parameters gets update .it is to expect that G will produce data which will be similar to real and D will have more trouble to classify it
GANs loss function (min-max GAN loss)
The GAN loss function is also known as the MinMax game,
During the training of the GAN generator and discriminator plays minimax game as the discriminator tries to maximize it and the generator tries to minimize this function.
GAN loss is divide by two-loss, Discriminator loss and Generator loss.
Discriminator takes input from generators and datasets and tries to classify images whether real or fake. It penalizes when it classifies the real image as fake or fake image as real.
The generator takes input from noise latent vectors and output of generator goes as input in discriminator and tries to fool the discriminator. The generator will be rewarded when it successfully fooled the discriminator.
Written by: Amit Gupta
Reviewed By: Savya Sachi
If you are Interested In Machine Learning You Can Check Machine Learning Internship Program
Also Check Other Technical And Non Technical Internship Programs