cGANs with Multi-Hinge Loss

Ilya Kavalerov, Wojciech Czaja, Rama ChellappaarXiv 2019

Abstract

We propose a new algorithm to incorporate class conditional information into the critic of GANs via a multi-class generalization of the commonly used Hinge loss that is compatible with both supervised and semi-supervised settings. We study the compromise between training a state of the art generator and an accurate classifier simultaneously, and propose a way to use our algorithm to measure the degree to which a generator and critic are class conditional. We show the trade-off between a generator-critic pair respecting class conditioning inputs and generating the highest quality images. With our multi-hinge loss modification we are able to improve Inception Scores and Frechet Inception Distance on the Imagenet dataset. We make our tensorflow code available at https://github.com/ilyakava/gan.

Introduction

Conditional Generative Adversarial Networks (cGANs) aim to synthesize high-quality images based on specific class labels. State-of-the-art cGANs typically employ two primary mechanisms for conditioning: a projection discriminator and an auxiliary classifier. While these components have pushed the boundaries of image synthesis, they often suffer from a mathematical inconsistency. Most modern GAN discriminators utilize a margin-based hinge loss to distinguish real from fake data, whereas auxiliary classifiers typically rely on a probabilistic cross-entropy loss. This mismatch can lead to unstable training dynamics and a "tug-of-war" between the objectives of realism and class-fidelity.

Methodology

The core of our proposal is the Multi-Hinge Loss, a multi-class generalization of the standard hinge loss inspired by the Crammer-Singer multiclass Support Vector Machine (SVM). Instead of the traditional cross-entropy approach, we define a loss that enforces a clear margin between the affinity of the correct class and the highest affinity among all incorrect classes.

Comparison of GAN architectures: (a) Projection Discriminator, (b) Proposed MHGAN, and (c) Auxiliary Classifier GAN (ACGAN).

We introduce the MHGAN architecture, which integrates this multi-hinge loss into a Self-Attention GAN (SAGAN) framework. Through ablation studies, we found that maintaining separate parameters for the classifier and the discriminator (sharing only the initial feature layers) yields superior results compared to full parameter sharing. This architectural choice allows the model to optimize for both image quality and label accuracy more effectively.

Furthermore, the compatibility of the hinge-based objectives allows for a more efficient training regime. Unlike ACGAN-based models that often require multiple discriminator updates per generator update, MHGAN achieves stable convergence with a 1:1 update ratio. We also extend this method to semi-supervised learning by utilizing "pseudo-labels" for unlabeled data, where the classifier's own predictions guide the hinge loss calculation.

Experimental Results

We evaluated MHGAN on the ImageNet dataset at 128x128 resolution. Our results indicate that MHGAN significantly outperforms both standard SAGAN and ACGAN baselines in terms of both image quality and diversity.

Inception Score (IS) comparison on ImageNet-128. MHGAN (red) achieves higher scores more rapidly than ACGAN (green) and standard GAN (blue).

MHGAN reached a state-of-the-art Inception Score (IS) of 61.98, a substantial improvement over the SAGAN baseline of 52.79. Similarly, the Frechet Inception Distance (FID) improved to 13.27 from 16.39. Beyond aggregate metrics, we observed improved intra-class FID for 622 out of 1,000 ImageNet classes, suggesting a broad enhancement in class-specific generation.

A significant finding of our study is the role of "self-accuracy" — the accuracy of the concurrently trained classifier on the generator's output. We found that if self-accuracy reaches 100% too quickly, it often signals mode collapse, where the generator produces a single high-quality but repetitive image for a class. Monitoring this metric provides a valuable diagnostic for balancing realism and diversity.

Conclusion and Future Work

The multi-hinge loss offers a mathematically consistent and computationally efficient approach to conditional image synthesis. By aligning the objectives of the discriminator and the classifier, we achieve faster training and higher-quality results. However, a trade-off remains: our "MHSharedGAN" variant produced exceptional individual images (FID 8.87) but suffered from reduced diversity. Future research will focus on balancing self-accuracy to prevent mode collapse and investigate the application of multi-hinge loss to even larger architectures like BigGAN.

Summary updated

BibTeX
@misc{kavalerov2019cgans,
  author = {Ilya Kavalerov and Wojciech Czaja and Rama Chellappa},
  title = {{cGANs with Multi-Hinge Loss}},
  year = {2019},
  eprint = {1912.04216},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1912.04216},
}
Figure