Abstract
Self-supervised learning based on instance discrimination has shown remarkable progress. In particular, contrastive learning, which regards each image as well as its augmentations as an individual class and tries to distinguish them from all other images, has been verified effective for representation learning. However, pushing away two images that are de facto similar is suboptimal for general representation. In this paper, we propose a hierarchical semantic alignment strategy via expanding the views generated by a single image to Cross-samples and Multi-level representation, and models the invariance to semantically similar images in a hierarchical way. This is achieved by extending the contrastive loss to allow for multiple positives per anchor, and explicitly pulling semantically similar images/patches together at different layers of the network. Our method, termed as CsMl, has the ability to integrate multi-level visual representations across samples in a robust way. CsMl is applicable to current contrastive learning based methods and consistently improves the performance. Notably, using the moco as an instantiation, CsMl achieves a 76.6% top-1 accuracy with linear evaluation using ResNet-50 as backbone, and 66.7% and 75.1% top-1 accuracy with only 1% and 10% labels, respectively. All these numbers set the new state-of-the-art.
Introduction
Most modern self-supervised learning (SSL) relies on the paradigm of contrastive learning. In this framework, a model learns that different augmentations (views) of the same image should have similar features, while views of any other image should be pushed apart. However, this "instance discrimination" approach has a fundamental flaw: it treats every image as a unique class. For example, two different photos of golden retrievers are pushed apart in the feature space despite being semantically identical. This contradicts the alignment principle—the idea that semantically similar entities should have similar representations. Furthermore, most SSL methods focus solely on the final layer, leaving intermediate layers under-optimized for downstream tasks like object detection.
Methodology: Cross-Samples and Multi-Level Representation (CsMl)
To address these limitations, we propose CsMl, which introduces two major innovations: Cross-Sample Semantic Alignment and Multi-Level Supervision.
Cross-Sample Semantic Alignment
Instead of restricting positive pairs to augmentations of a single image, CsMl performs a $k$-nearest neighbor (KNN) search in the feature space to identify semantically similar "positive" samples from other images in the dataset. To mitigate the impact of potentially noisy neighbors, we employ CutMix to create interpolated samples between the anchor and its neighbors. This acts as a smoothing regularizer, allowing the model to learn from a continuous spectrum of similarity rather than binary labels.
Multi-Level Supervision
CsMl attaches auxiliary contrastive loss branches to intermediate stages of the network (e.g., Stages 2 and 3 of a ResNet). This hierarchical approach ensures that intermediate layers are optimized for semantic representation, which is particularly beneficial for downstream tasks that rely on mid-level features. To prevent gradient competition between layers, bottleneck layers are utilized to ensure smooth optimization across the hierarchy.
Experimental Results
We evaluated CsMl on ImageNet-1K for classification and on PASCAL VOC and MS COCO for transfer learning in object detection and segmentation.
CsMl sets a new benchmark for self-supervised ResNet-50 models:
- Linear Evaluation: Achieves 76.6% top-1 accuracy on ImageNet, significantly outperforming MoCo v2 (71.1%) and SwAV (75.3%).
- Semi-Supervised Learning: With only 1% of labels, it reaches 66.7% accuracy; with 10% labels, it reaches 75.1%, approaching the performance of fully supervised models (76.5%).
- Downstream Tasks: On MS COCO, CsMl outperforms supervised baselines and other SSL methods, demonstrating superior performance in detecting small and medium-sized objects.
Discussion and Conclusion
CsMl demonstrates that breaking the instance barrier and supervising hierarchical features can significantly enhance representation learning. While the KNN search and multi-level branches introduce some computational overhead, the performance gains are substantial. Future work will explore the scalability of this hierarchical alignment to larger architectures like Vision Transformers (ViTs) and even larger datasets.
Summary updated