Deep neural networks are used mainly for supervised learning: classification or regression. Generative Adversarial Networks or GANs, however, use neural networks for a very different purpose: Generative modeling.
Introduction to Generative Modeling
Generative modeling is an unsupervised learning task in machine learning that involves automatically discovering and learning the regularities or patterns in input data in such a way that the model can be used to generate or output new examples that plausibly could have been drawn from the original dataset.
While there are many approaches used for generative modeling, a Generative Adversarial Network takes the following approach:
There are two neural networks: a Generator and a Discriminator. The generator generates a "fake" sample given a random vector/matrix, and the discriminator attempts to detect whether a given sample is "real" (picked from the training data) or "fake" (generated by the generator). Training happens in tandem: we train the discriminator for a few epochs, then train the generator for a few epochs, and repeat. This way both the generator and the discriminator get better at doing their jobs.
GANs, however, can be notoriously difficult to train and are extremely sensitive to hyperparameters, activation functions, and regularization.
Discriminator Network
The discriminator takes an image as input, and tries to classify it as "real" or "generated". In this sense, it's like any other neural network. We'll use a convolutional neural network (CNN) which outputs a single number output for every image. We'll use a stride of 2 to progressively reduce the size of the output feature map.
Just like any other binary classification model, the output of the discriminator is a single number between 0 and 1, which can be interpreted as the probability of the input image being real i.e. picked from the original dataset.
Generator Network
The input to the generator is typically a vector or a matrix of random numbers (referred to as a latent tensor) which is used as a seed for generating an image. The generator will convert a latent tensor of shape (128, 1, 1)
into an image tensor of shape 3 x 28 x 28
. To achieve this, we'll use a transposed convolution (also referred to as a deconvolution).
In our next blog, I will show you the practical concept of GANs - Anime faces generation with the help of PyTorch.
Very detailed information please do share more such contents!!!!
ReplyDeleteNice informational article... Kudos to you Mr. Anurag
ReplyDelete