Chapter 8. Conditional GAN

 

This chapter covers

  • Using labels to train both the Generator and the Discriminator
  • Teaching GANs to generate examples matching a specified label
  • Implementing a Conditional GAN (CGAN) to generate handwritten digits of our choice

In the previous chapter, you learned about the SGAN, which introduced you to the idea of using labels in GAN training. SGANs use labels to train the Discriminator into a powerful semi-supervised classifier. In this chapter, you’ll learn about the Conditional GAN (CGAN), which uses labels to train both the Generator and the Discriminator. Thanks to this innovation, a Conditional GAN allows us to direct the Generator to synthesize the kind of fake examples we want.

8.1. Motivation

As you have seen throughout this book, GANs are capable of producing examples ranging from simple handwritten digits to photorealistic images of human faces. However, although we could control the domain of examples our GAN learned to emulate by our selection of the training dataset, we could not specify any of the characteristics of the data samples the GAN would generate. For instance, the DCGAN we implemented in chapter 4 could synthesize realistic-looking handwritten digits, but we could not control whether it would produce, say, the number 7 rather than the number 9 at any given time.

8.2. What is Conditional GAN?

8.2.1. CGAN Generator

8.2.2. CGAN Discriminator

8.2.3. Summary table

8.2.4. Architecture diagram

8.3. Tutorial: Implementing a Conditional GAN

8.3.1. Implementation

8.3.2. Setup

8.3.3. CGAN Generator

8.3.4. CGAN Discriminator

8.3.5. Building the model

8.3.6. Training

CGAN training algorithm

8.3.7. Outputting sample images

8.3.8. Training the model

8.3.9. Inspecting the output: Targeted data generation

8.4. Conclusion

Summary

sitemap