Subclass-balancing Contrastive Learning for Long-tailed Recognition

Chengkai Hou, Jieyu Zhang, Haonan Wang, Tianyi Zhou

Subclass-balancing Contrastive Learning for Long-tailed Recognition

Abstract

Real-world datasets often exhibit a long-tailed distribution where a few "head" classes dominate while many "tail" classes have sparse representation. Standard approaches to address this imbalance often lead to instance-level overfitting or ignore the rich semantic diversity within head classes. This paper proposes Subclass-balancing Contrastive Learning (SBCL), a framework that decomposes head classes into semantically consistent subclasses. By balancing these subclasses against tail classes and employing a bi-granularity contrastive loss, SBCL preserves diversity while ensuring robust recognition of rare classes.

Introduction

In machine learning, the "long-tail" problem is a significant hurdle for real-world deployment. While head classes like "dog" or "car" may have thousands of training examples, tail classes like "platypus" or "unicycle" might have only a handful. Conventional models tend to minimize global error by favoring head classes, effectively ignoring the tail.

Existing solutions typically rely on resampling or reweighting. However, these methods often introduce instance imbalance. For example, oversampling a rare class with only ten images to match a head class with a thousand images forces the model to overfit to those specific ten instances. Simultaneously, treating the head class as a single monolithic group ignores its internal semantic substructures—such as the various breeds within a "dog" class. SBCL aims to achieve class balance without sacrificing instance balance or semantic diversity.

Methodology

SBCL introduces two primary innovations to handle long-tailed distributions:

  1. Subclass-balancing Adaptive Clustering: Rather than treating a head class as a single entity, SBCL uses a modified K-means algorithm to partition it into multiple subclasses. These subclasses are designed to be roughly the same size as the tail classes. This clustering occurs in the representation space and is updated periodically throughout the training process to reflect the model's evolving understanding.
  2. Bi-granularity Contrastive Loss: The model is optimized using a hierarchical loss function that operates at two levels:
  3. Subclass-Level (Fine-grained): Encourages images within the same subclass to have similar representations.
  4. Class-Level (Coarse-grained): Pushes images toward others in the same original class while repelling images from different classes.
Overview of SBCL methodology, showing subclass clustering and the bi-granularity contrastive loss.

Additionally, SBCL employs a Dynamic Temperature ($\tau$) parameter. By adjusting the "tightness" of clusters based on their density, the model prevents representation collapse in sparse tail classes, thereby improving generalization.

Key Insights and Results

The core philosophy of SBCL is that head classes contain significantly more information than tail classes. By splitting them, the model is given "more to learn" from the head without drowning out the tail. This approach proves that class balance can be achieved while maintaining instance balance: every individual image contributes equally to learning, while the subclasses provide the necessary structural balance.

Feature distance distributions at subclass and class levels, demonstrating the model's ability to separate semantic clusters.

SBCL was evaluated on several major benchmarks, including CIFAR-100-LT, ImageNet-LT, and the naturally long-tailed iNaturalist 2018 dataset. Key results include:

  • iNaturalist 2018: Achieved a state-of-the-art 70.8% top-1 accuracy.
  • ImageNet-LT: Reached 53.4% accuracy, significantly outperforming standard Supervised Contrastive Learning (49.8%).
  • Generalization: Pre-training with SBCL improved performance on downstream tasks like object detection on PASCAL VOC, indicating the learning of more transferable features.

Conclusion and Future Work

SBCL successfully addresses the long-tail problem by leveraging the inherent hierarchy of data. While the adaptive clustering adds a small computational cost during training and currently requires prior knowledge of class distributions, its performance gains are substantial. Future research may focus on automatically determining the optimal number of subclasses and extending this logic to unsupervised learning environments.

Summary updated

BibTeX
@inproceedings{hou2023subclass,
  author = {Chengkai Hou and Jieyu Zhang and Haonan Wang and Tianyi Zhou},
  title = {{Subclass-balancing Contrastive Learning for Long-tailed Recognition}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2023},
}
Figure