The discriminator model is the neural network that evaluates the synthetic target data and the real target data to determine which is the real one.
The discriminator, in this case, is a CNN model; it takes a three-dimensional array as input. Often with CNNs, convolving layers and pooling layers are used to reshape the dimensions of the input—ultimately, to a fully connected layer. However, when using these layers to define a discriminator model in the context of creating a GAN, we instead use 2 x 2 strides in the convolving layers to reshape the input dimensions. In the end, a fully connected layer with one unit is passed through the sigmoid activation function to calculate the probability that a given input is real or fake. Let's follow the following lines of code to define the discriminator model:
- As we did in the generator model...