Skip to main content
QUICK REVIEW

[Paper Review] CoDeGAN: Contrastive Disentanglement for Generative Adversarial Network

Jiangwei Zhao, Zejia Liu|arXiv (Cornell University)|Mar 5, 2021
Adversarial Robustness in Machine LearningComputer Science46 references6 citations
TL;DR

This paper proposes CD-GAN, a novel contrastive disentanglement framework for generative adversarial networks that leverages contrastive learning to disentangle inter-class factors of variation in visual data. By using contrastive loss on class-related features and incorporating limited supervision via labeled anchor images, CD-GAN achieves state-of-the-art unsupervised disentanglement performance and dramatically improves with only 1–2% labeled data.

ABSTRACT

Disentanglement, a critical concern in interpretable machine learning, has also garnered significant attention from the computer vision community. Many existing GAN-based class disentanglement (unsupervised) approaches, such as InfoGAN and its variants, primarily aim to maximize the mutual information (MI) between the generated image and its latent codes. However, this focus may lead to a tendency for the network to generate highly similar images when presented with the same latent class factor, potentially resulting in mode collapse or mode dropping. To alleviate this problem, we propose exttt{CoDeGAN} (Contrastive Disentanglement for Generative Adversarial Networks), where we relax similarity constraints for disentanglement from the image domain to the feature domain. This modification not only enhances the stability of GAN training but also improves their disentangling capabilities. Moreover, we integrate self-supervised pre-training into CoDeGAN to learn semantic representations, significantly facilitating unsupervised disentanglement. Extensive experimental results demonstrate the superiority of our method over state-of-the-art approaches across multiple benchmarks. The code is available at https://github.com/learninginvision/CoDeGAN.

Motivation & Objective

  • To address the challenge of learning disentangled representations in GANs, which lack probabilistic inference and sample likelihood.
  • To explore a new paradigm for inter-class disentanglement in GANs using contrastive learning, inspired by the intuition that identical factor values produce similar image features.
  • To maximize the utility of limited supervision in disentanglement, especially in complex data distributions.
  • To improve training stability and prevent mode collapse through contrastive loss design.

Proposed method

  • Introduces a contrastive disentanglement framework (CD-GAN) with a generator, discriminator, and encoder, where the generator uses a continuous content code z and a one-hot factor code c.
  • Employs a contrastive loss that treats real images with labels as anchor points, contrasting features of generated images with real images of the same or different classes.
  • Uses both ℓ₂ loss and contrastive loss to supervise the encoder, ensuring that features of images with the same class are pulled together and those from different classes are pushed apart.
  • Leverages the contrastive loss to implicitly guide the generator to produce class-consistent samples, even without explicit likelihood or posterior inference.
  • Applies the framework to multiple datasets including MNIST, Fashion-MNIST, CIFAR-10, dSprites, and Faces, with ablation studies on label efficiency.
  • Utilizes SNGAN architecture and evaluates performance using standard metrics: accuracy (ACC), normalized mutual information (NMI), adjusted rand index (ARI), FID, and Inception Score (IS).

Experimental results

Research questions

  • RQ1Can contrastive learning be effectively applied to disentangle inter-class factors in GANs without relying on probabilistic inference?
  • RQ2How can limited supervision be maximized to improve disentanglement performance in GAN-based models?
  • RQ3Does contrastive loss help stabilize GAN training and mitigate mode collapse?
  • RQ4Can CD-GAN achieve state-of-the-art disentanglement performance in unsupervised and weakly supervised settings?

Key findings

  • CD-GAN achieves state-of-the-art unsupervised disentanglement on MNIST with 0.91 ACC, 0.93 NMI, and 0.94 ARI, outperforming InfoGAN and ClusterGAN.
  • On Fashion-MNIST, CD-GAN achieves 0.66 ACC, 0.62 NMI, and 0.53 ARI in the unsupervised setting, significantly outperforming baseline methods.
  • With only 1–2% labeled data, CD-GAN improves disentanglement performance dramatically, achieving 0.82 ACC, 0.72 NMI, and 0.68 ARI on Fashion-MNIST.
  • On the complex CIFAR-10 dataset, CD-GAN with 5% labels achieves 0.41 ACC, 7.65 IS, and 23.97 FID—significantly better than unsupervised baselines and competitive with supervised methods.
  • The contrastive loss design enables better feature separation and calibration of generated images using real labeled images as anchors, improving generalization and disentanglement.
  • CD-GAN demonstrates improved training stability and reduced mode collapse, attributed to the contrastive loss encouraging diversity and consistency in generated samples.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.