Generative Adversarial Models

Generative Adversarial Models#

Note

Generative adversarial networks are often abbreviated as GANs.

What do GANs do?#

GANs are used to generate things. A face generator may use GANs to generate new faces. A property owner may use GANs to generate the images of their property. GANs are used when we need almost-good-as-real data. Such as a fake photo, fake song etc.

How do GANs work?#

Generating things are not easy. Even us humans aren’t that good at producing things. Think of the last time you try to create a new song or paint. It’s really difficult.

GANs do this by using competition. There are two players in this game: A generator and a discriminator. A generator is used to generate your target image/audio/video etc. A discriminator is used to tell how good the result is: it tries to tell the real images from the fake ones.

Initially, both generator and discriminator are bad at doing their jobs. A generator generates things that are very rough. Discriminator has no experiences at all. However, as times go on, both get more experiences. Generators try its best to fool the discriminator, and discriminator try to discriminate the real images from the fake ones. The end result is that generators get so good at creating good images that the images it creates can fool us humans (but maybe not discriminators)!

GANs in algorithm.#

Settings: Generator \( G \) Discriminator \( D \) Real data \( X \)

Generate some fake data from \( G \). We call this fake data \( \tilde{X} \). \( D \) is a binary classifier, which outputs \( 1 \) when \( X \) is encountered, and \( 0 \) when \( \tilde{X} \) is seen. \( D \) tries to get the result of \( D(X) \) close to \( 1 \), and \( D(\tilde{X}) \) close to \( 0 \). \( G \) tries to generate \( \tilde{X} \) so that \( D(\tilde{X}) \) gets close to \( 1 \). Repeat the above procedure many times. Voila, you have a good generator ready to generate fake things!