Emerging Properties in Self-Supervised Vision Transformers

Mathilde Caron, Hugo Touvron, Ishan Misra, Hervé Jégou, Julien Mairal, Piotr Bojanowski, Armand JoulinICCV 2021

Abstract

In this paper, we question if self-supervised learning provides new properties to Vision Transformer (ViT) that stand out compared to convolutional networks (convnets). Beyond the fact that adapting self-supervised methods to this architecture works particularly well, we make the following observations: first, self-supervised ViT features contain explicit information about the semantic segmentation of an image, which does not emerge as clearly with supervised ViTs, nor with convnets. Second, these features are also excellent k-NN classifiers, reaching 78.3% top-1 on ImageNet with a small ViT. Our study also underlines the importance of momentum encoder, multi-crop training, and the use of small patches with ViTs. We implement our findings into a simple self-supervised method, called DINO, which we interpret as a form of self-distillation with no labels. We show the synergy between DINO and ViTs by achieving 80.1% top-1 on ImageNet in linear evaluation with ViT-Base.

Introduction

While Transformers have revolutionized Natural Language Processing (NLP) through self-supervised pretraining, their transition to Computer Vision has traditionally required massive amounts of labeled data to compete with Convolutional Neural Networks (Convnets). This research investigates whether self-supervised pretraining can unlock unique advantages for Vision Transformers (ViTs) that are absent in supervised training or standard Convnets.

The DINO Framework

The authors introduce DINO (Self-DIstillation with NO labels), a simplified self-supervised framework based on knowledge distillation.

The DINO framework: self-distillation with no labels.

The system utilizes two identical networks: a student ($g_{\theta_s}$) and a teacher ($g_{\theta_t}$). An input image $x$ is transformed into different "crops" or views. The teacher receives global views, while the student processes both global and local views. The student is trained to match the probability distribution of the teacher's output using a cross-entropy loss.

To prevent "collapse"—where the networks output a trivial constant—DINO employs centering (adding a bias to the teacher's output) and sharpening (using a low temperature in the softmax function). Crucially, the teacher is a "momentum encoder," meaning its weights are a running average of the student's weights, providing a stable target for distillation.

Emerging Properties: Automatic Segmentation

Perhaps the most striking finding is the emergence of explicit semantic information. In DINO-trained ViTs, self-attention maps in the final layer naturally highlight object boundaries. The model "discovers" objects and separates them from the background without any supervision.

Self-attention maps from the last layer of a DINO-trained ViT-S/8 highlight object boundaries.

This property does not emerge as clearly in supervised ViTs or in Convnets, suggesting that self-supervision unlocks latent spatial understanding within the Transformer architecture.

Key Results and Insights

  • k-NN Classification: DINO features are exceptionally well-clustered in the feature space. A simple k-NN classifier (requiring no training) achieves 78.3% top-1 accuracy on ImageNet, nearly matching the performance of trained linear classifiers.
  • The Importance of Small Patches: Performance improves significantly as the input patch size decreases (e.g., from 16x16 to 8x8). Smaller patches provide a finer grid for the model to learn local-to-global correspondences.
  • State-of-the-Art Performance: A ViT-Base trained with DINO achieves 80.1% top-1 accuracy in linear evaluation on ImageNet. It also demonstrates superior performance in image retrieval and video object segmentation, achieving 71.4% J&F mean on the DAVIS 2017 benchmark using frozen features.

Conclusion

DINO demonstrates a powerful synergy between self-supervision and the Vision Transformer architecture. By leveraging self-distillation without labels, ViTs develop "emerging properties" like automatic segmentation and high-quality feature clustering that surpass their supervised counterparts, moving computer vision closer to the self-supervised success seen in NLP.

Summary updated

BibTeX
@inproceedings{caron2021emerging,
  author = {Mathilde Caron and Hugo Touvron and Ishan Misra and Hervé Jégou and Julien Mairal and Piotr Bojanowski and Armand Joulin},
  title = {{Emerging Properties in Self-Supervised Vision Transformers}},
  booktitle = {IEEE/CVF International Conference on Computer Vision},
  year = {2021},
  url = {https://openreview.net/forum?id=5tbdhG1MmUM},
}
Figure