A GAN consists of two networks that are competing against each other.

Generative Adversarial Networks-1775684184739.webp

They are linked together in a GAN:

Generative Adversarial Networks-1775684202293.webp

The generative network is trying to fool the discriminative network into misclassifying “fake” (generated inputs). Meanwhile, the discriminative network is also learning how to classify inputs as real or fake: i.e., does it come from the dataset, or from the generative network?

Generative Adversarial Networks-1775684305530.webp

outputs the probability that is from the real data:

creates an input sample from random noise with distribution :

The loss for the GAN has two parts:

  • The first term minimizes with respect to to make the discriminator better at detecting real vs. fake. are real inputs, and the target for and for .
  • The second term minimizes with respect to to make the generator better at producing fake inputs that look real to the discriminator.

Generative Adversarial Networks-1775684846290.webp

Generative Adversarial Networks-1775684945892.webp

Training the generator:

  • generate a fake sample
  • pass it through the discriminator
  • measure loss against the label 1
  • update the generator so that the discriminator becomes more likely to output “real”.