Source-linked AI summary

Seed the Views: Hierarchical Semantic Alignment for Contrastive Representation Learning

Haohang Xu, Xiaopeng Zhang, Hao Li, Lingxi Xie, Hongkai Xiong, Qi Tian

arXiv:2012.02733v2cs.CV

TL;DR

Contrastive learning can push semantically similar images apart by treating them as negatives. CsMl expands views across samples and network levels, using data mixing to select positives and aligning features at intermediate layers. It consistently outperforms previous self-supervised methods on benchmarks and detection and segmentation tasks, including 76.6% top-1 accuracy on ImageNet linear evaluation.

  • Problem

    Contrastive learning treats other images as negatives, even when they are semantically similar, and its single-image positives limit modeling semantic invariance.

    Source: §1 · p. 1, §3.1 · p. 3
  • Method

    CsMl expands contrastive views across samples using data-mixed positives and aligns representations at intermediate network layers.

    Source: §1 · p. 2, §3.2 · p. 3, §5 · pp. 8–9
  • Results

    CsMl consistently outperforms previous self-supervised methods on benchmarks and detection and segmentation tasks, reaching 76.6% top-1 accuracy on ImageNet linear evaluation.

    Source: §1 · p. 2, §5 · p. 9
  • Takeaways & Limitations

    The authors conclude that aligning semantically similar samples across intermediate layers benefits general representation.

    Source: §5 · p. 9

Abstract

