The Discriminator

The discriminator in a GAN is simply a classifier. It tries to distinguish real data from the data created by the generator. It could use any network architecture appropriate to the type of data it's classifying.

A diagram of a generative adversarial network. At the center of the
          diagram is a box labeled 'discriminator'. Two branches feed into this
          box from the left.  The top branch starts at the upper left of the
          diagram with a box labeled 'real world images'. An arrow leads
          from this cylinder to a box labeled 'Sample'. An arrow from the box
          labeled 'Sample' feeds into the 'Discriminator' box. The bottom branch
          feeds into the 'Discriminator' box starting with a box labeled 'Random
          Input'. An arrow leads from the 'Random Input' box to a box labeled
          'Generator'. An arrow leads from the 'Generator' box to a second
          'Sample' box. An arrow leads from the 'Sample' box to the
          'Discriminator box. On the right side of the Discriminator
          box, two arrows lead to two
          boxes on the right side of the diagram. One arrow leads to a box
          labeled 'Discriminator loss'. The other arrow leads to a box labeled
          'Generator loss'. A yellow box labeled with a left-pointing arrow and
          the word 'Backpropagation' is drawn around the
          discriminator box and the discriminator loss box to
          indicate that backpropagation operates on the portion of the
          system enclosed in the yellow box.

Figure 1: Backpropagation in discriminator training.

Discriminator Training Data

The discriminator's training data comes from two sources:

  • Real data instances, such as real pictures of people. The discriminator uses these instances as positive examples during training.
  • Fake data instances created by the generator. The discriminator uses these instances as negative examples during training.

In Figure 1, the two "Sample" boxes represent these two data sources feeding into the discriminator. During discriminator training the generator does not train. Its weights remain constant while it produces examples for the discriminator to train on.

Training the Discriminator

The discriminator connects to two loss functions. During discriminator training, the discriminator ignores the generator loss and just uses the discriminator loss. We use the generator loss during generator training, as described in the next section.

During discriminator training:

  1. The discriminator classifies both real data and fake data from the generator.
  2. The discriminator loss penalizes the discriminator for misclassifying a real instance as fake or a fake instance as real.
  3. The discriminator updates its weights through backpropagation from the discriminator loss through the discriminator network.

In the next section we'll see why the generator loss connects to the discriminator.

Send feedback about...

Generative Adversarial Networks