I'm going to keep my answer relatively high-level and avoid details like the actual loss functions or activation functions. But please know these also have an effect on GANs.
The Discriminator (D)
The discriminator in a GAN is a binary classifier. It is given an image and asked to predict whether that image is
fake. The discriminator reduces the given image down using convolutional layers. Convolutional layers detect features, in the case of images these would be edges, borders, certain shapes and so on.
The discriminator is learning which features correspond to a
real image and which features correspond to a
The Generator (G)
The generator is almost the inverse of the discriminator: Instead of reducing features it uses deconvolutional layers to create features from a random seed. This random seed is a vector (not a matrix) called the latent vector (z).
The generator is learning which features to create to return a
real label from the discriminator.
How GAN learns
In each training step the following happens:
- Get gen_images from G given z.
- Get real_predictions from D by passing real images to D.
- Get fake_predictions from D by passing gen_images to D.
- Compute loss on G as a function of (
- Compute loss on D as a function of (
real, real_predictions) + (
- Use backpropagation to update the weights and biases in D and G for the losses.
The big point here is that the generator's loss function directly depends on the output of D. Did G manage to trick D or not? This is computed by comparing the
fake_predictions with the
real label. G wants those two values to be as close as possible.
This loss does not correspond to individual pixels, but because we are using convolutions/deconvolutions in our models it corresponds to feature selection (in D) and feature creation (in G) with groups of pixels.
In short: the individual pixels are not directly trained in a GAN's generator, instead patterns and features creation are.
If you are still confused: Think about how a child draws.
A child doesn't start drawing by examining things a millimeter at a time, but by using symbolism and feature selection. At the beginning you can really only guess what they are trying to make.
A cat might be a big mess of scribbles, but slowly the child learns to draw pointy ears, or whiskers. At some point the child can draw features that are identifiable as a cat. The child has gotten feedback from you when you ask her, "Oh, what's that supposed to be?" and when you say, "Oh, is that a cat?" and then finally, "That's a nice looking cat!".