Abstract
The overarching goals in image-based localization are scale, robustness, and speed. In recent years, approaches based on local features and sparse 3D point-cloud models have both dominated the benchmarks and seen successful real-world deployment. They enable applications ranging from robot navigation, autonomous driving, virtual and augmented reality to device geo-localization. Recently, end-to-end learned localization approaches have been proposed which show promising results on small-scale datasets. However, the positioning accuracy, scalability, latency, and compute and storage requirements of these approaches remain open challenges. We aim to deploy localization at a global scale where one thus relies on methods using local features and sparse 3D models. Our approach spans from offline model building to real-time client-side pose fusion. The system compresses the appearance and geometry of the scene for efficient model storage and lookup leading to scalability beyond what has been demonstrated previously. It allows for low-latency localization queries and efficient fusion to be run in real-time on mobile platforms by combining server-side localization with real-time visual–inertial-based camera pose tracking. In order to further improve efficiency, we leverage a combination of priors, nearest-neighbor search, geometric match culling, and a cascaded pose candidate refinement step. This combination outperforms previous approaches when working with large-scale models and allows deployment at unprecedented scale. We demonstrate the effectiveness of our approach on a proof-of-concept system localizing 2.5 million images against models from four cities in different regions of the world achieving query latencies in the 200 ms range.
1. Introduction
Visual localization, i.e., estimating the position and orientation of a camera in a given scene, is a fundamental problem in both robotics and computer vision. Visual localization allows intelligent systems such as self-driving cars (Häne et al., 2017) and drones (Lim et al., 2015) to determine their current pose in an environment and, thus, to navigate to their target place. Localization enables simultaneous localization and mapping (SLAM) systems (Mur-Artal and Tardós, 2017; Williams et al., 2007) to detect and handle loop-closure events. It is a key building block of intelligent augmentation systems such as augmented and mixed reality applications (Castle et al., 2007; Klein and Murray, 2007; Middelberg et al., 2014). Furthermore, visual localization is an important component of structure-from-motion (SfM) (Schönberger and Frahm, 2016) systems.
Traditionally, visual localization algorithms rely on 3D maps and local features (Jones and Soatto, 2011; Li et al., 2012, 2010; Lim et al., 2015; Liu et al., 2017; Sattler et al., 2017a; Svärm et al., 2017; Zeisl et al., 2015). They represent the scene as a 3D point cloud generated by SLAM or SfM, where each 3D point is associated with the local image descriptors from which it was observed. After extracting local features in an image taken by a camera, 2D–3D correspondences are established via matching the descriptors associated with the 2D query and 3D model points. These matches in turn are used to estimate the full six-degree-of-freedom (DOF) pose of the camera, i.e., its position and orientation. Such structure-based methods have been shown to provide accurate pose estimates (Walch et al., 2017) and scale up to a city level (Jones and Soatto, 2011; Li et al., 2012; Svärm et al., 2017; Zeisl et al., 2015). In addition, real-time localization on mobile devices with restricted computational capabilities (Lim et al., 2015; Lynen et al., 2015; Middelberg et al., 2014) is made possible through tightly integrating localization and SLAM algorithms. An approach with increased scalability was also proposed by Jones and Soatto (2011) where those parts of the map that share common elements of visual appearance are grouped into locations and, thus, allow leveraging the covisibility graph of the map for prioritization.
Feature-based methods consist of multiple stages, i.e., efficient descriptor matching, outlier filtering, robust camera pose estimation, and camera pose refinement. All of these stages directly affect both localization efficiency and accuracy. Implementing a high-quality localization system is, thus, a non-trivial task. Consequently, recent work has proposed to use convolutional neural networks (CNNs) to simplify the implementation by either learning the descriptor matching stage (Brachmann et al., 2017; Brachmann and Rother, 2018; Donoser and Schmalstieg, 2014) or the complete localization pipeline (Kendall and Cipolla, 2017; Kendall et al., 2015; Valada et al., 2018; Walch et al., 2017). However, these approaches have been shown to be either inaccurate (Sattler et al., 2017b; Walch et al., 2017) or to not scale to larger or more complex scenes (Brachmann et al., 2017; Sattler et al., 2018; Schönberger et al., 2018; Taira et al., 2018). In addition, they require a time-consuming training step every time a new scene needs to be considered or something changes in a scene. As such, classical feature-based methods are still highly relevant, albeit requiring careful design, algorithm and parameter choices.
This article presents a feature-based visual localization system that is able to run in real-time on mobile platforms by combining server-side localization with real-time visual–inertial-based camera pose tracking. Using map compression to reduce memory requirements, our approach is able to scale to very large scenes spanning entire cities across the globe.
In the conference paper version of this work (Lynen et al., 2015), we focused on running localization on the device using highly compressed models that were transferred from the server. One key contribution was a method for fusing the localization signal into the local state estimator such that it provided precise global tracking despite strong artifacts from model compression. While this client-based approach scales to environments of a few 10,000 m2, it does not allow for the scale of deployment we are targeting today that spans city- and country-sized areas. For city-scale localization, we thus transitioned to an approach similar to Middelberg et al. (2014) where server-side localization and client-side pose fusion are combined. We base the system on improved and more scalable versions of the localization and pose-fusion algorithms proposed in Lynen et al. (2015) to allow for lower latency and higher pose accuracy than previous methods.
Given the complexities involved in implementing such a system, this article aims at making possible design choices more transparent by discussing and evaluating multiple alternatives for each part of the pipeline.
In detail, this journal version makes the following contributions beyond our previous conference paper (Lynen et al., 2015).
We introduce and describe a system for visual localization suitable for large-scale server-side deployment.
We provide a detailed discussion of all crucial parts, explain our design choices, and point out alternative approaches.
We show how compression of the model requires adaptations of other parts of the localization system in order to achieve high localization performance.
We evaluate our approach extensively by measuring the effect of each component and choice on run-time efficiency, pose estimation accuracy, and memory consumption.
We evaluate our system at unprecedented scale both in terms of covered area and number of queries.
2. Related work
On the topic of visual localization, Piasco et al. (2018) provide an excellent and broad overview on the field. In the following, we thus focus only on the work that directly relates to our problem setup.
We review related work for all individual stages of our approach, i.e, model compression, feature-based localization, outlier filtering in visual localization, and combining global localization with local camera pose tracking. In addition, we review work on learning-based visual localization as well as work on place recognition, a problem closely related to the localization task.
2.1. 3D map compression for visual localization
Given a 3D map reconstructed from a set of database images, where each 3D point is associated with one or more local feature descriptors, there are two basic approaches to map compression: selecting a subset of points (Cao and Snavely, 2014; Li et al., 2010; Park et al., 2013), thus compressing the 3D structure of the scene; or compressing the descriptors of the 3D points (Irschara et al., 2009; Li et al., 2010; Liu et al., 2017; Sattler et al., 2015, 2017a).
Approaches of the first type select a minimal subset of 3D points such that all database images observe at least
In this article, we use both 3D structure and descriptor compression in a process we refer to as summarization: specifically, we sub-select 3D points, summarize the appearance and apply compression to the descriptors. Previous work focused on localizing individual images. This limited the amount of compression possible without negatively impacting localization accuracy. In contrast, our approach aims at localizing a moving camera and we show that this allows us to compress both appearance and geometry with little effect on the localization quality.
2.2. Feature-based localization
Feature-based localization approaches use local patch descriptors (Alahi et al., 2012; Lowe, 2004) to establish 2D–3D matches between 2D features extracted in a query image and 3D points in the map. These 2D–3D correspondences are then used to estimate the camera pose of the query image. This is typically done by applying a perspective-
2.3. Outlier filtering for large-scale localization
The localization approaches discussed previously assume that the local appearance of each 3D point is rather unique. However, this assumption is often violated at large scale as local descriptors become more ambiguous as the size of scenes grows (Li et al., 2012). Uniqueness is further reduced when descriptors are compressed, i.e., in the setting considered in this article. Scalable feature-based localization approaches thus typically relax the matching criteria, e.g., by relaxing matching thresholds (Camposeco et al., 2017; Li et al., 2012; Svärm et al., 2017; Zeisl et al., 2015) or using quantized descriptors (Liu et al., 2017; Sattler et al., 2015), and use outlier filtering techniques to detect and reject wrong correspondences.
There are two dominant approaches to outlier filtering. (1) Covisibility-based methods (Alcantarilla et al., 2011; Jones and Soatto, 2011; Li et al., 2012; Liu et al., 2017; Sattler et al., 2017a) use the fact that the 3D point clouds generated by SfM and SLAM also contain visibility information (Li et al., 2010) and thus allow a graph of locations to be formed. More precisely, such 3D maps encode which 3D points are observed together. This information is used to select a subset of matches that is more likely to be correct from a larger set of matches (Li et al., 2012; Liu et al., 2017; Sattler et al., 2017a). (2) In contrast, geometric outlier filtering methods determine for each match how consistent it is with the other matches (Camposeco et al., 2017; Larsson et al., 2016; Svärm et al., 2017; Svarm et al., 2014; Zeisl et al., 2015). Correspondences that are consistent with only a few other matches are then removed before camera pose estimation.
In this article, we quantize the 3D point descriptors to reduce the memory footprint of 3D maps, allowing our approach to scale to very large scenes. We employ a variant of the geometric constraints used by Zeisl et al. (2015) for filtering outliers that make up a large fraction of the matches in our setup.
2.4. Place recognition
Given a database of geo-tagged images, the place recognition problem asks to determine the place depicted in a query image (Arandjelović et al., 2016; Lynen et al., 2017; Sattler et al., 2016; Torii et al., 2015, 2013). It is usually modeled as an image retrieval problem (Sivic and Zisserman, 2003), where the geo-tag of the most similar database image is used to approximate (Zamir and Shah, 2010) or compute (Sattler et al., 2017b; Zhang and Kosecka, 2006) the geo-tag of the query image. The place recognition problem is relevant for loop-closure detection in SLAM (Cummins and Newman, 2011; Gálvez-López and Tardos, 2012; Lynen et al., 2017).
Place recognition techniques are also related to the visual localization problem as they can be used to determine which part of a scene might be visible in a query image (Cao and Snavely, 2013; Irschara et al., 2009; Jones and Soatto, 2011; Sattler et al., 2015), thus restricting the search space for feature matching. As such, place recognition techniques are used to reduce the amount of data that has to be kept in RAM, as the regions visible in the retrieved images might be loaded from disk on demand (Arth et al., 2009; Tran et al., 2019). Yet, loading 3D points from disk results in high query latency. Our approach thus does not use an intermediate image retrieval step. Instead, it relies on efficient model compression and direct search in the model.
2.5. Learning-based localization
Visual localization and place recognition approaches can benefit from machine learning by replacing hand-crafted descriptors and image representation with learned alternatives (Arandjelović et al., 2016; Balntas et al., 2016; Brown et al., 2011; Lepetit and Fua, 2006; Mishchuk et al., 2017; Radenović et al., 2016; Schönberger et al., 2017; Weyand et al., 2016). More advanced learning-based approaches directly replace (parts of) the localization pipeline. There are two dominant approaches in the literature: learning to predict scene coordinates (Brachmann et al., 2017; Brachmann and Rother, 2018; Cavallari et al., 2017; Shotton et al., 2013; Valentin et al., 2015); and learning to directly regress camera poses (Kendall and Cipolla, 2017; Kendall et al., 2015; Valada et al., 2018; Walch et al., 2017). The former type of methods learn the 2D–3D matching stage of localization systems by learning to predict a 3D point coordinate for each pixel in a query image. The resulting 2D–3D correspondences can then be used for traditional camera pose estimation by applying a PnP solver inside a RANSAC loop. The latter type of methods directly learn the full localization pipeline by learning to predict the 6-DOF camera pose using just an image as input.
Given powerful enough hardware, learning-based methods can be run at acceptable latency (on low-resolution images). At the same time, they represent the scene implicitly through weights stored in CNNs or random forests, resulting in representations of a few megabytes for a room-sized environment. Results show that learning-based methods can outperform classical feature-based pipelines (Brachmann and Rother, 2018; Valada et al., 2018), especially in weakly textured scenes (Walch et al., 2017). However, they also have been shown to struggle to adapt to larger and more complicated datasets (Brachmann and Rother, 2018; Sattler et al., 2018; Schönberger et al., 2018; Taira et al., 2018; Walch et al., 2017). This article focuses on proposing a pipeline for server-side localization in city-scale scenes. Thus, our approach follows classical feature-based pipelines.
2.6. Combining global localization and local camera pose tracking
Localizing a single image against a large map is often too computationally complex to be done in real-time, especially on autonomous systems with limited computational capabilities such as drones or mobile devices. However, streaming video to a server typically would also incur too high latencies.
Once an initial pose is estimated from localization, Lim et al. (2015) use the visibility information from the 3D map to predict which 3D points might be visible in the next frame. Coupled with tracking already visible points, this restriction in search space enables real-time processing and high-quality registration. In order to scale to larger scenes, Middelberg et al. (2014) and Ventura et al. (2014) decoupled localization and camera pose tracking. Localization was performed on an external server and returned the inlier 2D–3D matches if pose estimation was successful. These correspondences were then integrated, either on the server (Ventura et al., 2014) or on the device (Middelberg et al., 2014), into the bundle adjustment of a parallel tracking and mapping (PTAM)-like (Klein and Murray, 2007) real-time SLAM system. By fixing the positions of the 3D points in these matches, the resulting additional constraints effectively prevent drift during on-device camera pose tracking. In this article, we follow the approach from Middelberg et al. (2014) with two differences: (1) compression techniques allow for reduced model size and unlock scalability to unprecedented scale while efficient algorithms allow latencies in the 200 ms range; (2) we integrate the 2D–3D matches from localization into a filter-based visual–inertial odometry system (Mourikis et al., 2009a). Similar to recent work on filter-based integration of localization (DuToit et al., 2017; Kasyanov et al., 2017) this leads to significantly faster processing times and smoother pose tracking results compared with the approach used by Middelberg et al. (2014).
3. Building a localization system
Figure 1 illustrates our proposed localization approach. In the following, we briefly provide an overview of our system. We then describe each sub-component in more detail in subsequent sections.

