Knowledge Center
Knowledge Center

Generative Adversarial Network (GAN)

A neural network framework that can generate new data.


Generative adversarial networks, or GANs, are deep learning frameworks for unsupervised learning that utilize two neural networks. The two networks are pitted against each other, with one generating new data (such as images) that the second network then tries to identify as real or generated.

To understand GANs better, it’s helpful to break them into two separate notions.

The first is the “generative” part. In a classic CNN, a large amount of data (the pixels in an image) is consumed and, by identifying features, is abstracted into smaller and smaller layers. Some think of this as a form of compression, because in theory the compressed version still contains all of the information in the original image, just expressed more concisely. So you should be able to take that compressed version and decompress it — that is, take it through a reverse network that eventually expands it into the original image. That reverse process could be used to generate an image from some distribution function.

The second notion is the “adversarial” aspect. We bring in two networks, one a generator (of images, perhaps), and the other a “discriminator” that evaluates the generated image or some other artifact. The discriminator will have previously been trained to recognize whatever it is the generator is going to put out. The GAN training involves the generator creating images and then having the discriminator decide whether it sees them as “real” or not.

Basic GAN architecture. The generator creates an image from a random seed. The discriminator evaluates the image based on its training to see if it can tell real from fake. The result goes back to the generator and discriminator so that they improve. Source: Bryon Moyer/Semiconductor Engineering

As an example, the discriminator may have access to samples of artwork created by Van Gogh. The generator then creates images, and the discriminator decides whether or not they were created by Van Gogh. If not, then both the generator and discriminator are updated. This feedback acts as training for the generator to create better images, and for the discriminator to do a better job of adjudicating. Eventually, the generator will learn to create images that fool the discriminator. That point is reached when the discriminator says there’s a 50-50 chance of the image (or whatever artifact was created) being real vs. fake.

GANs have been used to perform tasks such as face aging as well as in the creation of ‘deep fake’ images and videos of celebrities and politicians.

From: There’s More To Machine Learning Than CNNs