Deep ViT Features as Dense Visual Descriptors

Shir Amir, Yossi Gandelsman, Shai Bagon, Tali Dekel

TL;DR

Self-supervised Vision Transformer (DINO-ViT) features are surprisingly powerful dense descriptors that encode fine-grained semantic information, such as object parts, across different categories. By applying simple, zero-shot techniques like clustering and binning to these features, the authors achieve state-of-the-art results in tasks like part co-segmentation and semantic correspondence without any additional training or data.

What Problem Does This Paper Address?

For years, "deep features" extracted from Convolutional Neural Networks (CNNs) have been the gold standard for visual descriptors. However, CNNs have inherent drawbacks: they often trade spatial resolution for semantic depth in deeper layers, exhibit a strong bias toward texture over shape, and have restricted receptive fields.

While Vision Transformers (ViTs) have emerged as a potent alternative, most research treats them as "black boxes," focusing only on the final output or the global [CLS] token. This paper investigates whether the internal activations of a ViT—specifically one trained via self-supervision (DINO)—can serve as high-resolution, semantically rich descriptors for dense vision tasks like identifying corresponding parts across different images.

Methods

The authors dive into the internal "facets" of the ViT's self-attention layers: queries, keys, values, and tokens. Through empirical analysis, they discover that keys provide the cleanest semantic signal with the least sensitivity to background clutter.

Overview of the framework using Deep ViT features for clustering and correspondences.

Their approach is intentionally lightweight and zero-shot, requiring no fine-tuning:

  • Co-segmentation & Part Co-segmentation: They treat descriptors from a set of images as a "bag-of-descriptors" and apply k-means clustering. To separate foreground from background, they use a voting scheme based on the ViT's own saliency (attention) maps.
  • Semantic Correspondences: To match points between images, they use Log-Binning to incorporate spatial context and the "Best Buddies Pairs" algorithm to find mutual nearest neighbors.
  • Resolution Increase: To overcome the fixed patch size of ViTs, they extract overlapping patches at test time, interpolating positional encodings to produce denser feature maps without retraining.

Datasets

The study evaluates these methods across several standard and challenging benchmarks:

  • Part Co-segmentation: Evaluated on AFHQ (Animal Faces), PASCAL-Parts, and CUB (Caltech-UCSD Birds).
  • Intra-class Co-segmentation: Tested on MSRC7, Internet300, and PASCAL-VOC.
  • Inter-class Co-segmentation: The authors introduced PASCAL-CO, a new dataset consisting of 40 sets of images from semantically related but different classes (e.g., cars, buses, and trains).
  • Semantic Correspondences: Evaluated on the Spair71k dataset.

Key Insights and Ideas

  • Semantics vs. Class: A striking finding is that self-supervised (DINO) ViT features are organized by object parts across different categories. For example, the "ear" features of a cat are closer to the "ear" features of a dog than they are to other parts of the cat. In contrast, supervised ViT features tend to group everything by class first.
t-SNE visualization showing DINO-ViT features grouping by parts across classes, while supervised ViT groups by class.
  • The Layer Hierarchy: ViTs exhibit a unique hierarchy. Shallow layers are dominated by positional bias (where a patch is in the image), while deep layers are dominated by semantic information (what the patch represents). Intermediate layers offer a "sweet spot" for tasks like point correspondence.
  • Spatial Consistency: Unlike CNNs, which downsample images, ViTs maintain the same spatial resolution throughout all layers, providing much better localization for fine-grained parts.

Key Results

The zero-shot ViT approach consistently outperforms previous unsupervised methods and rivals complex supervised models:

  • Part Co-segmentation: On the CUB dataset, the method achieved a mean error of 14.7–19.6 in landmark regression, significantly outperforming unsupervised CNN-based methods like DFF (21.6–22.4).
  • Inter-class Success: The method excels in "extreme" settings, such as segmenting common parts between a bicycle and a unicycle, or a cat and a tiger, where training data is typically scarce.
Qualitative results of part co-segmentation on challenging image pairs like Pikachu, Olaf, and different animal species.
  • Co-segmentation: On the new PASCAL-CO dataset, the ViT method achieved a Jaccard index ($J_m$) of 79.5, surpassing supervised models like SSNM (74.2) and DOCS (34.9) which struggle to generalize across classes.

Limitations and Future Work

While the zero-shot results are impressive, the authors note that there is still a performance gap compared to the very best task-specific supervised models in certain scenarios. The current method relies on k-means, and while effective, more sophisticated clustering or graph-based methods could potentially improve results.

The authors suggest that these findings open the door for using DINO-ViT features as a "plug-and-play" backbone for a wide variety of downstream vision tasks, potentially reducing the need for massive labeled datasets in specialized domains.

Summary updated

Abstract

We study the use of deep features extracted from a pretrained Vision Transformer (ViT) as dense visual descriptors. We observe and empirically demonstrate that such features, when extractedfrom a self-supervised ViT model (DINO-ViT), exhibit several striking properties, including: (i) the features encode powerful, well-localized semantic information, at high spatial granularity, such as object parts; (ii) the encoded semantic information is shared across related, yet different object categories, and (iii) positional bias changes gradually throughout the layers. These properties allow us to design simple methods for a variety of applications, including co-segmentation, part co-segmentation and semantic correspondences. To distill the power of ViT features from convoluted design choices, we restrict ourselves to lightweight zero-shot methodologies (e.g., binning and clustering) applied directly to the features. Since our methods require no additional training nor data, they are readily applicable across a variety of domains. We show by extensive qualitative and quantitative evaluation that our simple methodologies achieve competitive results with recent state-of-the-art supervised methods, and outperform previous unsupervised methods by a large margin. Code is available in dino-vit-features.github.io.
BibTeX
@inproceedings{amir2022deep,
  author = {Shir Amir and Yossi Gandelsman and Shai Bagon and Tali Dekel},
  title = {{Deep ViT Features as Dense Visual Descriptors}},
  booktitle = {Workshops @ ECCV},
  year = {2022},
  doi = {10.1007/978-3-031-25069-9\_3},
}
Figure