Overview of the complete system described in this article, comprising offline stages to create and compactly store the model of the environment and a real-time online query stack. The online query part on the right is split between device and server with a mobile network connection link using about 20 kB per VGA resolution query image.
In an offline stage, a 3D point cloud is reconstructed from a set of database images using SfM. In order to scale to large areas, we split this 3D point cloud model into subparts which cover a few street blocks each. Each of these sub-maps is compressed by summarizing the scene structure and appearance to reduce storage, compute cost and latency for the localization queries.
The robot or mobilephone we want to geo-localize runs a real-time visual–inertial SLAM method to track the movement of the camera in a local coordinate frame. Local pose tracking provides the real-time signal for control or rendering and runs independent of the server using only on-device resources. For a subset of frames captured by the device camera, visual features are extracted and their descriptors are used to match against the descriptors of the previously built 3D point cloud. This matching step takes place on the server, where a relevant subset of the model parts are selected based on approximate location from GPS/WiFi signals. Once the models are loaded, efficient matching algorithms identify those 3D points in the model that denote the same objects as visible in the query image. The resulting 2D–3D correspondences are first filtered based on geometric constraints and subsequently used to robustly estimate the global camera pose via RANSAC (Fischler and Bolles, 1981). Given that localization has too high latency for real-time processing, we asynchronously feed the localization results into the local camera pose tracking, which continues to track the state between successful queries. The pose computed for the first frame provides the initial position and orientation of the mobile system with respect to the global model. This pose thus anchors the local reference frame of the SLAM system to the global coordinates of the model. For all subsequently localized frames, the inliers to the estimated pose are integrated into the state estimator of the SLAM system to provide additional constraints (in addition to the features tracked by the local SLAM). These additional constraints continuously improve the alignment of the local trajectory against the global model and correct for any drift in the local tracking (Bresson et al., 2013; Lynen et al., 2015; Middelberg et al., 2014; Mourikis et al., 2009b).
4 .Data and evaluation metrics used in this article
To facilitate reading the article and relating algorithmic description with results, we interleaved the sections with experimental evaluation. We thus first discuss the data and evaluation metrics that will be used throughout the following sections.
4.1. Model data acquisition
We evaluate the system on models built for the cities of Paris, Tokyo, Zurich, and San Francisco to highlight parameter impact across appearance variations and scale. 3D models for each city are created from Street View collects over the last 10+ years using rigs comprising 7 or 15 rolling-shutter cameras mounted on cars and backpacks. The camera pose and structure computation additionally leverages input from GPS, LiDAR, odometry, and inertial sensors (Klingner et al., 2013) to create a global model of the environment. The model is subsequently subdivided into pieces of approximately
4.2. Evaluation data acquisition and reference pose computation
For each of the cities (see Table 1), we recorded evaluation sequences using consumer phones mimicking typical user behavior for augmented reality or robot navigation. These sequences are recorded from the side-walk with the phone facing downwards in walking direction or across the street. The resulting viewpoints thus exhibit substantial viewpoint differences from the views contained in the database as these were captured by cars on the street.
The area/size of the models captured by Street View cars and the evaluation datasets used in this article captured on foot using a mobile phone.
We obtain ground-truth reference poses for the evaluation sequences by automatically establishing 2D–3D matches for each frame in the evaluation sequence against the 3D model. These candidates are subsequently filtered using spatial verification taking into account the relative pose between cameras provided by SLAM (Leutenegger et al., 2014). After filtering we associate the observations from the evaluation dataset with the model landmarks. Using these constraints between local SLAM trajectory and global 3D model, we run a full-batch visual–inertial bundle adjustment to align the evaluation trajectory with the model. After alignment, the poses of the evaluation trajectory typically exhibit sub-meter/sub-degree errors with respect to the model and are thus used as reference poses for evaluation (see Figure 2 for a qualitative example).

