Doubly Contrastive Deep Clustering

Zhiyuan Dang, Cheng Deng, Xu Yang, Heng HuangarXiv 2021

Doubly Contrastive Deep Clustering

Abstract

Unsupervised clustering aims to group similar data points without ground-truth labels. While deep clustering has advanced the field, existing methods often fail to capture global class structures, focusing primarily on local sample-wise relationships. We present Doubly Contrastive Deep Clustering (DCDC), a novel framework that simultaneously applies contrastive learning to individual samples and class distributions. DCDC ensures that augmented versions of the same image—and the same class—remain consistent in the latent space. Our approach achieves a substantial 5.6% accuracy improvement over previous state-of-the-art methods on the Tiny-ImageNet dataset.

Introduction

Clustering is a cornerstone of unsupervised learning, yet it struggles with the complexity of high-dimensional datasets like ImageNet. Traditional deep clustering methods learn non-linear features but often produce inconsistent representations because they ignore the dual nature of data consistency. Most current self-supervised approaches focus on "sample-wise" relationships—determining if an image is the same as its augmented counterpart. However, this misses the "class-wise" perspective: ensuring that different images belonging to the same category maintain a consistent cluster identity. DCDC addresses this gap by introducing a dual-view contrastive loss.

The DCDC Framework

The core innovation of DCDC is the "doubly contrastive" loss function, which operates across two distinct perspectives:

  1. Sample-wise Contrastive View: Following standard contrastive learning (e.g., SimCLR), the model treats an image and its augmentation as a positive pair, while other images in the batch serve as negatives. This pulls similar samples together and pushes dissimilar ones apart.
  2. Class-wise Contrastive View: The model analyzes the probability distribution across classes for a batch. It treats the class distribution of the original batch and the augmented batch as a positive pair, forcing the model to maintain a stable "cluster identity" regardless of transformations.
The DCDC framework pipeline, illustrating the dual path from input data through the backbone network to the sample-wise and class-wise contrastive loss modules.

The architecture utilizes a ResNet backbone and a classification head. To enhance feature expressivity, DCDC employs an over-clustering head, which identifies more clusters than the ground truth (e.g., 700 for a 200-class dataset) to capture fine-grained details.

Experimental Results

DCDC was evaluated on six benchmarks, including CIFAR-10/100, STL-10, and Tiny-ImageNet. The results demonstrate a significant leap in performance across Accuracy (ACC), Normalized Mutual Information (NMI), and Adjusted Rand Index (ARI).

  • Tiny-ImageNet: DCDC achieved 16.4% Accuracy, outperforming the previous state-of-the-art (DCCM at 10.8%) by a wide margin.
  • STL-10: Reached 73.4% Accuracy, surpassing PICA (71.3%).
  • CIFAR-100: Achieved 34.9% Accuracy, a 1.2% improvement over the next best method.
The desired class-wise affinity matrix for DCDC, showing high confidence and clear separation between clusters.

Visual evidence from affinity matrices confirms that DCDC produces much cleaner, more isolated clusters compared to previous methods. Ablation studies further highlight that both sample-wise and class-wise losses are essential; removing either leads to a significant performance degradation.

Discussion and Conclusion

DCDC demonstrates that sample-level consistency is insufficient for robust clustering. By incorporating a class-level constraint, the model learns a global structure that prevents clusters from merging incorrectly. Key findings include the necessity of a batch size proportional to the number of classes to ensure representative class distributions during training.

While DCDC excels on general datasets, it faces challenges with extremely fine-grained categories, such as specific dog breeds in ImageNet-Dogs. Future work will explore more diverse augmentation strategies and scaling the framework to the full ImageNet-1K dataset.

Summary updated

BibTeX
@misc{dang2021doubly,
  author = {Zhiyuan Dang and Cheng Deng and Xu Yang and Heng Huang},
  title = {{Doubly Contrastive Deep Clustering}},
  year = {2021},
  eprint = {2103.05484},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2103.05484},
}
Figure