LoCo: Learning 3D Location-Consistent Image Features with a Memory-Efficient Ranking Loss

Dominik Kloepfer, Joao F. Henriques, Dylan Campbell

Modern "foundation" models like DINOv2 are excellent at understanding what is in an image (semantics), but they often struggle with where things are in 3D space. If you photograph a chair from the front and then from the side, a standard feature extractor might produce very different digital "fingerprints" for the exact same physical spot. This lack of 3D consistency makes it difficult for AI to perform tasks like long-term tracking, 3D reconstruction, or "scene-stable" segmentation, where an object's identity must remain constant regardless of the camera angle.

Previous attempts to solve this relied on a ranking loss called smooth Average Precision (sAP) to force features from the same 3D location to be similar. However, sAP is notoriously memory-intensive; it requires computing a massive similarity matrix between every possible pair of image patches in a training batch. This bottleneck has historically limited models to tiny architectures and low-resolution features.

LoCo encourages features that project to the same 3D location to be similar, while separating those that do not.

The LoCo Approach

To overcome this bottleneck, the authors present LoCo (Location-Consistent) features, powered by a mathematical reformulation of the sAP loss that reduces memory requirements by three orders of magnitude.

The methodology relies on four key pillars:

  1. Pair-based Reformulation: The loss function is rewritten to focus on pairs of patches rather than individual samples, deriving a more general form of the objective that is easier to approximate.
  2. Gradient Pruning: The authors realized that most patch pairs in a large batch are "saturated"—they are either already very similar or obviously different. These pairs have near-zero gradients and do not contribute to learning. By setting a threshold ($\Delta$) and ignoring these pairs in the computation graph, memory usage is drastically slashed.
  3. Batch Correction: Specific correction terms are introduced to ensure that calculating the loss on a pruned "batch" of data still accurately reflects the loss of the entire dataset, preventing training bias.
  4. Hybrid Architecture: Instead of training a massive model from scratch, LoCo uses a frozen DINO backbone and trains a lightweight convolutional residual network on top. This efficiently "modulates" the semantic features of DINO to make them geometrically consistent.

Key Insights

  • Efficiency is the Enabler: By reducing the similarity matrix memory from ~51GB to just 500KB, the authors enabled a $2000\times$ increase in effective batch size. This allows the use of much larger models (like ViT-base) that were previously off-limits for this task.
  • The Semantic-Geometric Trade-off: The paper notes that while newer models like DINOv2 are "smarter" semantically, they are actually less 3D-consistent than the original DINO. LoCo effectively bridges this gap.
  • Two-Sided Filtering: Unlike standard "hard negative mining" which only looks for difficult failures, LoCo's approximation is two-sided. It ignores both "too easy" and "too hard/confidently wrong" pairs to focus compute strictly on the most informative samples.

Key Results

The model was trained on 59 indoor environments from the Matterport3D dataset and evaluated across several rigorous benchmarks:

  • Pixel Correspondence: LoCo achieved a 61.8% recall on the ScanNet benchmark for small viewpoint changes, compared to 45.0% for DINO and only 23.5% for the previous state-of-the-art, LoCUS.
  • Scene-Stable Segmentation: On the Matterport3D dataset, LoCo reached a Jaccard index of 66.5, significantly outperforming specialized segmentation models like MaskDINO (54.8). This demonstrates that better underlying features can beat more complex architectural "heads."
  • Visual Place Recognition (VPR): LoCo set new state-of-the-art marks for Recall@1 on both Matterport3D (46.8) and ScanNet (81.2), proving these features are robust enough for global robot localization.
Quantitative results on Matterport3D and ScanNet demonstrate LoCo's superior performance in scene-stable segmentation tasks.

Limitations and Future Work

While highly effective, LoCo's training still relies on having accurate depth maps and camera poses, which are common in robotics datasets but absent in "in-the-wild" internet videos. Future work may leverage off-the-shelf depth estimators to remove this dependency. Additionally, due to resource constraints, the authors only trained a small residual network on top of frozen features; applying this efficient loss to train a full foundation model from scratch remains a promising next step.

Summary updated

BibTeX
@inproceedings{kloepfer2024loco,
  author = {Dominik Kloepfer and Joao F. Henriques and Dylan Campbell},
  title = {{LoCo: Learning 3D Location-Consistent Image Features with a Memory-Efficient Ranking Loss}},
  booktitle = {Advances in Neural Information Processing Systems},
  year = {2024},
  url = {https://openreview.net/forum?id=L6ICzOxAfi},
}
Figure