Skip to main content
QUICK REVIEW

[Paper Review] Soft Neighbors are Positive Supporters in Contrastive Visual Representation Learning

Chongjian Ge, Jiangliu Wang|arXiv (Cornell University)|Mar 30, 2023
Domain Adaptation and Few-Shot LearningComputer Science15 citations
TL;DR

SNCLR introduces soft neighboring positives in contrastive self-supervised learning by using a cross-attention-based positiveness score over a candidate neighbor set, improving representations for CNN and ViT encoders across classification, detection, and segmentation tasks.

ABSTRACT

Contrastive learning methods train visual encoders by comparing views from one instance to others. Typically, the views created from one instance are set as positive, while views from other instances are negative. This binary instance discrimination is studied extensively to improve feature representations in self-supervised learning. In this paper, we rethink the instance discrimination framework and find the binary instance labeling insufficient to measure correlations between different samples. For an intuitive example, given a random image instance, there may exist other images in a mini-batch whose content meanings are the same (i.e., belonging to the same category) or partially related (i.e., belonging to a similar category). How to treat the images that correlate similarly to the current image instance leaves an unexplored problem. We thus propose to support the current image by exploring other correlated instances (i.e., soft neighbors). We first carefully cultivate a candidate neighbor set, which will be further utilized to explore the highly-correlated instances. A cross-attention module is then introduced to predict the correlation score (denoted as positiveness) of other correlated instances with respect to the current one. The positiveness score quantitatively measures the positive support from each correlated instance, and is encoded into the objective for pretext training. To this end, our proposed method benefits in discriminating uncorrelated instances while absorbing correlated instances for SSL. We evaluate our soft neighbor contrastive learning method (SNCLR) on standard visual recognition benchmarks, including image classification, object detection, and instance segmentation. The state-of-the-art recognition performance shows that SNCLR is effective in improving feature representations from both ViT and CNN encoders.

Motivation & Objective

  • Motivate rethinking of binary instance discrimination in contrastive learning by highlighting correlations between different images beyond exact instances.
  • Develop a mechanism to identify and utilize soft, highly-correlated neighboring instances to support the current sample.
  • Integrate a cross-attention-based positiveness score to softly weight neighbors in the contrastive loss.
  • Demonstrate that incorporating soft neighbors improves transferability of learned representations to downstream tasks.

Proposed method

  • Construct a candidate neighbor set of nearest neighbors from other images.
  • Compute a cross-attention based positiveness score w_i between the current view and each candidate neighbor to obtain soft weights.
  • Incorporate these weights into the contrastive loss as a weighted sum of positive contributions (Eq. 2).
  • Use a memory queue C to store momentum-branch features for neighbor identification (Eq. 3).
  • Train with standard SSL backbones (ResNet and ViT) using appropriate optimizers (LARS for ResNet, AdamW for ViT) and augmentations, following established SSL practices.
  • Provide visualization and ablation to show the effect of positiveness, number of neighbors, and candidate set size on performance.

Experimental results

Research questions

  • RQ1Can soft, graded correlations between different images improve contrastive learning over binary instance discrimination?
  • RQ2How should we select and weight neighboring instances to best support a given view in SSL?
  • RQ3Do soft-neighbor enhancements generalize across CNN and ViT architectures and across tasks like classification, detection, and segmentation?

Key findings

  • SNCLR consistently improves top-1 accuracy over several self-supervised baselines on ImageNet for ResNet-50 (e.g., surpassing prior methods at multiple epochs).
  • ViT-based encoders (ViT-S, ViT-B) also benefit from soft neighbors, achieving higher accuracy than several competitive SSL methods.
  • Using 30 soft neighbors with a large candidate set and a positiveness weighting yields the best performance in ablations, indicating the importance of both neighbor count and soft weighting.
  • SNCLR improves transfer to object detection and instance segmentation on COCO when used as a pretraining signal, achieving higher AP metrics than several SSL baselines.
  • Semi-supervised settings show SNCLR achieving strong top-1 and top-5 performance with limited labeled data across ResNet-50 and ViT-S backbones.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.