from arXiv · show

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 \textbf{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 \textbf{76.6\% }top-1 accuracy with linear evaluation using ResNet-50 as backbone, and \textbf{66.7\%} and \textbf{75.1\%} top-1 accuracy with only 1\% and 10\% labels, respectively. \textbf{All these numbers set the new state-of-the-art.}

1. Introduction

Contrastive learning can push semantically similar images apart because it treats other images as negatives. CsMl expands views across samples and network levels, and improves representation performance on classification, detection, and segmentation tasks.

1. Introduction

  • Contrastive learning treats other images as negatives, so semantically similar images may be pushed apart despite the alignment principle favoring similar features for similar samples.The authors describe this as conflicting with the intrinsic image distribution and as suboptimal for feature representation.Source: §1 · p. 1
  • CsMl expands views across samples by selecting nearest neighbors as positives and using data mixing to generate extra positives as a smoothing regularization of the anchor.The authors describe mixing as a way to extend similar samples more smoothly and robustly when selecting positives poses a trade-off between limited gains and noisy samples.Source: §1 · p. 2
  • CsMl extends views to intermediate network layers and uses bottleneck layers for intermediate losses to address gradient competition during hierarchical training.The paper states that this deeply supervises features throughout the network and benefits transferability.Source: §1 · p. 2
  • 76.6% top-1 accuracy on ImageNet linear evaluation; CsMl also reaches 66.7% and 75.1% top-1 accuracy with 1% and 10% labels, respectively.The reported comparison uses MoCo with a standard ResNet-50; the paper also reports better results than previous self-supervised methods on detection and segmentation.Source: Figure 1 · p. 1, §1 · p. 2

2. Related Work

Related work covers earlier self-supervised pretext tasks, instance discrimination, augmentation choices, and supervised contrastive learning. The paper distinguishes its unlabeled positive-sample selection and intermediate-layer alignment from supervised contrastive learning.

2. Related Work

  • Earlier self-supervised approaches use image priors such as patch-position prediction, inpainting, colorization, and rotation prediction; more recent instance-discrimination methods maximize mutual information across augmentations.The passage notes that negative-sample choices, hyperparameters, and augmentations affect representation quality.Source: §2 · p. 2
  • Contrastive learning relies on augmentations that preserve object identity, while the cited mixup approach [25] mixes all images and can destroy local similarity between semantically dissimilar samples.The passage describes widely used augmentation methods as operating within a single sample.Source: §2 · p. 2
  • Unlike supervised contrastive learning [15], CsMl selects positive samples without ground-truth labels and extends contrastive loss to intermediate layers.The authors connect intermediate-layer alignment with discriminative representation and transferability, especially in semi-supervised learning.Source: §2 · pp. 2–3

3. Methodology

CsMl extends instance contrastive learning beyond a single-image positive by selecting semantically similar cross-sample views and aligning representations at intermediate and final layers.

3.1. An Overview of Contrastive Learning

  • Standard contrastive learning uses one positive per query and treats other images as negatives, leaving its invariance to semantically similar images unmodeled.The methodology frames this as a limitation for representing similar images.Source: §3.1 · p. 3

3.2. Contrastive Learning with Cross-Sample Views

  • For each anchor, CsMl selects a nearest-neighbor image as a positive and adjusts the contrastive loss to pull their representations together against other samples.The loss uses positive keys from both the anchor and the selected neighbor.Source: §3.2 · p. 3
  • Data mixing creates an additional positive that expands the anchor's neighborhood, addressing the trade-off between limited gains from very similar positives and noise from broader selection.The method uses CutMix to combine an anchor with a selected similar neighbor.Source: §3.2 · pp. 3–4

3.3. Contrastive Learning with Multi-level Views

  • CsMl adds contrastive objectives at intermediate stages to improve their discrimination and combines the intermediate-stage losses with the final loss.The framework aligns the anchor, neighbor, and mixed sample at intermediate layers as well as in the final embedding space.Source: §3.3 · pp. 4–5, Figure 2 · p. 4

4. Experiments

Experiments evaluate CsMl on ImageNet classification, semi-supervised learning, and downstream transfer, with ablations testing its components and training costs. Results include stronger ImageNet linear and low-label performance, along with gains on detection and intermediate representations.

4.1. Pre-training Details

  • Training uses ResNet-50 on ImageNet with MoCo settings, nearest-neighbor positive selection, and intermediate losses at stages 2 and 3.The final model is trained for 800 epochs.Source: §4.1 · pp. 5–6

4.2. Experiments on ImageNet

  • 76.6% top-1 accuracy with multi-crop augmentation surpasses SwAV by 1.3% on ImageNet linear evaluation; CsMl also reaches 74.4% after 800 epochs, 3.3% above MoCo v2.Source: §4.2 · p. 6
  • 66.7% top-1 accuracy with 1% labels and 75.1% with 10% labels follow data mining; fine-tuning alone reaches 62.2% and 72.9%, respectively.Source: §4.2 · p. 6, Table 3 · p. 6

4.3. Downstream Tasks

  • On COCO, CsMl outperforms supervised and MoCo v2 baselines and performs particularly well on small and medium objects; on VOC, it reaches 82.7% AP50 and 64.1% AP75, slightly above MoCo v2.Source: §4.3 · p. 7, Table 4 · p. 7, Table 5 · p. 7

4.4. Ablation Studies

  • Adding one positive sample improves MoCo v2 by 2.9%, mixed samples add another 1.2%, and multi-crop augmentation adds 3%.Source: §4.4 · p. 7, Table 6 · p. 7
  • With mixed samples, accuracy is robust across k values 1, 5, 10, and 100; without them it is more sensitive, while the k=0 setting improves only from 67.5% to 68.6%.Source: §4.4 · pp. 7–8, Figure 4 · p. 8
  • Stage 3 accuracy rises from 60.7% to 64.0% with shallow-layer pulling, and 1%-label fine-tuning improves by 1.4%; stage 2 gains are smaller.Source: Figure 3 · p. 7, §4.4 · p. 8, Table 7 · p. 8

4.5. Analysis and Discussions

  • At 200 epochs, CsMl reaches 70.4% versus 68.9% for MoCo v2 with doubled batch size; including mixed samples raises compute by roughly 25%, while multi-level cost is marginal.At 800 epochs, CsMl reaches 74.4%, compared with MoCo v2's 71.9% at 1600 epochs.Source: §4.5 · p. 8

5. Conclusion

The conclusion presents CsMl as hierarchical semantic alignment for contrastive learning, extending alignment across samples and intermediate layers. It reports consistent improvements over previous self-supervised methods on widely used benchmarks.

  • Data mixing selects similar samples for positives while preserving their local similarity structure.Source: §5 · p. 8
  • Extending semantic alignment to intermediate hidden layers promotes discriminative representations throughout the network, which the authors find beneficial for general representation.Source: §5 · p. 9

A.1. Results on BYOL

CsMl is also applied to BYOL, a method that does not require negative samples. With 300 epochs of pretraining, it exceeds BYOL's reported result after 1000 epochs.

  • 75.3% linear classification accuracy with CsMl-BYOL after 300 epochs is better than BYOL after 1000 epochs.Source: §A.1 · p. 11

A.2. Results of more positive pairs

The authors test using multiple positive pairs per anchor and compare that approach with mixed samples as positives. Two positive pairs perform similarly to one, while mixed samples are more effective.

  • Using two positive pairs achieves a result similar to one pair, whereas mixed samples as positive pairs are more effective; the method uses one positive per anchor to limit added computation.Source: §A.2 · p. 11

A.3. MixUp v.s. CutMix augmentations

The comparison reports that Mixup performs worse than CutMix and slightly worse than the unmixed query setting. The authors suggest that Mixup may disrupt the natural pixel distribution.

A.3. MixUp v.s. CutMix augmentations

  • Mixup performs worse than CutMix in the reported comparison.The passage refers to Table A.3 but does not provide its values.Source: §A.3 · p. 11
  • Mixup is slightly worse than the qa + qp baseline, which uses no mixed sample in the query.Source: §A.3 · p. 11
  • The authors suggest Mixup may underperform because its augmentations destroy the naturality of the pixel distribution.Source: §A.3 · p. 11

A.4. Visualization of Feature Representation

The t-SNE visualization compares last-embedding features from CsMl, MoCo v2, and fully supervised learning on ten randomly selected validation classes. CsMl shows higher alignment than MoCo, while supervised features show the highest alignment.

A.4. Visualization of Feature Representation

  • The visualization uses last-embedding features from ten randomly selected validation classes, with color indicating the class label.Source: §A.4 · p. 11
  • CsMl shows higher feature alignment than MoCo in the t-SNE comparison.Source: §A.4 · p. 11
  • Fully supervised features show the highest alignment, which the authors attribute to the availability of image labels.Source: §A.4 · p. 11

A.5. Performance comparisons of CsMl and supervised model

The per-category comparison finds that supervised learning is strongest on fine-grained subcategories, while CsMl’s strongest categories tend to depend on contour information. The accompanying nearest-neighbor examples illustrate similar-sample selection from training images for validation queries.

A.5. Performance comparisons of CsMl and supervised model

  • Supervised learning is strongest on fine-grained subcategories, including several dog breeds, in the per-category accuracy comparison.Source: §A.5 · p. 11, Figure A.2 · p. 12
  • CsMl’s strongest categories tend to require contour information, with shopping basket and plate rack given as examples.The authors connect these results to CsMl capturing global contour information, while supervised learning focuses on discriminative details such as texture.Source: §A.5 · p. 11
  • The nearest-neighbor examples show top-k training-set neighbors selected for a validation-set image.Source: §A.5 · p. 11, Figure A.3 · p. 12
Loading 2012.02733v2…