NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Location-Aware Self-Supervised Transformers

Mathilde Caron, Neil Houlsby, Cordelia Schmid

Abstract

Pixel-level labels are particularly expensive to acquire. Hence, pretraining is a critical step to improve models on a task like semantic segmentation. However, prominent algorithms for pretraining neural networks use image-level objectives, e.g. image classification, image-text alignment a la CLIP, or self-supervised contrastive learning. These objectives do not model spatial information, which might be sub-optimal when finetuning on downstream tasks with spatial reasoning. In this work, we pretrain network with a location-aware (LOCA) self-supervised method which fosters the emergence of strong dense features. Specifically, we use both a patch-level clustering scheme to mine dense pseudo-labels and a relative location prediction task to encourage learning about object parts and their spatial arrangements. Our experiments show that LOCA pretraining leads to representations that transfer competitively to challenging and diverse semantic segmentation datasets.

Introduction

Most state-of-the-art computer vision models are pretrained using "image-level" objectives. Whether it's classifying an image into a category or matching an image to a text description, these tasks focus on the what but often ignore the where. For tasks like semantic segmentation, where the goal is to label every single pixel, this global focus is a major drawback. Standard self-supervised methods often produce features that are "localization-invariant," meaning the model might recognize a wheel but doesn't necessarily learn where that wheel sits in relation to the rest of a car. To excel at dense prediction, models need a pretext task that explicitly encourages spatial reasoning and an understanding of object parts.

Methodology: The LOCA Framework

LOCA (Location-Aware) introduces a dual-task approach for self-supervised pretraining designed to force Vision Transformers (ViTs) to understand spatial relationships.

Overview of the LOCA framework showing the dual prediction of patch-level cluster IDs and relative positions.

Patch-level Clustering

Instead of assigning one label to a whole image, LOCA clusters individual patches. It uses a "query-reference" setup: the model looks at a "reference" view of an image to generate pseudo-labels (cluster IDs) and then tries to predict those same IDs for patches in a different "query" view of the same image.

Relative Location Prediction

This is the core innovation. The model is given a small "query" patch and must predict its coordinates relative to a larger "reference" view.

  • The "Look" Mechanism: To find itself, the query patch "looks" at the reference view through a shallow cross-attention layer.
  • Strategic Masking: To prevent the model from "cheating" by just matching low-level textures or edges, the authors mask a significant portion (up to 80%) of the reference patches. This forces the model to learn the global arrangement of object parts (e.g., "if I see an ear here, the snout must be over there") rather than just performing simple template matching.

Experimental Setup and Results

The models were pretrained on ImageNet-1k (1.3M images) and ImageNet-21k (13M images) without using any human-provided labels. The representations were then evaluated on 11 diverse semantic segmentation benchmarks, including consumer datasets (ADE20k, Pascal VOC), driving datasets (Cityscapes, BDD), and specialized domains (SUN-RGBD, SUIM).

Key Results

  • Superior Transfer: LOCA outperforms the previous best self-supervised method (MAE) by +4.3 points in average relative improvement across 11 datasets.
  • Label Efficiency: In "few-shot" scenarios (using only 1/32 of the training data), LOCA maintains a significant lead over competitors like DINO and iBOT, proving that its features are more robust when labels are scarce.
  • State-of-the-Art Performance: When scaled to ViT-Large on ImageNet-21k, LOCA achieves 52.3 mIoU on ADE20k, outperforming supervised pretraining methods.
  • Depth Estimation: LOCA features transfer better to monocular depth estimation than backbones trained with full image-level supervision, despite using 10x fewer parameters in the decoder.

Discussion and Insights

The Role of Masking

Visualizations and empirical data show that masking is essential. Without masking the reference view, the position prediction task becomes too easy, and the model simply matches pixels.

Impact of masking ratio on pretraining objective precision and downstream ADE20k performance.

As shown in the figure above, while the pretraining objective's precision decreases with higher masking ratios, the downstream performance on ADE20k peaks at a high masking ratio (around 0.8). This suggests that a harder pretext task leads to more generalizable spatial features.

Emergent Properties and Scalability

LOCA naturally learns to identify object parts, such as locating a dog's snout based on seeing its ears. Furthermore, unlike some self-supervised methods that plateau, LOCA benefits significantly from larger models (ViT-Large/Huge) and larger datasets (ImageNet-21k).

Conclusion and Future Work

While LOCA demonstrates strong performance, it currently relies on curated datasets like ImageNet. Future work will explore testing LOCA on massive, uncurated "in-the-wild" data. Additionally, the current relative position task is formulated as a classification problem; future iterations could explore more complex geometric reasoning or 3D-aware pretext tasks. Combining these dense, spatially-aware objectives with massive-scale global objectives (like image-text alignment) may provide the ultimate pretraining strategy.

Summary updated

BibTeX
@inproceedings{caron2024location,
  author = {Mathilde Caron and Neil Houlsby and Cordelia Schmid},
  title = {{Location-Aware Self-Supervised Transformers}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2024},
  doi = {10.1109/wacv57701.2024.00019},
}
Figure