liveBook · Manning

Discriminator loss

As explained in Inside Deep Learning: Math, Algorithms, Models

The loss used to train the discriminator in a GAN, combining its performance on real and generated data.

Discriminator loss trains D to classify real data as real and generator output as fake. It combines binary-cross-entropy losses from both data sources. section 9.1.1

Compute the loss in two parts:

  • Apply the classification loss to real data with the real label. section 9.1.1
  • Apply the same loss to G(z) with the fake label, then combine both values over the batch. section 9.1.1
  • Update D from lossD, then alternate with the generator’s loss while training both networks. section 9.1.2

Training cycle

Early fake samples are easy for D to reject. As G improves, D must improve its separation, creating a repeating adversarial cycle. section 9.1.2

Figure 9.4 The start of training a GAN. D receives a batch of multiple images. Some come from the real training data, and others are fake (created by G). For every prediction, D receives a loss based on whether it was correct or not about the source of the image (real versus fake). G’s loss is computed only from the discriminator’s prediction.

Shows how D receives real and generated images while each prediction contributes to its loss. section 9.1.2

How Inside Deep Learning: Math, Algorithms, Models covers it

How deep it goes
Defines real and fake terms, combines them over batches, and relates them to binary cross entropy and min-max notation.
Examples
Uses batches containing real training images and generated images, then follows their behavior across training rounds.
What it assumes
Assumes familiarity with classification loss, two-class labels, generator output, and alternating updates of two networks.
What you can do after
Build it from scratch by combining real-data and fake-data classification losses for discriminator updates.
How it connects
Connects binary cross entropy with GANs, generators, discriminators, alternating optimization, and min-max games.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Inside Deep Learning: Math, Algorithms, Models. The section links point to the parts of the book it draws on.