AtLoc: Attention Guided Camera Localization

Bing Wang, Changhao Chen, Chris Xiaoxuan Lu, Peijun Zhao, Niki Trigoni, Andrew Markham

Abstract

Deep learning has achieved impressive results in camera localization, but current single-image techniques typically suffer from a lack of robustness, leading to large outliers. To some extent, this has been tackled by sequential (multi-images) or geometry constraint approaches, which can learn to reject dynamic objects and illumination conditions to achieve better performance. In this work, we show that attention can be used to force the network to focus on more geometrically robust objects and features, achieving state-of-the-art performance in common benchmark, even if using only a single image as input. Extensive experimental evidence is provided through public indoor and outdoor datasets. Through visualization of the saliency maps, we demonstrate how the network learns to reject dynamic objects, yielding superior global camera pose regression performance.

Introduction

Camera localization—the task of determining a camera's precise 3D position and orientation—is critical for autonomous systems like drones, self-driving cars, and augmented reality. While deep learning models such as PoseNet have demonstrated the ability to estimate pose from a single image, they often struggle with robustness in real-world environments. Dynamic objects (e.g., moving cars), transient lighting conditions, and repetitive patterns can "distract" standard neural networks, leading to significant localization errors. Previous attempts to mitigate this have relied on multi-image sequences or complex geometric constraints, which increase computational overhead.

Methods

The proposed AtLoc framework introduces a streamlined architecture designed to enhance robustness through self-attention. It consists of three primary components:

  1. Visual Encoder: A ResNet34 backbone extracts high-level features from the input image.
  2. Attention Module: This module utilizes a non-local style self-attention mechanism to compute relationships between different image regions. By generating a saliency map, the network re-weights features to emphasize stable landmarks and suppress noise from dynamic objects.
  3. Pose Regressor: Multilayer Perceptrons (MLPs) process the attention-guided features to output the 3D position ($p$) and a quaternion ($q$) for rotation.
The AtLoc architecture, featuring a visual encoder, an attention module for feature re-weighting, and a pose regressor.

The model is trained with a specialized L1 loss that balances position and rotation errors. An extended version, AtLoc+, incorporates temporal constraints for further precision.

Key Insights: Attention as a Geometric Filter

A core finding of this research is that the attention mechanism acts as an automated filter for geometric stability. Visualization of saliency maps reveals that AtLoc learns to ignore non-informative regions like the road surface or moving vehicles, instead focusing on unique architectural features.

Saliency map visualization demonstrating the network's focus on stable architectural features rather than the road or dynamic objects.

This "geometric awareness" is learned purely from data, without the need for manually programmed geometric rules. Furthermore, the single-image AtLoc model often outperforms multi-image sequential models, suggesting that a high-quality, filtered representation of a single frame can be more effective than a sequence of noisy frames.

Experimental Results

AtLoc was evaluated on the 7 Scenes (indoor) and Oxford RobotCar (outdoor) datasets.

  • Indoor Performance: AtLoc achieved a 13% improvement in position accuracy and a 7% improvement in rotation accuracy over single-image baselines. It was particularly effective in challenging scenes like "Stairs," reducing position error from 0.35m to 0.26m.
  • Outdoor Performance: On the Oxford RobotCar "FULL" routes, AtLoc outperformed previous state-of-the-art models (like PoseNet+) by 63% to 76%.
  • Efficiency: The model is highly efficient, running at approximately 6.3ms per frame. This is significantly faster than sequential models like MapNet (9.4ms) or PoseLSTM (9.2ms).

Conclusion

AtLoc demonstrates that self-attention is a powerful tool for improving the robustness of camera localization. By focusing on stable geometric structures and ignoring environmental noise, it achieves state-of-the-art results with a single-image input. Future work will explore integrating this attention-guided approach into multi-frame systems to combine spatial filtering with temporal smoothing.

Summary updated

BibTeX
@inproceedings{wang2020atloc,
  author = {Bing Wang and Changhao Chen and Chris Xiaoxuan Lu and Peijun Zhao and Niki Trigoni and Andrew Markham},
  title = {{AtLoc: Attention Guided Camera Localization}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2020},
  doi = {10.1609/aaai.v34i06.6608},
}
Figure