Class-Distinct and Class-Mutual Image Generation with GANs

Takuhiro Kaneko, Yoshitaka Ushiku, Tatsuya Harada

TL;DR

Most conditional GANs assume that categories are perfectly separate, but real-world data is often messy and overlapping. This paper introduces CP-GAN (Classifier’s Posterior GAN), which replaces rigid discrete labels with "soft" classifier posteriors to generate images that can capture the nuances of overlapping classes (e.g., an image that is both "knitwear" and a "sweater").

What Problem Does This Paper Address?

Standard class-conditional Generative Adversarial Networks (GANs), like AC-GAN or cGAN, are designed to generate images based on a specific category label. However, they operate on a fundamental assumption: classes are mutually exclusive.

In the real world, this is rarely true. Data is often collected using ambiguous or diverse criteria. For example, in a fashion dataset, a "sweater" might also be labeled as "knitwear." If you train a standard GAN on this, the model struggles because it is forced to treat these as distinct buckets. It ignores the "between-class" relationships, leading to poor training stability or a generator that can't handle the "gray areas" where classes overlap. The authors call this the challenge of class-distinct and class-mutual image generation.

Methods

The authors propose CP-GAN (Classifier’s Posterior GAN). To understand CP-GAN, you first have to look at its predecessor, the Auxiliary Classifier GAN (AC-GAN). In AC-GAN, the generator takes a noise vector and a discrete (one-hot) class label.

CP-GAN makes three key architectural changes:

  1. Redesigned Generator Input: Instead of a discrete one-hot label, the generator is conditioned on the classifier’s posterior ($s^r$). This is essentially a "soft label" that represents the probability distribution across all classes for a given real image.
  2. New Objective Function (KL-CP Loss): The authors introduce a loss function based on Kullback–Leibler (KL) divergence. The generator is optimized so that the classifier’s posterior for the generated image matches the posterior of the real image used as a prior. This encourages the model to learn the specific "mutual" state of overlapping classes.
  3. Prior GAN (pGAN): Since you need a real image to get a posterior at inference time, the authors added a secondary, smaller GAN called pGAN. This model learns the distribution of real classifier posteriors, allowing users to sample new "soft labels" to feed into the main generator without needing a reference image.

Datasets

The researchers evaluated their model using both controlled and real-world overlapping data:

  • Controlled Overlap: They created custom versions of CIFAR-10 and MNIST (e.g., "CIFAR-10to5"), where classes were intentionally grouped to overlap (like "digits smaller than five" vs. "even digits").
  • Real-World Overlap: Clothing1M, a dataset of 1 million fashion images from shopping websites known for having high label noise and confusing categories.
  • Image-to-Image Translation: A modified version of CelebA was used to test the model's ability to discover intersections between attributes like "black hair," "male," and "smiling."

Key Insights and Ideas

  • The Posterior is a Feature, Not Just a Result: The "aha moment" here is realizing that the classifier's posterior—usually just an output used for calculating loss—is actually a rich, data-driven representation of class relationships. By feeding it back into the generator, the model learns the "specificity" of an image.
  • Avoiding "Separate-Class" Bias: The authors prove that standard AC-GANs have a mathematical bias toward generating separate class distributions even when the training data overlaps. CP-GAN fixes this by removing the "discrete prior" constraint.
  • Weak Supervision Power: CP-GAN achieves these results without needing extra manual annotations. It discovers the relationships between classes (like the fact that "0" belongs to both "even" and "less than five") entirely through the training process.

Key Results

CP-GAN significantly outperformed baseline models in scenarios with high class overlap:

  • Accuracy in the Overlap: On the CIFAR-10to5 task, CP-GAN achieved a 95.0% Distinct and Mutual Accuracy (DMA), compared to just 36.6% for a standard AC-GAN.
  • Real-World Performance: On the messy Clothing1M dataset, CP-GAN reached a class-distinct accuracy of 65.1%, a massive jump over AC-GAN's 46.3%.
  • Image Quality: In almost all tests, CP-GAN achieved lower (better) FID scores, indicating that respecting class overlaps actually helps the model generate higher-fidelity, more realistic images.

Limitations and Future Work

The primary limitation is that CP-GAN relies heavily on a well-regularized classifier. If the classifier simply "memorizes" the noisy labels (overfitting), it won't produce the meaningful posteriors the generator needs to learn class relationships. The authors used techniques like dropout and shared architectures to mitigate this.

For future work, the authors suggest that this "posterior-conditioning" approach isn't limited to GANs; it could potentially be adapted for other generative frameworks like Variational Autoencoders (VAEs) or Flow-based models to handle complex, real-world data distributions.

Summary updated

BibTeX
@inproceedings{kaneko2019class,
  author = {Takuhiro Kaneko and Yoshitaka Ushiku and Tatsuya Harada},
  title = {{Class-Distinct and Class-Mutual Image Generation with GANs}},
  booktitle = {BMVC},
  year = {2019},
  url = {https://openreview.net/forum?id=bqpBOt3xWURa},
}

Loading related content...

Figure