Learning Camera Localization via Dense Scene Matching

Shitao Tang, Chengzhou Tang, Rui Huang, Siyu Zhu, Ping Tan

Abstract

Dense Scene Matching (DSM) is a novel scene-agnostic framework for 6-DoF camera localization. Unlike traditional scene-specific models that require retraining for every new environment, DSM treats localization as a matching problem. By employing a cost-volume approach to establish dense 2D-3D correspondences and a top-K sorting strategy, DSM achieves accuracy comparable to scene-specific models while significantly outperforming previous general-purpose methods in speed and memory efficiency.

Introduction

Camera localization—estimating the 6-DoF pose of a camera from a single image—is critical for robotics and augmented reality. Traditional methods rely on sparse feature matching, which often fails in textureless environments. While coordinate map regression using CNNs offers a solution, most existing models are scene-specific, essentially memorizing a single environment and requiring costly retraining for new scenes. Previous scene-agnostic attempts, such as SANet, have struggled with high computational costs and the irregular nature of 3D scene data.

Methodology

The DSM framework shifts the paradigm from coordinate regression to feature matching. The pipeline consists of several key stages:

  1. Feature Extraction: A Feature Pyramid Network (FPN) extracts multi-scale features from the query image and retrieved scene images.
  2. Cost Volume Construction: For each query pixel, the model computes cosine similarity between its features and those of potential 3D points in the scene.
  3. Top-K Sorting and Selection: To handle the variable number of potential matches, a "sorting and selection" layer identifies the top $K$ (specifically $K=16$) correlation scores and their corresponding 3D coordinates. This creates a structured "cost-coordinate volume" suitable for standard CNN processing.
  4. Coarse-to-Fine Regression: Coordinates are predicted and refined through a hierarchical pyramid.
  5. Temporal Fusion: For video sequences, the model incorporates temporal correlation by projecting 3D points from previous frames using known poses, smoothing the resulting trajectory.
Overview of the DSM framework showing the pipeline from query image to final pose estimation via RANSAC+PnP.

Experiments and Results

The model was trained on the ScanNet dataset and evaluated without retraining on the 7scenes and Cambridge Landmarks benchmarks to prove its generalization capabilities.

Key Performance Metrics

DSM demonstrates significant improvements over existing scene-agnostic methods. On the 7scenes benchmark, it improved coordinate accuracy by 16% compared to SANet. Furthermore, DSM is 33% faster (0.21s vs 0.33s per frame) and utilizes 46% less GPU memory (2.7GB vs 5GB) than its predecessors, making it highly efficient.

Accuracy vs. coordinate Euclidean distance error threshold, comparing DSM (Ours) against DSAC++, SANet, and other baselines.

Insights

  • Generalization: By learning how to match rather than what a scene looks like, DSM generalizes effectively to unseen environments.
  • Correlation and Accuracy: A strong mathematical link was observed between high correlation scores in the cost volume and lower 3D coordinate errors, validating the top-K selection strategy.
  • Temporal Stability: The integration of video context via temporal fusion effectively eliminates the "teleportation" errors (jumpy, incorrect pose estimates) common in single-frame localization methods.

Conclusion

DSM provides a robust, efficient, and scene-agnostic solution for camera localization. While it currently depends on an initial image retrieval step and faces challenges in extremely high-contrast outdoor environments compared to sparse methods, its ability to match the accuracy of scene-specific "specialists" without retraining marks a significant advancement. Future work will focus on optimizing backbones for mobile deployment and improving retrieval robustness.

Summary updated

BibTeX
@inproceedings{tang2021learning,
  author = {Shitao Tang and Chengzhou Tang and Rui Huang and Siyu Zhu and Ping Tan},
  title = {{Learning Camera Localization via Dense Scene Matching}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  doi = {10.1109/cvpr46437.2021.00187},
}
Figure