Generative Adversarial Networks (GAN)
A generator and a discriminator compete, so the generator learns to make realistic data.
The idea
The generator turns random noise into fake samples; the discriminator tries to tell real from fake. Each improves by beating the other, like a forger and a detective. At the ideal balance the fakes are indistinguishable from real data and the discriminator can only guess.
min_G max_D E[log D(x)] + E[log(1 − D(G(z)))]
Watch it run
This is a real computation, not a drawing. Pause, step, change the settings, or try new random data.
- real data
- generated
- discriminator boundary
Two networks compete. Real data are blue dots. The generator turns random noise into the orange dots. The discriminator (black line) tries to tell them apart.
- round:
- 0
- distance to real:
- 3.08
A tiny GAN: the generator can only shift and stretch noise, but the competition is the real thing.
Step by step
- 1Sample noise and generate fake examples.
- 2Show the discriminator a mix of real and fake examples and train it to tell them apart.
- 3Train the generator to make the discriminator say "real".
- 4Alternate the two updates.
Where it is used
Image synthesis, super-resolution, data augmentation.
Watch out for
Training is unstable; mode collapse makes the generator produce only a few kinds of output.