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

Constrained Mean Shift for Representation Learning

Ajinkya Tejankar, Soroush Abbasi Koohpayegani, Hamed Pirsiavash

Abstract

We are interested in representation learning from labeled or unlabeled data. Inspired by recent success of self-supervised learning (SSL), we develop a non-contrastive representation learning method that can exploit additional knowledge. This additional knowledge may come from annotated labels in the supervised setting or an SSL model from another modality in the SSL setting. Our main idea is to generalize the mean-shift algorithm by constraining the search space of nearest neighbors, resulting in semantically purer representations. Our method simply pulls the embedding of an instance closer to its nearest neighbors in a search space that is constrained using the additional knowledge. By leveraging this non-contrastive loss, we show that the supervised ImageNet-1k pretraining with our method results in better transfer performance as compared to the baselines. Further, we demonstrate that our method is relatively robust to label noise. Finally, we show that it is possible to use the noisy constraint across modalities to train self-supervised video models.

Introduction

In computer vision, representation learning typically oscillates between two extremes: Supervised Learning, which utilizes labels but often forces all images of a class into a single, rigid cluster, and Self-Supervised Learning (SSL), which learns rich features from unlabeled data but struggles to incorporate known categories or cross-modal relationships effectively.

The authors identify a specific gap: how to use "extra knowledge" (like labels or a second data modality) to guide representation learning without the "collapsing" effect of standard cross-entropy loss or the computational burden of finding negative samples in contrastive learning. They propose Constrained Mean Shift (CMSF), a method flexible enough to handle multi-modal distributions within a single class and robust enough to handle "dirty" data with incorrect labels.

Methodology

CMSF generalizes the Mean Shift algorithm into a deep learning framework. The approach utilizes a dual-encoder setup and a constrained memory bank to refine feature quality.

The CMSF architecture featuring dual encoders and a constrained search mechanism within a memory bank.

Core Components

  1. Dual Encoders: Like modern SSL methods (e.g., BYOL), CMSF uses an Online Encoder (updated via gradients) and a Target Encoder (a slowly moving average of the online encoder).
  2. The Constrained Memory Bank: The model maintains a large queue of embeddings. Instead of searching the entire queue for neighbors, the search is constrained to a subset $\hat{M}$ based on available knowledge. In a supervised setting, $\hat{M}$ contains images sharing the same label; in a cross-modal setting, it is constrained by a pre-trained model in another modality.
  3. Top-k Pulling: The model identifies the top-k nearest neighbors within this constrained set and pulls the query image's embedding closer to the mean of these neighbors.
  4. Non-Contrastive Objective: Unlike SimCLR or MoCo, CMSF does not use negative samples, simplifying training and reducing sensitivity to batch size.

Experimental Results

The authors evaluated CMSF across benchmarks including ImageNet-1k, ImageNet-100, and UCF-101 for video.

Superior Transfer Learning

CMSF pretrained on ImageNet-1k for 200 epochs achieved a mean transfer accuracy of 80.1% across 10 datasets, outperforming standard Cross-Entropy (78.9% even with 1000 epochs) and Supervised Contrastive (SupCon) learning.

Robustness to Label Noise

CMSF is remarkably resilient to label noise. In a 50% noisy label scenario on ImageNet-100, CMSF maintained a transfer accuracy of ~65%, while standard Cross-Entropy dropped to ~48%.

Visualizing CMSF's robustness: even with corrupt labels, the model identifies semantically similar neighbors or weakens the pull when no visual matches exist.

Cross-Modal Video Performance

In the cross-modal setting (RGB constraining Flow), CMSF achieved 55.6% R@1 on UCF-101, significantly outperforming the previous state-of-the-art CoCLR (50.0%).

Discussion

Key Insights

  • Relaxation for Diversity: By pulling toward the top-k neighbors rather than the entire class, CMSF preserves distinct visual "modes" within a category (e.g., different breeds of dogs), leading to semantically purer representations.
  • Local Filtering of Noise: The method's resilience to noise comes from its local search. If a query is mislabeled, the model looks for neighbors in the wrong category; if none are visually similar, the "pull" is weakened, effectively filtering out the noise.

Limitations

  • Memory Overhead: The method relies on a large memory bank (128k entries) to ensure effective $top-k$ search, increasing memory consumption.
  • Teacher Dependency: In cross-modal settings, the representation quality is capped by the quality of the "teacher" modality used for the constraint.

Conclusion

Constrained Mean Shift offers a powerful framework for representation learning that effectively leverages external knowledge while maintaining robustness to data imperfections. Its non-contrastive nature and ability to preserve intra-class diversity make it a compelling alternative to traditional supervised and self-supervised approaches.

Reference: Tejankar, A., Koohpayegani, S. A., & Pirsiavash, H. (2021). Constrained Mean Shift for Representation Learning. arXiv:2110.10309v1.

Summary updated

BibTeX
@misc{tejankar2021constrained,
  author = {Ajinkya Tejankar and Soroush Abbasi Koohpayegani and Hamed Pirsiavash},
  title = {{Constrained Mean Shift for Representation Learning}},
  year = {2021},
  eprint = {2110.10309},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2110.10309},
}
Figure