TL;DR
Modern self-supervised learning (SSL) methods are excellent at recognizing what an object is, but they often struggle to understand where its parts are located relative to one another. This paper introduces Spatial Prediction (SP), a simple, plug-and-play auxiliary task that forces models to predict the relative position and scale of two random image patches. Integrating SP into popular SSL frameworks like MAE, MoCo v3, and DINO consistently improves their spatial awareness, downstream performance, and out-of-distribution robustness.
What Problem Does This Paper Address?
Current self-supervised learning paradigms generally fall into two camps: invariance-based methods (like contrastive learning or self-distillation) and reconstruction-based methods (like Masked Autoencoders).
While highly effective, both approaches have a blind spot when it comes to geometry:
- Invariance methods treat spatial transformations (like cropping and scaling) as nuisances to be ignored, training the network to output the same representation regardless of how a patch is altered.
- Reconstruction methods operate on localized patches but lack a global coordinate system, meaning they fail to learn holistic, part-to-part geometric relationships.
As a result, these models often lack spatial grounding and over-rely on local textures rather than global object shapes and layouts. The authors tackle this by explicitly introducing spatial reasoning into the self-supervised pre-training phase.
Methods
The authors propose Spatial Prediction (SP), a spatially aware pretext regression task designed as an architecture-agnostic plug-in.
The workflow consists of three main components:
- Curated View Sampling: To prevent the model from exploiting trivial shortcuts (like matching edge lines or color gradients), the authors use a rejection sampling strategy. It ensures that pairs of sampled patches have a non-trivial spatial displacement, sufficient semantic content, and a balanced, uniform distribution of relative positions and scales.
- Projection-Free Cross-Attention: Given a reference patch ($I_r$) and a target patch ($I_t$), both are passed through a shared Vision Transformer (ViT) encoder. The
[CLS]token of the reference patch acts as a query to attend to the patch tokens of both views. Crucially, this cross-attention mechanism uses no additional learnable linear projections, forcing the model to rely entirely on raw token interactions. - Continuous Regression: The retrieved features are concatenated and fed into a lightweight two-layer MLP that predicts the continuous relative offset $(\Delta x, \Delta y)$ and the relative scale ratio. The entire module is trained using a standard $\ell_2$ loss alongside the base SSL objective.
Datasets
The models were pre-trained on CIFAR-100 and ImageNet-1K. To evaluate the representations, the authors utilized a diverse suite of downstream datasets:
- Robustness & OOD: ImageNet-C (corruptions), ImageNet-R (renditions), ImageNet-Sketch, and a custom ImageNet-Occlusion benchmark.
- Transfer Learning: Flowers-102, DTD (textures), and Food-101.
- Dense Prediction: PASCAL VOC (semantic segmentation) and NYU v2 (depth estimation).
Additionally, the authors introduced two new diagnostic benchmarks derived from the ImageNet-1K test set to specifically probe spatial reasoning:
- Spatial Prediction Task: Directly measures a model's accuracy in predicting the relative geometry of patch pairs.
- Jigsaw Understanding Task: Requires the model to correctly reorder a shuffled $3 \times 3$ grid of image patches and recognize the object within the reconstructed image.
Key Insights and Ideas
- Spatial Awareness Enhances Semantics: Explicitly forcing a network to learn geometry does not dilute its semantic understanding. Instead, it yields sharper, more object-centric attention maps. Rather than scattering attention across background contexts, SP-trained models focus tightly on the actual boundaries of objects.
- Mitigating Texture Bias: Standard SSL models are notoriously biased toward textures. By forcing the network to reason about how parts assemble into wholes, SP injects a structural inductive bias that shifts the model's focus toward global object layouts and shapes.
- Simplicity Wins: In ablation studies, adding learnable projections to the cross-attention block actually degraded performance. Preserving raw token interactions while enforcing structured cross-view attention proved to be the most effective strategy for learning spatial relationships.
Key Results
Integrating SP yielded substantial quantitative improvements across all evaluated base frameworks (MAE, MoCo v3, DINO):
- ImageNet-1K Classification: MAE + SP achieved a massive +8.0% boost in Top-1 accuracy (jumping from 44.6% to 52.6%), while MoCo v3 + SP saw a +5.0% improvement.
- Out-of-Distribution Robustness: On the ImageNet-Occlusion benchmark, MAE + SP improved accuracy from 36.7% to 41.6%, proving that geometric awareness helps models infer missing visual information.
- Diagnostic Spatial Tasks: On the challenging Jigsaw Understanding task, MoCo v3 + SP boosted permutation ordering accuracy from 69.87% to 90.24%, demonstrating a vastly superior grasp of global spatial configurations.
Limitations and Future Work
While SP demonstrates clear benefits, the authors note that it is currently restricted to 2D image space. It does not explicitly model 3D spatial geometry or temporal constraints (such as tracking object parts across video frames). The authors suggest that extending this geometric regression framework to 3D environments and video domains is a promising next step for developing more capable vision foundation models in robotics and embodied AI.
Summary updated