SERE: Exploring Feature Self-relation for Self-supervised Transformer

Zhong-Yu Li, Shanghua Gao, Ming-Ming Cheng

TL;DR

SERE (SElf-RElation) is a novel self-supervised learning framework designed specifically to exploit the architectural strengths of Vision Transformers (ViTs). By enforcing consistency in spatial and channel self-relations across different views of an image, SERE produces more robust representations that significantly outperform standard embedding-based methods in downstream tasks like semantic segmentation and object detection.

What Problem Does This Paper Address?

Self-supervised learning (SSL) has revolutionized how we train vision models without expensive manual labels. However, most popular SSL methods (like DINO or MoCo) were originally designed for Convolutional Neural Networks (CNNs). These methods typically focus on "instance discrimination"—ensuring that two different crops of the same image result in similar global feature embeddings.

The authors argue that this approach ignores the unique "DNA" of Vision Transformers: their inherent ability to model complex relationships between different parts of an image (via self-attention) and between different feature channels. Standard SSL treats ViTs like CNNs, missing out on the opportunity to explicitly train the network's relational modeling capabilities.

Methods

The core idea of SERE is to move beyond comparing simple feature vectors. Instead, it compares the internal structure of the features.

Fig. 1. The illustration of self-supervised learning using feature embed- dings and our proposed feature self-relation. (a) Typical self-supervised learning methods process the feature embeddings of the image views. (b) We propose to model the feature self-relation that measures the relation inside an image view from different dimensions. (c) Two specific forms of self-relation, i.e., the spatial and channel self-relations. For spatial self-relation, we select 6 patches indicated by differently colored boxes (top right) and visualize their self-relation (top left). For channel self-relation, we show visualized feature maps of 4 channels (bottom right) and the corresponding self-relation (bottom left).

As shown in the pipeline below, the authors introduce two new self-relation representations:

  1. Spatial Self-relation ($L_p$): This measures how every local patch in an image relates to every other patch. To handle the fact that two random crops might not perfectly align, the authors use a region-aligned sampling operation (Fig. 3 in the paper) to extract features from the overlapping area of two views before calculating their similarity matrices.
  2. Channel Self-relation ($L_c$): This models the connections between different feature channels. Since different channels often highlight unique semantic patterns (e.g., one might focus on texture, another on shape), enforcing consistency here helps the model learn a more diverse and meaningful set of filters.
Fig. 2. Our method models self-relation from spatial and channel dimensions. Given an image x, two views are generated by two random data augmentations. Here the image patches represent the feature embeddings extracted by the encoder. The feature embeddings are transformed by representation transformation P to generate spatial or channel self-relations. Lp and Lc, i.e., the loss functions defined in Equ. (3) and Equ. (5), enforce consistency between self-relations of different views. For spatial self-relation, only the features in the overlapping region are considered. O means the operation of extracting features from the overlapping region between two views in Equ. (2), where the red dotted box indicates the overlapping region.

These relational losses are added to existing SSL frameworks (like DINO or iBOT), making SERE a "plug-and-play" enhancement rather than a total replacement.

Datasets

The models were pre-trained primarily on ImageNet-1K (1.28 million images). For computational efficiency during ablation studies, the authors used ImageNet-$S_{300}$.

Evaluation spanned a wide variety of downstream benchmarks:

  • Classification: ImageNet-1K (full and semi-supervised), CIFAR-10/100, iNaturalist19, Flowers, and Cars.
  • Semantic Segmentation: PASCAL VOC 2012, ADE20K, and ImageNet-S.
  • Object Detection & Instance Segmentation: COCO.

Key Insights and Ideas

  • Relational Invariance: While standard SSL seeks invariance in embeddings, SERE seeks invariance in relations. The authors show that SERE-trained models have much smaller differences in their spatial/channel relation maps across different augmentations compared to baselines.
  • Orthogonality: Self-relation is complementary to traditional embedding-based SSL. Combining them leads to better performance than using either alone.
  • Superior Attention Maps: Qualitatively, SERE produces much cleaner and more object-focused attention maps than Masked Image Modeling (MIM) methods like MAE. While MAE often produces noisy maps that highlight the whole image, SERE focuses sharply on the semantic foreground.
  • Dense Prediction Power: Because spatial self-relation explicitly models patch-to-patch interactions, it is particularly effective for tasks requiring fine-grained spatial understanding, such as semantic segmentation.

Key Results

SERE consistently boosts the performance of state-of-the-art baselines:

  • Efficiency: A ViT-S/16 trained with SERE for only 100 epochs achieved 81.5% Top-1 accuracy on ImageNet-1K, outperforming a standard iBOT model trained for 300 epochs (81.1%).
  • Segmentation Gains: On the PASCAL VOC dataset, adding SERE to DINO improved the mean Intersection over Union (mIoU) by 2.6%.
  • Semi-Supervised Learning: With only 1% of ImageNet labels available for fine-tuning, SERE improved Top-1 accuracy by 3.8% over the DINO baseline.
  • Detection: On COCO, SERE improved the bounding box AP by 0.6% and mask AP by 0.5% over DINO.

Limitations and Future Work

  • Architecture Specificity: While the authors tested SERE on ResNet-50 and saw modest improvements, the gains were significantly smaller than those seen on ViTs. This confirms that SERE is highly optimized for the relational nature of Transformers and may not be the best choice for traditional CNNs.
  • Computational Cost: Calculating full $N \times N$ relation matrices (where $N$ is the number of patches) can be memory-intensive. While the authors use sampling to mitigate this, scaling to extremely high-resolution images might require more efficient approximation methods.
  • Future Directions: The authors suggest exploring how self-relation could be applied to other modalities, such as video or point clouds, where relational modeling is equally critical.

Summary updated

Abstract

Learning representations with self-supervision for convolutional networks (CNN) has been validated to be effective for vision tasks. As an alternative to CNN, vision transformers (ViT) have strong representation ability with spatial self-attention and channel-level feedforward networks. Recent works reveal that self-supervised learning helps unleash the great potential of ViT. Still, most works follow self-supervised strategies designed for CNN, e.g., instance-level discrimination of samples, but they ignore the properties of ViT. We observe that relational modeling on spatial and channel dimensions distinguishes ViT from other networks. To enforce this property, we explore the feature SElf-RElation (SERE) for training self-supervised ViT. Specifically, instead of conducting self-supervised learning solely on feature embeddings from multiple views, we utilize the feature self-relations, i.e., spatial/channel self-relations, for self-supervised learning. Self-relation based learning further enhances the relation modeling ability of ViT, resulting in stronger representations that stably improve performance on multiple downstream tasks. Our source code is publicly available at: https://github.com/MCG-NKU/SERE.
BibTeX
@article{li2023sere,
  author = {Zhong-Yu Li and Shanghua Gao and Ming-Ming Cheng},
  title = {{SERE: Exploring Feature Self-relation for Self-supervised Transformer}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2023},
  doi = {10.1109/tpami.2023.3309979},
}
Figure