Overview: Generative Adversarial Networks (GANs)
“Generative Adversarial Networks is the most interesting idea in the last ten years in machine learning” — Yann LeCun, Director, Facebook Artificial Intelligence.
Looking at the images below, many would say that these faces are authentic; they look like real people.
Really, not a single one of these faces are real — all fake. How, you might ask? GANs.
Generative Adversarial Networks (GANs) is a machine learning framework developed in 2014 by Ian Goodfellow and several others. It involves unsupervised machine learning to automatically discover and understand patterns in input data, such as images, to create and output new examples that seem realistic, working against classification models to prove whether the image is real or fake.
Discriminative and Generative Modeling
GANs train a generative model with two-sub models: the generator model — generates new examples, and the discriminator model — classifies examples as real (original) or fake (generated).
Ideally, the generative model creates new examples based on the original data to try and fool the discriminator model, making it think that new examples are the original data.
These two models train together in a zero-sum game until the generative model fools the discriminator model 50% of the time — proving that the generative model is creating images that look realistic.
Here’s a diagram showing how GANs work:
Here’s an analogy:
In this game, the generator is similar to a criminal trying to make counterfeit dollars. Like the police, the discriminator is trying to distinguish between fake and real money only to allow real money. The criminal tries to make their counterfeit money identical to real money as they learn what didn’t work before. As time goes on, the police and criminals both get better at knowing the difference between counterfeit and real money.
Generative Models
Generative Models are unsupervised models that can create new plausible examples. Ideally, the model takes a fixed-length random vector as input and generates a sample in the domain. This vector is selected randomly from a Gaussian distribution link gaussian and is trained. Once training completes, it points at a multidimensional vector space will correspond to the original problem domain. This creates a compressed representation of the actual data distribution.
Discriminative Modelling
This model uses classification to discriminate examples of input data to decide what class the input data belongs to — real or fake. The input data can either be from the initial input data or generated, and the model will classify whether the input data is true or false.
As previously mentioned, GANs work as a 2 player game between the generative model and the discriminative model. The generator creates samples while the discriminator works to determine if the examples are real or fake. Both models are trained as more samples are generated — the generator gets better at making more realistic samples based on the feedback it receives from either fooling the discriminator or getting blocked, while the discriminator gets better at classifying the differences between real and fake images.
When the discriminator gets better at classifying real and fake samples, the generator will use this feedback to tweak its samples to try and find a way to fool the discriminator.
GANs and Convolutional Neural Networks
Convolutional Neural Networks, or CNNs, are a type of neural network used in Artificial Intelligence commonly used to analyze images. In the case of GANs, the generator and discriminator models are both created using CNN’s.
CNN’s are great for object detection and visual recognition, both working with live images — building the generator and discriminator models with CNNs would be beneficial for the GAN.
Uses for GANs:
Some uses for GANs include generating examples for image datasets, human faces, realistic photographs, cartoon characters, image-to-image translations, text-to-image translation, video prediction, and more. However, most applications for GANs include generating and analyzing images.
Overall, GANs can be used for many things as they continue to develop in the Artificial Intelligence field today!
Thanks for reading!
If you’d like to subscribe to my monthly newsletter, click here, and if you’d like to connect with me on LinkedIn, click here. Visit my Personal Website: jayantarora.ca