Implementing conditional GANs
Imagine a scenario where we want to generate an image of a class of our interest; for example, an image of a cat, a dog, or a man with spectacles. How do we specify that we want to generate an image of interest to us? Conditional GANs come to the rescue in this scenario. For now, let’s assume that we have the images of male and female faces only, along with their corresponding labels. In this section, we will learn about generating images of a specified class of interest from random noise.
The strategy we adopt is as follows:
- Specify the label of the image we want to generate as a one-hot-encoded version.
- Pass the label through an embedding layer to generate a multi-dimensional representation of each class.
- Generate random noise and concatenate with the embedding layer generated in the previous step.
- Train the model just like we did in the previous sections, but this time with the noise vector concatenated with...