← All projects

Conditional GAN on CIFAR-10

A plain GAN draws whatever it likes. Feed the class label to both players and you can ask for a ship, a horse or a truck, and the discriminator holds the generator to it.

  • Conditional generation
  • Neural Networks & Deep Learning course
  • University of Tehran · 2020
  • Keras · CIFAR-10
10controllable classes, from airplane to truck
32×32colour images from CIFAR-10
y → G, Dthe label conditions both networks

Where the label goes

GAN vs. cGAN vs. AC-GAN

Interactive

Switch models to see how the label y (orange) is wired in.

In a conditional GAN (Mirza & Osindero, 2014) the one-hot label is joined to the noise vector before the generator, and joined to the image features inside the discriminator. The discriminator's question changes from "is this real?" to "is this a real y?", so an off-class image is rejected even if it looks realistic.

Results by class

Pick a class

Interactive

Each column holds three samples generated for one label.

Classes with a strong, consistent backdrop come through clearly: airplanes on blue sky, ships on water, cars and trucks on roads. Animals are harder; the generator learns their colours and setting (green for frogs, outdoor scenes for horses and deer) before it learns their shape. At 32×32 with a modest network, that is the expected pattern.

The next step in the same project was an AC-GAN, which moves the label from the discriminator's input to an extra classification output. The unconditional baseline is the DCGAN on CIFAR-10.