Modelling Uncertainty in Deep Learning for Camera Relocalization

Alex Kendall, Roberto CipollaarXiv 2015

TL;DR

This paper introduces a real-time, Bayesian deep learning framework for monocular 6-DOF camera relocalization by extending PoseNet with test-time dropout. This probabilistic approach not only improves localization accuracy by up to 10% but also provides a reliable measure of model uncertainty that correlates with actual geometric error and can detect whether a scene is recognized or entirely novel.

What Problem Does This Paper Address?

Camera relocalization—determining a camera's 6-degree-of-freedom (6-DOF) position and orientation from an image—is a foundational challenge for autonomous driving, robotics, and augmented reality. Traditional visual Simultaneous Localization and Mapping (SLAM) systems rely on matching local point features (like SIFT or ORB). However, these systems frequently fail during rapid motion, severe lighting changes, or when encountering large viewpoint variations.

While deep learning approaches like PoseNet can regress 6-DOF pose directly from a single RGB image without needing keyframes or complex graph optimization, they operate as deterministic "black boxes." They output point estimates without any indication of confidence. In safety-critical applications, knowing how certain a system is about its location is just as important as the location estimate itself. This paper tackles the challenge of efficiently modeling and leveraging this localization uncertainty.

Methods

The authors build upon PoseNet's modified 23-layer GoogLeNet architecture, which regresses a 7-dimensional pose vector (3D position and a 4D quaternion for orientation). To introduce a probabilistic framework without exponentially increasing computational cost, they leverage Monte Carlo (MC) dropout as an approximation for Bayesian inference over the network's weights.

Instead of using dropout solely as a training regularizer, they keep dropout active at test time. By feeding an image through the network multiple times with randomly deactivated connections, they generate a distribution of stochastic pose samples from the model's posterior distribution.

The final pose estimate is computed as the mean of these samples. To quantify uncertainty, the authors fit a unimodal Gaussian to the samples and take the trace of the covariance matrix as a scalar uncertainty metric. To make these uncertainty values comparable across different environments, they normalize them into a percentile score (Z-score) using a Gamma distribution model.

Datasets

The framework was evaluated on two widely accepted relocalization benchmarks:

  • Cambridge Landmarks: A large-scale outdoor dataset representing urban environments spanning up to 50,000 $m^2$, characterized by significant appearance and viewpoint variations.
  • 7 Scenes: A challenging indoor dataset featuring small, highly ambiguous spaces with repetitive structures (e.g., identical windows or furniture arrangements).

Key Insights and Ideas

  • Dropout as Free Bayesian Inference: By using MC dropout at test time, the network gains the ability to output uncertainty estimates without requiring any additional parameters or memory overhead.
  • Depth Resolves Visual Ambiguity: By comparing shallower auxiliary regressors to the final layer, the authors showed that early layers produce multimodal pose distributions when facing ambiguous landmarks (like repeated windows). The deeper layers successfully resolve this ambiguity into a sharp, unimodal distribution.
Stochastic pose samples showing multimodal distributions in shallower layers (green) vs. unimodal distributions in final layers (blue).
  • Uncertainty Predicts Real Error: The model's calculated uncertainty exhibits a strong linear correlation with the actual metric relocalization error. This means the system can reliably predict how far off its guess might be.
  • An "Accidental" Landmark Detector: Even though the network was never explicitly trained to classify scenes, its uncertainty metric naturally acts as an anomaly detector. When presented with an image from an unknown scene, the model outputs a massive uncertainty value, allowing it to correctly flag that it is lost.

Key Results

  • Accuracy Boost: Averaging the Monte Carlo samples yields a significant performance improvement over deterministic baselines, outperforming standard PoseNet by up to 10% in relocalization accuracy.
  • Performance Metrics: The system achieves an accuracy of approximately 2 meters and 6° outdoors (Cambridge Landmarks) and 0.5 meters and 10° indoors (7 Scenes).
  • Sample Efficiency: Accuracy gains converge rapidly after about 40 MC samples, meaning the system doesn't need infinite iterations to find an optimal estimate.
Localization accuracy vs. the number of Monte Carlo samples, showing convergence around 40 samples.
  • Real-Time Speed: Because the first 21 convolutional layers are deterministic, only the final fully connected layers need to be sampled repeatedly. On an NVIDIA Titan X GPU, computing a pose with 40 MC samples takes just 5.4ms, easily satisfying real-time constraints.

Limitations and Future Work

A notable limitation stems from the use of transfer learning. The authors fine-tuned their model from weights pretrained on the Places dataset, which was trained without dropout. Adding dropout after every single convolutional layer disrupted these fragile, co-adapted features, degrading localization performance by roughly 10%. Consequently, they had to restrict dropout to the randomly initialized layers at the end of the network.

Future work includes exploring methods to optimize the dropout probability hyperparameter directly and improving indoor scene detection, which currently sits at a modest 52% accuracy due to the extreme visual ambiguities present in indoor environments.

Summary updated

BibTeX
@misc{kendall2015modelling,
  author = {Alex Kendall and Roberto Cipolla},
  title = {{Modelling Uncertainty in Deep Learning for Camera Relocalization}},
  year = {2015},
  eprint = {1509.05909},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1509.05909},
}
Figure