Scene Coordinate Regression with Angle-Based Reprojection Loss for Camera Relocalization

Xiaotian Li, Juha Ylioinas, Jakob Verbeek, Juho Kannala

Abstract

Camera relocalization is a critical task for robotics and augmented reality, requiring the determination of a camera's 6-degree-of-freedom (6DoF) pose from a single image. Scene Coordinate Regression (SCR) has emerged as a powerful technique, using neural networks to predict 3D world coordinates for each pixel. However, training these models without explicit 3D ground truth is often hampered by the instability of standard reprojection losses. This paper introduces an angle-based reprojection loss that measures angular errors between rays rather than Euclidean distances on an image plane. This formulation provides superior numerical stability, eliminates the need for heuristic initializations, and allows for the integration of multi-view and photometric constraints. Experimental results on the 7-Scenes and Cambridge Landmarks datasets demonstrate significant performance gains, particularly in challenging environments where previous methods failed.

Introduction

Determining the exact position and orientation of a camera is fundamental to autonomous navigation and spatial computing. A state-of-the-art approach to this problem is Scene Coordinate Regression, where a Convolutional Neural Network (CNN) is trained to map 2D image pixels to 3D coordinates in a world coordinate system.

The Scene Coordinate Regression pipeline: a CNN predicts 3D coordinates, which are then used in a RANSAC-based optimization to find the 6DoF pose.

While effective, previous methods like DSAC++ faced challenges when ground-truth 3D models were unavailable. They relied on a standard reprojection loss—the distance between a predicted 3D point's projection and its actual pixel location. This loss is mathematically unstable when predicted points are near or behind the camera center, often leading to "exploding gradients." To mitigate this, researchers previously had to initialize networks with arbitrary depth values, which limited the model's ability to learn the true scene geometry accurately.

Methodology: Angle-Based Reprojection

The core contribution of this work is the Angle-Based Reprojection Loss ($L_{ang}$), designed as a robust alternative to Euclidean reprojection error.

Geometric Formulation

Instead of measuring distance on a flat 2D image plane, $L_{ang}$ measures the angle $\theta$ between two rays originating from the camera center: one pointing toward the predicted 3D scene coordinate and one pointing toward the ground-truth pixel location.

Geometric comparison of reprojection errors. The proposed angular loss (top right) and multi-view constraints (bottom) provide a more stable optimization landscape than standard Euclidean reprojection.

This approach is geometrically equivalent to projecting points onto a unit sphere. By avoiding the $1/z$ (inverse depth) term found in standard reprojection, the loss remains stable even when predictions are near the focal plane ($z \approx 0$). Furthermore, points predicted behind the camera are correctly penalized with high angular errors (up to 180 degrees), preventing the "behind the camera" paradox where standard loss might incorrectly appear low.

Multi-View and Photometric Constraints

The stability of the angular loss enables the inclusion of additional self-supervised constraints that further refine the network's understanding of the scene:

  • Multi-View Loss: Ensures that a 3D point predicted from one viewpoint projects consistently into neighboring images.
  • Photometric Loss: Minimizes the intensity difference between a source image and a version warped from a neighbor using the predicted geometry.

Experimental Evaluation

The method was evaluated on two primary benchmarks: 7-Scenes (indoor) and Cambridge Landmarks (outdoor).

Key Results

The proposed formulation significantly outperforms the previous state-of-the-art (DSAC++) in scenarios where no 3D model is provided during training:

  • Indoor Robustness: On the 7-Scenes dataset, the percentage of images localized within 5cm and 5° improved from 60.4% to 69.2%. In the challenging Heads scene, accuracy soared from 18.4% to 80.5%, demonstrating the robustness of the angular formulation.
  • Outdoor Scaling: On Cambridge Landmarks, the method achieved superior median pose accuracy in the majority of scenes compared to the baseline.
  • Initialization-Free Training: Unlike previous methods, the CNN can be trained from scratch. The authors found that the network "discovers" the 3D geometry more effectively when not forced to start from a biased, constant-depth initialization.

Conclusion

By rethinking reprojection loss through an angular lens, this work addresses a fundamental instability in scene coordinate regression. The resulting framework is more robust, easier to train, and achieves state-of-the-art performance in RGB-only camera relocalization. While a small performance gap remains compared to methods using full 3D models, the stability of the angular loss opens new avenues for leveraging dense multi-view and photometric information in future research.

Summary updated

BibTeX
@inproceedings{li2018scene,
  author = {Xiaotian Li and Juha Ylioinas and Jakob Verbeek and Juho Kannala},
  title = {{Scene Coordinate Regression with Angle-Based Reprojection Loss for Camera Relocalization}},
  booktitle = {Workshops @ ECCV},
  year = {2018},
  doi = {10.1007/978-3-030-11015-4\_19},
}
Figure