Skip to content

TOPO-EPFL/DDLoc

Repository files navigation

DDLoc localization: a sim-to-real learning method for absolute localization

This repo contains the Pytorch implementation of DDLoc, an adapation of ARC method for absolute coordinate regression.

Please make sure you have access to the CrossLoc Benchmark Raw Datasets and have set it up properly before proceeding.

Also check out other useful repos regarding the datasets:

The DDLoc localization algorithm is officially presented in the paper accepted to CVPR 2022
CrossLoc: Scalable Aerial Localization Assisted by Multimodal Synthetic Data
Qi Yan, Jianhao Zheng, Simon Reding, Shanci Li, Iordan Doytchinov
École Polytechnique Fédérale de Lausanne (EPFL)
Links: website | arXiv | code repos | datasets

Happy coding! :)

Contents

Requirements

  1. Python 3.6 with Ubuntu 16.04
  2. Pytorch 1.1.0
  3. dsacstar (if you want to test the camera pose estimation from the scene coordinate prediction)

You also need other third-party libraries, such as numpy, pillow, torchvision, and tensorboardX (optional) to run the code.

We suggest to follow the procedure in CrossLoc repo to install dependecies.

Datasets

You have to download our provided urbanscape data and place them in the following structure to load the data. See Pretrained Models section for download links.

Dataset Structure

urban (real)
    | train
        | rgb
        | poses
        | init
        | calibration
    | test
        | rgb
        | poses
        | init
        | calibration
urban (synthetic)
    | train
        | rgb
        | poses
        | init
        | calibration      

You can download naturescape data for more experiments and follow the same structure.

Training Precedures

We provide example scripts for training each step in this folder batch_size and eval_batch_size are flexible to change given your working environment.

1 Train Initial Coordinate Regressor C

Train an initial coordinate regressor C with real and synthetic data. The best model is picked by the one with minimum camera poses error. The checkpoints are saved in ./checkpoints/your_dir_name/train_initial_coord_regressor_C/.

2 Train Style Translator T

Train the style translator T with naive mixed data and finetune T by paired real and synthetic data. The best model is picked by visual inspection & training loss curves.

3 Train Initial Attention Module A

Train an initial attention module A from scratch with descending $\tau$ values.

4 Train Inpainting Module I

Train the inpainting module I with T (from step 2) and A (from step 3).

5 Jointly Train Coordinate Regressor C and Attention Module A