Abstract
Real-world data typically follow a long-tailed distribution, where a few majority categories occupy most of the data while most minority categories contain a limited number of samples. Classification models minimizing cross-entropy struggle to represent and classify the tail classes. Although the problem of learning unbiased classifiers has been well studied, methods for representing imbalanced data are under-explored. In this paper, we focus on representation learning for imbalanced data. Recently, supervised contrastive learning has shown promising performance on balanced data recently. However, through our theoretical analysis, we find that for long-tailed data, it fails to form a regular simplex which is an ideal geometric configuration for representation learning. To correct the optimization behavior of SCL and further improve the performance of long-tailed visual recognition, we propose a novel loss for balanced contrastive learning (BCL). Compared with SCL, we have two improvements in BCL: class-averaging, which balances the gradient contribution of negative classes; class-complement, which allows all classes to appear in every mini-batch. The proposed balanced contrastive learning (BCL) method satisfies the condition of forming a regular simplex and assists the optimization of cross-entropy. Equipped with BCL, the proposed two-branch framework can obtain a stronger feature representation and achieve competitive performance on long-tailed benchmark datasets such as CIFAR-10-LT, CIFAR-100-LT, ImageNet-LT, and iNaturalist2018.
Introduction: The Challenge of Imbalanced Data
In real-world scenarios, visual data is rarely distributed uniformly. Instead, it typically follows a long-tailed distribution, where a small number of "head" classes possess thousands of samples, while the vast majority of "tail" classes have only a few. Standard deep learning models, particularly those using Supervised Contrastive Learning (SCL), struggle in this environment.
SCL aims to push different classes to opposite sides of a hypersphere, ideally forming a regular simplex—a geometric configuration where every class is equidistant from every other class. However, mathematical analysis reveals that on imbalanced data, head classes exert a disproportionate "repulsive force" during training. This distortion collapses the representation space for tail classes, making them difficult to distinguish.
Methodology: Balanced Contrastive Learning (BCL)
To address these geometric biases, the authors propose a two-branch framework that integrates standard classification with a novel Balanced Contrastive Loss (BCL).
The Two-Branch Framework
The architecture consists of a classification branch (using Cross-Entropy loss) and a contrastive learning branch (using BCL loss). This dual approach allows the model to learn both discriminative features for classification and robust representations that maintain the desired geometric structure.
Key Innovations in BCL
The BCL loss introduces two critical modifications to standard contrastive learning:
- Class-Averaging: Instead of treating every sample in a mini-batch individually, BCL averages the features of each class. This prevents head classes from dominating the gradient updates simply because they have more samples in a batch.
- Class-Complement: Rare classes often fail to appear in random mini-batches. BCL utilizes "class prototypes" (center embeddings for every category) that are always present in the contrastive calculation. This ensures the model continuously maintains the distance between all classes, preserving the regular simplex structure.
Additionally, the classification branch employs Logit Compensation to adjust outputs based on class frequency, further mitigating the bias toward common objects.
Experimental Results
The BCL framework was evaluated on several rigorous long-tailed benchmarks:
- CIFAR-10-LT & CIFAR-100-LT: On CIFAR-100-LT (imbalance factor 100), BCL achieved 51.93% accuracy, outperforming previous state-of-the-art methods like PaCo.
- ImageNet-LT: The model reached 57.1% Top-1 accuracy on this 1,000-class dataset.
- iNaturalist 2018: On this naturally imbalanced dataset of 8,142 species, BCL achieved 71.8% accuracy, demonstrating its scalability to massive real-world problems.
Qualitative analysis via confusion matrices confirms that BCL significantly reduces the tendency of models to misclassify rare "tail" species as common "head" species.
Conclusion and Future Directions
Balanced Contrastive Learning demonstrates that "fairness" in long-tailed recognition can be achieved through geometric regularization. By forcing the model to reserve equal territory in the feature space for every class, BCL creates a more robust and equitable representation.
While effective, the two-branch framework increases training complexity and requires tuning the balance between classification and contrastive losses. Future work could explore more efficient implementations or extend these geometric principles to other domains like Natural Language Processing, where Zipfian distributions present similar imbalanced learning challenges.
Summary updated