The trajectory (pink) of an evaluation sequence after alignment to the model (3D points depicted in black). Orange/cyan points denote database camera locations. (Map data © 2020 Google, Imagery © 2020 CNES, Airbus, Maxar Technologies).
Parameter studies were conducted using the model of Tokyo and by sampling 10% of the evaluation data (~170,000 queries) unless indicated otherwise.
4.3. Evaluation metric and approach
We use average precision as the main metric in this article rather than precision/recall at a given acceptance threshold. Average precision is computed from the full precision–recall curve by taking the average of precision values at given recall
We find average precision a more useful metric to compare performance given its independence of the chosen acceptance threshold (for instance inlier ratio of RANSAC) for localization responses. We consider a localization result to be correct if its position error is less than 3 m and 10° with respect to the reference pose. These thresholds were primarily driven by product requirements and do not carry further meaning.
4.4. Best performing and reference method
For each of the plots, we then only replaced the module under consideration while leaving the rest of the system the same. Plots that are added throughout the text to illustrate properties of the subsystems are typically run on the best performing variant of the system (as described in detail later):
model with observation count compression with a budget of 500,000 descriptors;
descriptors projected to 16 dimensions and product-quantized;
random grids matcher using an absolute threshold;
keypoint orientation and GPS prior used during matching;
4D voting using a maximum of 4 neighbors per query keypoint;
P2P + gravity solver for absolute pose;
refinement of matches after voting.
5. Global 3D model creation
Depending on the deployment environment of the system, global 3D localization models are typically generated from data captured with sensors carried by cars, pedestrians, or even users of the system. We found that high-quality results are most reliably obtained when using video sequences and fusing them into a single metric model of the environment (Schneider et al., 2018). In a typical robotics setup, each such video sequence consists of thousands of images and high-frequency data from an inertial measurement unit (IMU).
Sparse visual feature descriptors detected in the images are matched to descriptors from nearby cameras to form feature tracks. The 3D location of all tracks and the poses of the cameras are jointly estimated using metric SLAM techniques (Leutenegger et al., 2014; Mourikis et al., 2009a) to form self-consistent trajectories (including GPS, odometry, and other signals if available). Subsequently, the sequences are coregistered by localizing frames from one sequence against the 3D models of other sequences and batch-filtering the results to remove outliers. We found the key ingredient for robust coregistration being metric SLAM algorithms. These allow for efficient rejection of outlier matches by comparing relative transformations from SLAM with those computed from consecutive localizations as done by Zach et al. (2010) for images in SfM. After a rigid alignment of the trajectories based on inlier matches, we run a pre-optimization of a reduced system (Johannsson et al., 2013; Nerurkar et al., 2013) with cross-trajectory constraints to eliminate low=frequency errors from the trajectory. As a final step a maximum a posteriori (MAP) optimization (visual–inertial bundle adjustment) including inter- and intra-trajectory constraints with the following objective function is solved:
Here,
6. Descriptor extraction, selection, and projection
Owing to the computational and power constraints of mobile platforms, typically cheap, yet less repeatable and discriminative visual feature descriptors are used in the SLAM frontends (Leutenegger et al., 2014; Mur-Artal and Tardós, 2017). Common choices are BRIEF (Calonder et al.), ORB (Rublee et al., 2011), FREAK (Alahi et al., 2012) descriptors using FAST (Rosten and Drummond, 2006) or DoG (Lowe, 2004) interest points that can be computed at 30+ FPS on mobile platforms. It was shown that these descriptors typically provide sufficient discriminative power to reliably perform loop-closure, recovery, and even multi-user experiences in room-scale setups (Hartmann et al., 2013).
The applicability of BRIEF, ORB, FREAK, and BRISK for large-scale scenes however is limited (Sun et al., 2017), in particular when the query images exhibit substantial scale and viewpoint changes. Descriptors such as SIFT (Lowe, 2004) and SURF (Bay et al., 2006) provide better performance under these conditions as well as in large scenes with strong visual aliasing. A recent analysis (Schönberger et al., 2017) showed that classical descriptors also still outperform learned variants such as LIFT (Yi et al., 2016). Learned descriptors do not yet seem to generalize well to new scenes that look sufficiently different to the training data, yet one can expect to see the situation change in the near future. Other learned descriptors such as Delf (Yi et al., 2016) work well in retrieval tasks where fewer descriptors are beneficial and precise keypoint locations are not critical given that typically only approximate geometric re-ranking is performed. For localization however a high number of precisely located keypoints typically translates to a higher pose accuracy (see Figure 3 for a qualitative example of the distribution of map points in the query image).

