Home

Awesome

<p align="center"> <h1 align="center"><img src="assets/lamar_white.svg" width="85"><br><ins>LaMAR</ins><br>Benchmarking Localization and Mapping<br>for Augmented Reality</h1> <p align="center"> <a href="https://psarlin.com/">Paul-Edouard&nbsp;Sarlin*</a> · <a href="https://dsmn.ml/">Mihai&nbsp;Dusmanu*</a> <br> <a href="https://demuc.de/">Johannes&nbsp;L.&nbsp;Schönberger</a> · <a href="https://www.microsoft.com/en-us/research/people/paspecia/">Pablo&nbsp;Speciale</a> · <a href="https://www.microsoft.com/en-us/research/people/lugruber/">Lukas&nbsp;Gruber</a> · <a href="https://vlarsson.github.io/">Viktor&nbsp;Larsson</a> · <a href="http://miksik.co.uk/">Ondrej&nbsp;Miksik</a> · <a href="https://www.microsoft.com/en-us/research/people/mapoll/">Marc&nbsp;Pollefeys</a> </p> <p align="center"> <img src="assets/logos.svg" alt="Logo" height="40"> </p> <h2 align="center">ECCV 2022</h2> <h3 align="center"><a href="https://lamar.ethz.ch/">Project Page</a> | <a href="https://youtu.be/32XsRli2coo">Video</a></h3> <div align="center"></div> </p> <p align="center"> <a href="https://lamar.ethz.ch/"><img src="assets/teaser.svg" alt="Logo" width="80%"></a> <br> <em>LaMAR includes multi-sensor streams recorded by AR devices along hundreds of unconstrained trajectories captured over 2&nbsp;years in 3&nbsp;large indoor+outdoor locations.</em> </p>

This repository hosts the source code for LaMAR, a new benchmark for localization and mapping with AR devices in realistic conditions. The contributions of this work are:

  1. A dataset: multi-sensor data streams captured by AR devices and laser scanners
  2. scantools: a processing pipeline to register different user sessions together
  3. A benchmark: a framework to evaluate algorithms for localization and mapping

See our ECCV 2022 tutorial for an overview of LaMAR and of the state of the art of localization and mapping for AR.

Overview

This codebase is composed of the following modules:

Data format

We introduce a new data format, called Capture, to handle multi-session and multi-sensor data recorded by different devices. A Capture object corresponds to a capture location. It is composed of multiple sessions and each of them corresponds to a data recording by a given device. Each sessions stores the raw sensor data, calibration, poses, and all assets generated during the processing.

from scantools.capture import Capture
capture = Capture.load('data/CAB/')
print(capture.sessions.keys())
session = capture.sessions[session_id]  # each session has a unique id
print(session.sensors.keys())  # each sensor has a unique id
print(session.rigs)  # extrinsic calibration between sensors
keys = session.trajectories.key_pairs()  # all (timestamp, sensor_or_rig_id)
T_w_i = sessions.trajectories[keys[0]]  # first pose, from sensor/rig to world

More details are provided in the specification document CAPTURE.md.

Installation

:one: Install the core dependencies:

:two: Install the LaMAR libraries and pull the remaining pip dependencies:

python -m pip install -e .

:three: Optional: the processing pipeline additionally relies on heavier dependencies not required for benchmarking:

:four: Optional: if you wish to contribute, install the development tools as well:

python -m pip install -e .[dev]

Docker images

The Dockerfile provided in this project has multiple stages, two of which are: scantools and lamar.

Building the Docker Images

You can build the Docker images for these stages using the following commands:

# Build the 'scantools' stage
docker build --target scantools -t lamar:scantools -f Dockerfile ./

# Build the 'lamar' stage
docker build --target lamar -t lamar:lamar -f Dockerfile ./

Pulling the Docker Images from GitHub Docker Registry

Alternatively, if you don't want to build the images yourself, you can pull them from the GitHub Docker Registry using the following commands:

# Pull the 'scantools' image
docker pull ghcr.io/microsoft/lamar-benchmark/scantools:latest

# Pull the 'lamar' image
docker pull ghcr.io/microsoft/lamar-benchmark/lamar:latest

Benchmark

:one: Obtain the evaluation data: visit the dataset page and place the 3 scenes in ./data :

