NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Weakly Supervised Contrastive Learning

Mingkai Zheng, Fei Wang, Shan You, Chen Qian, Changshui Zhang, Xiaogang Wang, Chang XuICCV 2021

Abstract

Unsupervised visual representation learning has gained much attention from the computer vision community because of the recent achievement of contrastive learning. Most of the existing contrastive learning frameworks adopt the instance discrimination as the pretext task, which treating every single instance as a different class. However, such method will inevitably cause class collision problems, which hurts the quality of the learned representation. Motivated by this observation, we introduced a weakly supervised contrastive learning framework (WCL) to tackle this issue. Specifically, our proposed framework is based on two projection heads, one of which will perform the regular instance discrimination task. The other head will use a graph-based method to explore similar samples and generate a weak label, then perform a supervised contrastive learning task based on the weak label to pull the similar images closer. We further introduced a K-Nearest Neighbor based multi-crop strategy to expand the number of positive samples. Extensive experimental results demonstrate WCL improves the quality of self-supervised representations across different datasets. Notably, we get a new state-of-the-art result for semi-supervised learning. With only 1% and 10% labeled examples, WCL achieves 65% and 72% ImageNet Top-1 Accuracy using ResNet50, which is even higher than SimCLRv2 with ResNet101.

Introduction: The Class Collision Problem

Modern self-supervised learning (SSL) frameworks primarily rely on instance discrimination. In this paradigm, the model treats every individual image as its own unique class. While this approach has driven significant progress, it suffers from a fundamental flaw known as the class collision problem.

Figure 1: A typical instance discrimination method treats semantically similar images (like different dogs) as negative pairs, forcing them apart in the embedding space. WCL identifies these as similar samples.

Consider a training batch containing multiple images of the same semantic category, such as different photos of corgis. Standard contrastive methods (e.g., SimCLR) will force the model to push these images apart because they are different "instances," despite being semantically nearly identical. This collision forces the model to ignore shared semantic features, ultimately degrading the quality of the learned representations.

Methodology

To address these limitations, we propose Weakly Supervised Contrastive Learning (WCL). The framework introduces three key innovations designed to reconcile instance-level discrimination with semantic-level similarity.

Two-Head Framework

WCL utilizes a dual-projection head architecture to resolve the conflict between pushing instances apart and pulling similar samples together. One head ($g$) is dedicated to standard instance discrimination, ensuring the model learns fine-grained details. The auxiliary head ($\phi$) focuses on attracting similar samples identified through weak supervision.

Figure 2: The overall WCL framework. Head g performs instance discrimination, while head ϕ uses graph-based weak labels to perform supervised contrastive learning.

Graph-Based Weak Label Generation

Rather than relying on simple top-K nearest neighbors, which can be noisy and non-reciprocal, WCL constructs a 1-nearest neighbor graph for each batch. By applying Connected Components Labeling (CCL), the model groups images into clusters that serve as "weak labels." This ensures that similarity is treated as a reciprocal relationship, identifying which images should be treated as positive pairs during training.

K-NN Multi-Crop Strategy

Building on the multi-crop technique, WCL employs a K-Nearest Neighbor strategy to generate additional positive views from previous epochs. This expands the diversity of the training signal without the computational cost of generating entirely new high-resolution augmentations.

Experimental Results

WCL was evaluated against standard benchmarks including CIFAR-10/100, ImageNet-100, and ImageNet-1K. The results demonstrate significant improvements over previous state-of-the-art methods like SimCLR and SwAV:

  • Semi-Supervised Learning: WCL achieves remarkable efficiency. With only 1% of ImageNet labels, it reaches 65.0% Top-1 accuracy. With 10% labels, it reaches 72.0%, outperforming SimCLRv2 even when the latter uses a larger ResNet-101 backbone.
  • Linear Evaluation: On the full ImageNet-1K dataset, WCL (with multi-crop) achieves 74.7% Top-1 accuracy, surpassing SwAV (72.7%) and SimCLR (69.1%).
  • Representation Quality: t-SNE visualizations confirm that WCL produces tighter, more distinct semantic clusters compared to instance discrimination methods, effectively mitigating the class collision problem.

Conclusion

Weakly Supervised Contrastive Learning (WCL) provides a robust solution to the class collision problem in self-supervised learning. By separating instance discrimination and semantic clustering into a two-head framework and utilizing graph-based weak labels, WCL achieves state-of-the-art performance in semi-supervised and linear evaluation tasks. This approach highlights the importance of incorporating semantic reciprocity into contrastive learning frameworks.

Summary updated

BibTeX
@inproceedings{zheng2021weakly,
  author = {Mingkai Zheng and Fei Wang and Shan You and Chen Qian and Changshui Zhang and Xiaogang Wang and Chang Xu},
  title = {{Weakly Supervised Contrastive Learning}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2021},
  url = {https://openreview.net/forum?id=D-KX_4ZwLyoO},
}
Figure