...

/

The Discriminator

The Discriminator

Learn to define the generator class for the CelebA dataset and check the output of the untrained generator.

The discriminator will take an image and try to classify it as real or generated. This is what the MNIST discriminator does so let’s copy that code as a starting point.

The only difference between the MNIST images and the CelebA images are their size and colour depth. The size difference just means we need to change the number of input nodes to the discriminator neural network. The MNIST images were 28 by 28 pixels in size so we had 28 * 28 = 784 input nodes. The CelebA images are 218 by 178 pixels in size. That should mean 218 * 178 input nodes.

📝 Remember that each colour pixel actually has 3 values, one each for the red, green and blue levels. That means each image has a total of 218 * 178 * 3 values. We need to feed all of these to the discriminator because we don’t want to leave any valuable information out. That means the discriminator needs 218 * 178 * 3 = 116,412 input nodes.

A good question to ask is how we should arrange these 116,412 values when we feed them to the discriminator. With the ...