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