Query images in Zurich localizing against models with different compression levels. With higher compression levels, points that are more stable under viewpoints are prioritized. If the map is built from multiple collects over time, the algorithm will favor points that are more likely to be re-observable over time.)
Trading computational cost and recognition performance is driven by the use-case and the allowed complexity of the system. Obvious options are using computationally cheap descriptors throughout the system (SLAM and global localization) or computing costlier descriptors periodically for localization queries only. As argued in our previous publication (Lynen et al., 2015), picking a single descriptor for the entire stack allows for a direct integration of localization matches into the SLAM frontend and, thus, reduces system complexity compared with having two descriptor types. A separate high-quality descriptor, on the other hand, can boost localization recall significantly.
In the following, we focus on large-scale scenes (
Another option to perform dimensionality reduction is to pick a projection matrix such that the
7. The need for model compression
When deploying a localization system, compactness for efficient storage as well as latency for loading and unpacking the 3D model from disk/network is a key factor. In our previous publication (Lynen et al., 2015), our proposed compression provided compactness to allow on-device localization and efficient download of the model from the server. However, now that we also want to run the localization system directly on server, the same properties are key to scalability. A typical model contains around 1 million 3D points for an area of
Owing to the density of data used to build the 3D models (videos or photo collections with redundant views), only a subset of points from the initially reconstructed 3D model is necessary for successful localization. This allows us to reduce the size of the model by a process we call summarization: a combination of 3D structure subselection and appearance summarization. In addition to summarization, we apply domain-specific data compression to bring the storage requirements to
7.1. Structure summarization
When capturing a scene multiple times for model construction the system can incorporate information about changes in the environment and gain robustness. At the same time, however, redundant scene information leads to an increase in 3D model size.
For a real-world deployment where certain streets might have been captured hundreds of times, we thus need to solve a non-trivial subselection and compression problem: build and maintain a model of the environment which is constant in memory size, yet capable of incorporating newly collected data over time. Early work in the robotics community discarded entire image captures from the map (Maddern et al., 2012a,b) or formed full image descriptors (Naseer et al., 2014) used to identify novel views of the scene. Discarding entire images, however, ignores the fine-grained information about stable environment features that are critical for robust localization. While Johns and Yang (2013) learn place-dependent feature statistics to limit insertions to the database to relevant locations, the representation per location still grows unbounded.
Driven by the structure-based localization algorithm and the desire for a constant size model, we leverage subsampling and summarization techniques from the computer vision (Camposeco et al., 2018; Cao and Snavely, 2014; Li et al., 2010; Park et al., 2013) and robotics (Dymczyk et al., 2015a,b; Mühlfellner et al., 2016) communities. These techniques have demonstrated that it is possible to discard large parts of the initial 3D points with only moderate influence on the localization performance.
After such compression, only the minimal amount of data required for localization is retained, which are the 3D landmark positions together with their corresponding descriptors as well as landmark covisibility information. Since the reduction process removes the landmarks which have been observed the least or have a large estimated covariance, the overall localization performance is only marginally affected. Performance declines more significantly only at high reduction rates (Li et al., 2010). We have also observed high compression rates in our previous work (Dymczyk et al., 2015b; Lynen et al., 2015), but interestingly not on our city-scale 3D models where the map density is typically lower than in SfM models built from photo tourism collections.
Picking the optimal selection of landmarks is a set-cover problem (NP complete).
A simple heuristic implementation of this data reduction is to set an upper bound on the number of descriptors per area and assign a fraction of this total to each camera in the map; we denote this by “observation count” based heuristic. For each camera, one keeps landmarks that have been observed most, discarding others until the budget per camera is met. Even given this simple strategy one can achieve good compression rates while ensuring coverage across the map.
While heuristics for the selection as used by Li et al. (2010) and Dymczyk et al. (2015b) provide good results, it has been shown by Mauro et al. (2014) and Havlena et al. (2013) that optimization-based approaches can provide gains especially under high compression rates. These approaches target picking the most informative landmarks while ensuring that every camera must observe at least
We apply our previous work (Dymczyk et al., 2015a) which extended the approach of Park et al. (2013) by augmenting the ILP problem with a term that constraints the absolute number of landmarks in the model. Using this constraint allows bounding the total memory cost to a desired memory budget. Adding this constraint to the problem, however, conflicts with the constraint of having a minimum number of observations for every camera and thus requires the addition of slack variables. The optimization problem selecting the best landmarks under constraints is (Dymczyk et al., 2015a):
Here,
For each sub map we start from a full SfM model, comprising typically 1,000–2,000 panoramic camera frames and up to 1 million landmarks (before summarization). We first investigate the difference between the observation count-based heuristic (which compresses the map by removing observations) and the ILP-optimization-based landmark count variant (which picks the optimal number of landmarks). We create variants of the model for Tokyo with different thresholds for observation and landmark count and measure average precision over their memory footprint.
It is evident from Figure 4 that the ILP variant outperforms the heuristic independent of the compression rates for the descriptor for the same memory budget. Exemplar models are depicted in Figure 5 showing the effect of compression on the density of 3D landmarks.

Different compressed variants of the Tokyo model using a heuristic observation count selection (OBS) or a ILP optimization-based landmark selection (ILP) strategy. For the values of the OBS strategy, the numbers denote the budget of descriptors, while for the ILP strategy the numbers denote the budget of landmarks. We also plot different numbers of sub-selected descriptors for the ILP variant as a reference.

Perspective and top-down views of a sub-map in Singapore with different compression levels (50,000, 100,000, 200,000, and 500,000 landmarks, respectively).
7.2. Appearance summarization
When performing map compression based on ILP optimization following Equation (3), each resulting landmark is represented in the map by a set of descriptors. Typically the different descriptors do not all represent unique modes of the landmark appearance and thus add substantial redundancy to the model. Obvious choices for compressing the landmark appearance are to apply averaging or subselection as previously proposed by Sattler et al. (2017a) (mean descriptor per visual word) and Irschara et al. (2009) (
While the compression strategy based on landmarks provides a useful reduction, landmarks from densely collected areas have a high number of observations and, thus, consume much of the memory budget. While the different observations of the landmarks capture the varying modes of appearance, they often exhibit redundancy and can be equally well represented with fewer modes. In addition, the structure compression by landmark selection we thus additionally perform per landmark appearance summarization to store only the relevant appearance modes per landmark. We compare standard density analysis techniques with random subselection and averaging and show their tradeoffs with respect to memory and localization performance.
As shown in Figure 6, it is possible to reduce the memory footprint by around 40% at moderate performance loss. Picking the centers per landmark from

Combining ILP optimization-based landmark selection with appearance compression using a fixed number of target descriptors per landmark. We compare performance on the Tokyo model using
Given the difference in visual saliency for points in the environment, the number of observations varies between landmarks. We found that observation count also correlates with the variance in appearance for landmark descriptors. We thus also evaluate the performance of using a fraction of the original descriptor count as the target number of descriptors to pick (see Figure 7).

Combining ILP optimization-based landmark selection with appearance compression using a target fraction of the original descriptors per landmark to pick. We compare performance on the Tokyo model using
Comparing a subset of variants using the “fixed count” versus “ratio” strategies (see Figure 8) shows a few operating points that provide beneficial memory/performance tradeoffs: for instance 200,000 landmarks with a summarization to 25% of the original descriptors. For the majority of operating points however the difference between the two strategies is marginal. In our system, we decided to use the ILP compression picking a maximum of 200,000 landmarks per tile. For each landmark we store

Comparison of performance on the Tokyo model when picking a fixed number of descriptors per landmark vs. using a ratio of the original descriptor count as a basis.
Appearance summarization also has an important effect on the end-to-end localization performance. Particularly in urban scenes, local visual aliasing from repeated elements requires the retrieval of many neighbors during feature matching to achieve high recall on the 3D points. Summarizing the descriptors per landmark reduces duplicate descriptors in the index and, thus, increases recall during matching.
7.3. Appearance compression
After applying landmark selection and appearance summarization, we project the selected descriptors to a lower-dimensional space. The tradeoff between higher descriptor dimensions and tile size versus average precision is shown in Figure 9. Given diminishing returns at higher dimensions we pick 16 dimensional descriptors.

Comparison of different descriptor dimensions after PCA and the effect of product quantization on average precision for the Tokyo model.
As a final data reduction step we compress the descriptors using product quantization (Jegou et al., 2011): the 16-dimensional descriptor space is split into
Following Jegou et al. (2011), the squared Euclidean distance between a regular descriptor
Here,
Decomposing the descriptor space such that each component has a similar variance reduces the quantization error of product quantization (Ge et al., 2014). As a result, Equation (4) better approximates the true descriptor distance between the two original descriptors. This balancing is achieved by permuting the rows of a rotation matrix that aligns the descriptor space with its principal directions as proposed by Ge et al. (2014). Note that this permutation does not introduce any computational overhead as the matrix is pre-computed and pre-multiplied with the projection matrix from Section 6.
With these product quantization parameters we could not measure a performance difference between the product quantized descriptors and the 16-dimensional version (see Figure 9), which suggests further potential for compression.
8. Localization against the global model
8.1. 2D–3D descriptor matching
As briefly outlined in the introduction, localization is based on matching features from a query image against features stored in a pre-built model of the environment. The high-level algorithmic flow is depicted in Figure 10 and consists of feature matching, match-filtering and pose resectioning.

Flow diagram of the key algorithmic steps involved in online localization.
To localize, images are captured by the device 1 and downsized to VGA and JPEG compressed before being uploaded to the server. This saves bandwidth and latency while having only a marginal effect on quality as highlighted in Figure 11.

Ablation study for the effect of different image sizes and JPEG compression rates on system performance.
The first part of localization is run on the server and consists of establishing 2D-3D matches between the features found in the current camera and the 3D landmarks via descriptor matching (Li et al., 2012, 2010; Sattler et al., 2017a; Svarm et al., 2014). A popular approach to accelerate the matching process is to build a
In the following we look at different methods for accelerated nearest-neighbor search in addition to inverted indices and also revisit the decision for the inverted multi-index we took in our previous work (Lynen et al., 2015).
8.1.1. The inverted multi-index
Obviously, larger vocabularies are desirable as fewer descriptors will be stored for every word. Yet, using a larger vocabulary implies higher assignment times and memory consumption. Both of these problems can largely be circumvented by using an inverted multi-index (Babenko and Lempitsky, 2012): Similar to product quantization, the descriptor space is split into two parts and a visual vocabulary
After landmark selection each sub-models of
Given that the vocabularies are trained independently, we found that only about

The bucket load in the inverted multi-index as a function of descriptor count in tiles. Both mean and max load increase roughly linearly, but stay highly uneven over the buckets. Naturally these lead to long tails in the processing of hash buckets (postings lists).
8.1.2. Random grids
To work around the shortcomings of applying the inverted multi-index in our setting, we are interested in approaches that do not require learning a vocabulary upfront and that also handle varying density in the descriptor space better. We found that the “Random Grids” algorithm (Aiger et al., 2013) provides these properties and is straightforward to implement and tune. The core idea of the algorithm is to apply a random rotation and shift to the descriptor space and compute a hash-key from the transformed descriptor vector. Descriptors from both the model and query are rotated, shifted, and hashed the same way. Whenever a query and database descriptor have the same hash-key, one computes the exact distance between the descriptor and conditionally stores the database index in the result list. The rotation, shift, and hashing functions can be picked freely (learned) such that they provide the desired runtime/quality properties.
Differences in appearance, noise, and other effects mean that hash keys for corresponding descriptors can be different and the number of hash collisions is not high enough to lead to the desired matching recall. Therefore, the random rotations, shifts, and hashing is repeated
8.2. Evaluation of matching algorithms
In our previous work (Lynen et al., 2015), we compared a
For the inverted multi-index used in the following experiments, we build two vocabularies containing 1,000 words each that generate a product vocabulary with 1 million words. At query time we used a
The experiments focus on the tradeoff between quality and runtime by adjusting approximation parameters. For the inverted multi-index we vary the number of closest vocabulary words visited per descriptor. For the random-grids approach, we vary the number of descriptors visited per grid cell.
While the random-grids approach outperformed the inverted multi-index at query costs exceeding 150 ms, the inverted multi-index was found to degrade more gracefully given the strategy we used for runtime restriction (see Figure 13).

Comparison of the inverted multi-index (IMI) and the random grids (RG) index using the keypoint orientation (Rot) as additional signal. The underlying model is Tokyo compressed to 100,000 landmarks per tile using ILP compression.
Given its higher quality (at moderately increased runtime cost) we leverage the random grids algorithm with 16-dimensional descriptors. We limit the runtime of random-grids by allowing a maximum of 100 descriptors per grid cell, which are picked at random.
8.3. Leveraging priors during matching
In addition to the descriptors, we store the gravity rectified keypoint orientation as proposed by Jones and Soatto (2011) and later Kurz and Himane (2011). We extract gradient aligned CONGAS (Zheng et al., 2009) descriptors and then change their orientation according to the gravity direction of the camera. This method allows for faster matching (referenced as “GAFD-fast” in Kurz and Himane (2011)) when used in the matching either as either a hard or soft filter. Hard filtering is implemented by rejecting match candidates in the postings lists (both inverted multi-index or random-grids) if their orientation does not match. Soft filtering uses the (weighted) descriptor orientation as additional descriptor dimension where it becomes part of the distance calculation used to rank neighbors. See Figure 14 for the effect of the orientation information.

Comparison of the inverted multi-index (IMI) and the random grids (RG) index using the keypoint orientation (Rot) and a location prior (Prior) as additional signals. The underlying model is Tokyo compressed to 100,000 landmarks per tile using ILP compression.
In addition to using GPS information to select the models to localize against, we also leverage the information as part of the nearest-neighbor search to increase matching quality. In our use-case of outdoor robot and mobile-phone localization, priors from GPS/WiFi are typically available and accurate to between 5 and 50 m. Leveraging these weighted priors allows further boosting the performance for this early stage of the pipeline as shown in Figure 14.
For keypoint orientation and GPS prior we apply weights of
8.4. Range search,
NN, and thresholding
Recall of 2D–3D matches is reduced by limited descriptor distinctiveness that arises from visual aliasing and from artifacts that occur during compression. Following previous works, we thus match each keypoint from the query against

Localization performance as a function of the number
We found a range search with an absolute threshold to reliably reduce outliers and improve overall performance. The exact value of the threshold depends on whether the descriptor is augmented with values from the keypoint orientation and prior, but appears to be globally applicable across locales as shown in Figure 16. While filtering on descriptor distance improves performance overall, it does not significantly change the negative impact of increasing the number

The performance of inverted multi-index and Random Grids over a range of absolute threshold values and cities. The optimal threshold for Random Grids is higher since it includes error thresholds for keypoint orientation and position prior. The underlying models are compressed using the observation count compression to 500,000 descriptors per tile.

Evaluation of localization performance as a function of RANSAC iterations for covisibility graph-based filtering and the voting approach of Zeisl et al. (2015). Note the faster convergence of the voting approach at a lower count of RANSAC iterations. The underlying models are compressed using the observation count compression to 500,000 descriptors per tile.
An alternative to filtering by absolute distance is to use the ratio test proposed by Lowe (2004). The ratio test, however, turns out to be non-trivial to apply when matching against large models given that it is not clear which neighbor to pick as a reference: landmarks can have a variable number of associated descriptors and several landmarks can have near-identical appearance.
We would thus optimally obtain an independent reference (distractor) distribution to pick the descriptor distance from. Storing this distribution and performing the search for the reference feature, however, incurs additional cost. To make a fair comparison at similar runtime cost, we experimented with using the vocabulary words of the inverted multi-index as a reference. The distances to the closest words provide an approximation of the local descriptor space density and, thus, allow a distance threshold to be derived for matching that takes into account the varying density in the descriptor space. This strategy is denoted as ratio test in Figure 18.

The performance difference between applying an absolute threshold versus a ratio test against close words from the vocabulary of the inverted multi-index. The underlying models are compressed using the observation count compression to 500,000 descriptors per tile.
8.5. Covisibility-based and geometric outlier filtering
Often, fewer than
This covisibility filtering approach removes matches that do not belong to the same location in the map (Li et al., 2012; Sattler et al., 2017a; Stumm et al., 2013). The 3D model defines a undirected, bipartite visibility graph (Li et al., 2010), where the two sets of nodes correspond to the database images and the 3D landmarks in the map. A landmark node and an image node are connected if the landmark is visible in the corresponding database image. The landmarks from a given set of 2D–3D matches and their corresponding database images then form a set of connected components in this visibility graph. The covisibility filter from Sattler et al. (2017a) simply removes all matches whose 3D point does not belong to the largest connected component.
As evaluated by Lynen et al. (2017), these algorithms however remain very sensitive to the choice of
We thus compare in the following voting and covisibility graph-based techniques. In Sattler et al. (2017b) the covisibility graph approach outperforms the voting implementation of Zeisl et al. (2015) while for our datasets we found the opposite to be true. It seems the optimal choice is a question of dataset and implementation (see Figures 17 and 19 for a comparison on city-scale datasets).

Performance comparison of covisibility graph filtering and voting approaches. We found that for some sequences the approaches perform very similar (as also reported by Sattler et al. (2017b)). Over a larger number of evaluation sequences and city-scale models as in our setup the sparsity varies drastically over the area and a single criterion for graph expansion is difficult to pick. Here we found the performance of the covisibility filtering being degraded. The underlying models are compressed using the observation count compression to 500k descriptors per tile.
8.6. Camera pose estimation
After outlier removal we can estimate the camera pose given the matches. Here, we follow standard techniques. Given the knowledge of the gravity direction for both the database and the query side, we can leverage minimal solvers that exploit this additional constraint. We found that the two-point solver proposed by Sweeney et al. (2015) provides superior performance to the P3P solver of Kneip et al. (2011) as shown in Figure 20. To improve runtime of the pose solver we use a randomized RANSAC verification approach as proposed by Matas and Chum (2004) and use the saved time to run additional iterations. The final solution is refined using PnP on all inliers (Hesch and Roumeliotis, 2011).

The absolute pose recovery performance of p2p+g (Sweeney et al., 2015) compared with P3P (Kneip et al., 2011) as a function of the inlier threshold used in RANSAC for inlier counting. The underlying model is from Zurich and compressed using the observation count compression to 500,000 descriptors per tile.
8.7. Pose candidate refinement
While increasing the number of neighbors during matching increases matching recall, the resulting increase in outliers reduces overall system performance (see Section 8.4 ).
To recover these queries we break the localization pipeline into two hierarchical stages. First we run the matching, filtering, and pose recovery steps described in the previous sections. We score maxima of the voting space based on the effective inlier count (Irschara et al., 2009) and return them as pose candidates if they are deemed reliable enough. If none of the candidates are considered good enough we run a refinement stage which breaks down the problem into smaller areas. First we identify the relevant cameras in the model using a voting scheme similar to what was proposed by Irschara et al. (2009) and Gehrig et al. (2017). We want to distinguish irrelevant regions of the map that received outlier matches (at random) from those that are relevant candidates for localization. This differs from a covisibility filter since it includes a statistical model for the likelihood of random matches as a function of the descriptor density in the tile. Given the assumption that irrelevant locations receive votes randomly with probability
where
We expect that a location that corresponds to the true location of the query does not follow this binomial distribution. Similar to Gehrig et al. (2017) we formulate a null hypothesis: For an outlier pose the number of matches
is thus considered a relevant location to be considered for refinement. We weight this score with the pose prior from GPS and use it to rank candidates for refinement. For the top
To evaluate combining pose voting with pose refinement we vary the number of candidates

Comparison of our implementation of the voting approach by Zeisl et al. (2015) with a variant using additional pose candidate refinement. Both variants use the Random Grids matcher on descriptors augmented with keypoint orientation and position prior. The underlying model is from Tokyo and compressed using the observation count compression to 500,000 descriptors per tile.
9. Local pose tracking
For any real-time application in robotics or augmented reality it is crucial to provide low-latency, low drift tracking of the camera pose relative to the environment. SLAM algorithms leveraging visual and inertial data are a common choice to provide estimates relative to a local frame of reference. By leveraging matches from the localization system one can register the local tracking against a global reference to unlock navigation and content display in the physical world. Combinations of visual–inertial odometry and localization have been shown (Jones and Soatto, 2011) to be scalable to large environments of several tens of kilometers.
In our system, the pose of the platform is tracked in real-time using a visual–inertial sliding window estimator (implemented as an extended Kalman filter (EKF)) with on-the-fly feature marginalization similar to the work of Mourikis et al. (2009a) with adaptations as proposed by Hesch et al. (2014). The temporally evolving state in this estimator is given by
where
In addition to the evolving state
Here,
Using measurements from the IMU increases robustness and accuracy while providing a metric pose estimate. At the same time, the proper marginalization of past measurements (Dong-Si and Mourikis, 2011; Leutenegger et al., 2014; Nerurkar et al., 2013; Sibley et al., 2010) is key to obtain a smooth pose estimate. This is particularly relevant when including measurements to the global model that are often not in perfect agreement with the locally observed structure, e.g., due to moving objects during model creation or drift in the local pose estimates. Outlier measurements are rejected by observing the innovation of the update; here history-based approaches as proposed by Tsotsos et al. (2015) provide alternatives for increased robustness.
9.1. Global updates to the local state estimation
In order to bootstrap the localization system, descriptors from the cameras of the local SLAM system are matched against the model as described in Section 8. Once an estimate of the pose
Here, ⊗ denotes the transformation composition operator. The computed transformation
In the algorithm proposed in this article, every associated 2D–3D match provides a measurement of the form
where
By linearizing this expression around the state estimate we obtain (see Mourikis et al., 2009a: Equation (29) for details)):
Here,
When querying the map, it is not unusual to retrieve hundreds of matches from the image to the global map. To reduce the computational complexity of updating the estimator, all the residuals and Jacobians
where
After discarding
Using Givens rotations, the residual
The MSCKF algorithm (Mourikis et al., 2009a) processes a feature track as soon as the track is broken or the entire window of cameras is spanned by the track. In our local SLAM system, these completed tracks are used to triangulate landmarks and the resulting 3D points are then used to update the estimator. When using the same visual features for frame-to-frame tracking and global localization, we can use a match between the 3D model and a feature from a single frame to identify the corresponding feature track. This information can now be used to form a constraint to the 3D model that involves all cameras that are spanned by the corresponding feature track. We found that forming a constraint that involves all keyframes which are part of the track gives a lower tracking error than performing single camera updates. To avoid double counting information, care must be taken that feature measurements are used to either formulate a constraint in the local SLAM or to the global 3D map, but not both. Given the information content of the global map, measurements to the global 3D map are preferred; where additional constraints on the updates can ensure estimator consistency (Hesch and Roumeliotis, 2012).
In order to keep memory requirements bounded, we do not store the covariance matrix for the landmarks in the map, but instead inflate the measurement noise covariance during the update assuming the landmark position errors are uncorrelated between observations. While being approximate and thus not the most accurate, the strategy allows us to keep the storage cost for a map limited. A better filtering formulation named a “Cholesky–Schmidt–Kalman filter” was recently proposed by DuToit et al. (2017), which allows for consistent updates and thus showed a reduction in pose error by more than
9.2. Evaluation of the pose fusion
Next, we evaluate the pose tracking quality achieved with our state estimator that directly includes global 2D–3D matches as EKF updates. We are interested in the position and orientation accuracy of our system, as well as the smoothness of the computed trajectories, and the time required for the state updates. We compare our system with the algorithm proposed by Middelberg et al. (2014) which performs local SLAM using a sliding window bundle adjustment which optimizes only local parameters and keeps the global model fixed.
Both Middelberg et al. (2014) and Ventura et al. (2014) first compute an initial alignment using either the camera poses returned by the server or the global landmark positions. For all following frames that are sent to the server, they then optimize the alignment by including the global 2D–3D matches into the bundle adjustment of the local map. To limit the computational complexity, they perform a windowed version of SLAM based on a limited number of cameras. Cameras that are furthest away from the current pose (Middelberg et al., 2014) or oldest (Ventura et al., 2014) are discarded together with their constraints to the local and global model. Discarding (instead of properly marginalizing) measurements however has been shown to lead to suboptimal estimation performance (Dong-Si and Mourikis, 2011; Leutenegger et al., 2014; Sibley et al., 2010). The removal of constraints from the optimization also leads to discontinuities in the resulting pose estimate as the minimum of the cost function changes. To improve the performance of our reference implementation and allow a fair comparison we included IMU constraints in the bundle adjustment and use a non-linear solver that exploits the structure of the problem. Table 2 compares our method against the approach of Middelberg et al. (2014) in which both estimators are fed with the exact same data and the same constraints to the map. For every camera frame, we evaluate the error between the estimated pose and the ground truth as the Euclidean distance between the positions and the disparity angle in orientation. As is evident from the table, our EKF-based approach achieves a positional accuracy similar to the best-performing bundle adjustment approach while offering a more accurate estimate of the camera orientation. At the same time, our approach is more than one order of magnitude faster than the most efficient bundle-adjustment-based variant. While bundle adjustment is typically run in a separate thread to avoid blocking pose tracking (Middelberg et al., 2014), the proposed EKF-based estimator is efficient enough to be directly run on each frame.
Comparing the proposed EKF-based estimator update with sliding window bundle adjustment (BA): we report the mean time t-up required to update the estimator based on the global 2D–3D matches and the mean position
Figure 22 shows that even though both approaches offer a similar mean pose accuracy, our estimator achieves a much better temporal consistency. We capture this measure by comparing the change in the error between ground truth and estimate for position and orientation. Avoiding discontinuities in pose tracking is a vital property for obstacle avoidance and robot control, where large pose jitter can cause problems when determining a path that prevents a collision. Both the runtime and accuracy metrics underline the superiority of a pose fusion approach that properly marginalizes the global constraints.

Compared with a sliding window bundle adjustment approach similar to Middelberg et al. (2014), the proposed direct inclusion of the global 2D–3D matches into EKF gives significantly smoother trajectories as evident from the difference in the pose error between subsequent frames.
10. Conclusion
In this article, we have presented a system for visual localization at scale. We have provided details about map compression and localization algorithms that we found essential for scalable server-side deployment.
We have leveraged map compression techniques from the computer vision community and extended them with descriptor summarization to gain another reduction in memory footprint of a factor of 2–4. With our detailed analysis of localization performance as function of map-compression algorithms, we aim to provide guidance for parameter choices to the community. We have also shown the effect of various parameters in the localization stack including novel insights into outlier filtering strategies that allow queries with latencies in the 200 ms range. Through the addition of an improved descriptor matching algorithm, position prior, and a candidate refinement step, we have found the system to outperform other approaches when working with large-scale models. We evaluate a proof-of-concept implementation of the system across four cities from three continents by querying 2.5 million images collected with smartphone cameras. The scale of models and number of queries surpasses previous evaluations by several orders of magnitude and hopefully demonstrates the wide applicability of the parameter choices.
Footnotes
Acknowledgements
This work was done while Torsten Sattler was at ETH Zurich.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This research was supported by a Google Sponsor Research Agreement as part of the ‘Visual Positioning Service’.
