MMOOZZGG.com

Glossary

What is a GAN neural network?

In short

A generative adversarial network (GAN) is a pair of neural networks where one creates fake examples and the other learns to tell them from real ones, and in this contest the first starts to produce believable pictures.

Machine learning · generative adversarial network

MMOOZZGG.com editorsChecked: 2 min read

For a child

Imagine two friends. One draws toy coins for a shop game, the other works as the cashier and checks each one. At first, the cashier spots a fake at once, and the artist tries to draw more carefully. The cashier gets more careful too. After many rounds, the coins look almost real. This is how two programs teach each other to draw.

In plain words

There are two networks inside. The generator gets a set of random numbers and turns it into a picture. The discriminator sees real photos and the generator’s work in turn and tries to guess which is which. When the discriminator is wrong, the generator learns that its result was convincing, and the discriminator learns from its own misses. They train in turns until the fakes are hard to tell apart. This is how photos of people who do not exist appeared, and they amazed people with their realism even before diffusion models.

For business

Today, images from a description are more often made by diffusion models, but adversarial networks remain where speed matters: raising photo resolution, restoring old pictures, style transfer, and synthetic examples of rare defects for training other models. The generator gives a picture in one pass, so running it is cheap. Training is unstable: the networks may stop converging or give uniform results, and tuning takes the time of an experienced engineer. A separate risk is deepfakes: fake faces were made with this technology, so generated images in ads and documents should be labeled and the source files kept. Where generation pays back and where it does not is covered in the AI roadmap.

For a specialist

The generative adversarial network (GAN) was proposed by Goodfellow and co-authors in 2014. The generator G maps noise z to the data space, and the discriminator D estimates the probability that an example comes from the training set rather than from G. Training is written as a minimax two-player game: D learns to tell them apart, and G maximizes the probability of D making a mistake. With an optimal D, the generator’s task reduces to minimizing the Jensen-Shannon divergence between the distributions. Known problems: mode collapse, instability and vanishing generator gradients. DCGAN (Radford, Metz, Chintala, 2015) set a convolutional architecture with a set of constraints. StyleGAN (Karras, Laine, Aila, 2018) introduced a style-based generator that separates attributes such as pose and identity in faces from random details such as freckles. Variants: conditional GANs, CycleGAN for unpaired image translation, and Wasserstein GAN. The adversarial loss is also used inside other systems, for example in image compression decoders.

Example

A glass maker had collected only a few dozen pictures of a rare crack. Engineers trained a generator on these pictures and got hundreds of believable variants, on which they fine-tuned the defect detector. They tested the detector only on real photos.

Related terms

Questions and answers

How does a GAN differ from a diffusion model? A GAN creates a picture in one pass of the generator and learns in a contest with the discriminator. A diffusion model gets an image in many steps, removing noise bit by bit, and trains more stably.

So for text-to-image generation, diffusion is the more common choice today, while GANs are valued for speed.

What are generative adversarial networks used for? For raising the resolution of photos and restoring them, style transfer, synthetic data for training other models, and face editing. Early deepfakes were also made with them, so the technology raises many questions about labeling.

Sources

Not sure whether your company needs this?

AI solutions map
Contact us