data/
├── CAB/
│   └── sessions/
│       ├── map/                # mapping session
│       ├── query_hololens/     # HoloLens test queries
│       ├── query_phone/        # Phone test queries
│       ├── query_val_hololens/ # HoloLens validation queries
│       └── query_val_phone/    # Phone validation queries
├── HGE
│   └── ...
└── LIN
    └── ...

Each scene contains a mapping session and queries for each device type. We provide a small set of validation queries with known ground-truth poses such that they can be used for developing algorithms and tuning parameters. We keep private the ground-truth poses of the test queries.

:two: Run the single-frame evaluation with the strongest baseline:

python -m lamar.run \
	--scene $SCENE --ref_id map --query_id $QUERY_ID \
	--retrieval fusion --feature superpoint --matcher superglue

where $SCENE is in {CAB,HGE,LIN} and $QUERY_ID is in {query_phone,query_hololens} for testing and in {query_val_phone,query_val_hololens} for validation. All outputs are written to ./outputs/ by default. For example, to localize validation Phone queries in the CAB scene:

python -m lamar.run \
	--scene CAB --ref_id map --query_id query_val_phone \
	--retrieval fusion --feature superpoint --matcher superglue

This executes two steps:

  1. Create a sparse 3D map using the mapping session via feature extraction, pair selection, feature matching, triangulation
  2. Localize each image of the sequence via feature extraction, pair selection, feature matching, absolute pose estimation

:three: Obtain the evaluation results:

:four: Workflow: the benchmarking pipeline is designed such that

Other evaluation options

<details> <summary>[Click to expand]</summary>

Using radio signals for place recognition:

python -m lamar.run [...] --use_radios

Localization with sequences of 10 seconds instead of single images:

python -m lamar.run [...] --sequence_length_seconds 10
</details>

Adding your own algorithms

<details> <summary>[Click to expand]</summary>

To add a new local feature:

To add a new global feature for image retrieval:

To add a new local feature matcher:

To add a new pose solver: create a new class that inherits from lamar.tasks.pose_estimation.SingleImagePoseEstimation:

class MyPoseEstimation(SingleImagePoseEstimation):
    method = {'name': 'my_estimator'}
    def run(self, capture):
        ...
</details>

Processing pipeline

Each step of the pipeline corresponds to a runfile in scantools/run_*.py that can be used as follow:

from scantools import run_phone_to_capture
run_phone_to_capture.run(...)

We provide pipeline scripts that execute all necessary steps:

The raw data will be released soon such that anyone is able to run the processing pipeline without access to capture devices.

Here are runfiles that could be handy for importing and exporting data:

Raw data

We also release the raw original data, as recorded by the devices (HoloLens, phones, NavVis scanner), with minimal post-processing. Like the evaluation data, the raw data is accessed through the dataset page. More details are provided in the specification document RAW-DATA.md.

Release plan

We are still in the process of fully releasing LaMAR. Here is the release plan:

BibTex citation

Please consider citing our work if you use any code from this repo or ideas presented in the paper:

@inproceedings{sarlin2022lamar,
  author    = {Paul-Edouard Sarlin and
               Mihai Dusmanu and
               Johannes L. Schönberger and
               Pablo Speciale and
               Lukas Gruber and
               Viktor Larsson and
               Ondrej Miksik and
               Marc Pollefeys},
  title     = {{LaMAR: Benchmarking Localization and Mapping for Augmented Reality}},
  booktitle = {ECCV},
  year      = {2022},
}

Legal Notices

Microsoft and any contributors grant you a license to the Microsoft documentation and other content in this repository under the Creative Commons Attribution 4.0 International Public License, see the LICENSE file, and grant you a license to any code in the repository under the MIT License, see the LICENSE-CODE file.

Microsoft, Windows, Microsoft Azure and/or other Microsoft products and services referenced in the documentation may be either trademarks or registered trademarks of Microsoft in the United States and/or other countries. The licenses for this project do not grant you rights to use any Microsoft names, logos, or trademarks. Microsoft's general trademark guidelines can be found at http://go.microsoft.com/fwlink/?LinkID=254653.

Privacy information can be found at https://privacy.microsoft.com/en-us/

Microsoft and any contributors reserve all other rights, whether under their respective copyrights, patents, or trademarks, whether by implication, estoppel or otherwise.