The code for our paper submitted to RAL/IROS 2022: OverlapTransformer: An Efficient and Rotation-Invariant Transformer Network for LiDAR-Based Place Recognition.

Overview

OverlapTransformer

The code for our paper submitted to RAL/IROS 2022:

OverlapTransformer: An Efficient and Rotation-Invariant Transformer Network for LiDAR-Based Place Recognition. PDF

OverlapTransformer is a novel lightweight neural network exploiting the LiDAR range images to achieve fast execution with less than 4 ms per frame using python, less than 2 ms per frame using C++ in LiDAR similarity estimation. It is a newer version of our previous OverlapNet, which is faster and more accurate in LiDAR-based loop closure detection and place recognition.

Developed by Junyi Ma, Xieyuanli Chen and Jun Zhang.

Haomo Dataset

Fig. 1 An online demo for finding the top1 candidate with OverlapTransformer on sequence 1-1 (database) and 1-3 (query) of Haomo Dataset.

Fig. 2 Haomo Dataset which is collected by HAOMO.AI.

More details of Haomo Dataset can be found in dataset description (link).

Table of Contents

  1. Introduction and Haomo Dataset
  2. Publication
  3. Dependencies
  4. How to use
  5. License

Publication

If you use our implementation in your academic work, please cite the corresponding paper (PDF):

@article{ma2022arxiv, 
	author = {Junyi Ma and Jun Zhang and Jintao Xu and Rui Ai and Weihao Gu and Cyrill Stachniss and Xieyuanli Chen},
	title  = {{OverlapTransformer: An Efficient and Rotation-Invariant Transformer Network for LiDAR-Based Place Recognition}},
	journal = {arXiv preprint},
	eprint = {2203.03397},
	year = {2022}
}

Dependencies

We use pytorch-gpu for neural networks.

An nvidia GPU is needed for faster retrival. OverlapTransformer is also fast enough when using the neural network on CPU.

To use a GPU, first you need to install the nvidia driver and CUDA.

  • CUDA Installation guide: link
    We use CUDA 11.3 in our work. Other versions of CUDA are also supported but you should choose the corresponding torch version in the following Torch dependences.

  • System dependencies:

    sudo apt-get update 
    sudo apt-get install -y python3-pip python3-tk
    sudo -H pip3 install --upgrade pip
  • Torch dependences:
    Following this link, you can download Torch dependences by pip:

    pip3 install torch==1.10.2+cu113 torchvision==0.11.3+cu113 torchaudio==0.10.2+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html

    or by conda:

    conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
  • Other Python dependencies (may also work with different versions than mentioned in the requirements file):

    sudo -H pip3 install -r requirements.txt

How to use

We provide a training and test tutorials for KITTI sequences in this repository. The tutorials for Haomo dataset will be released together with Haomo dataset.

We recommend you follow our code and data structures as follows.

Code structure

├── config
│   ├── config_haomo.yml
│   └── config.yml
├── modules
│   ├── loss.py
│   ├── netvlad.py
│   ├── overlap_transformer_haomo.py
│   └── overlap_transformer.py
├── test
│   ├── test_haomo_topn_prepare.py
│   ├── test_haomo_topn.py
│   ├── test_kitti00_PR_prepare.py
│   ├── test_kitti00_PR.py
│   ├── test_results_haomo
│   │   └── predicted_des_L2_dis_bet_traj_forward.npz (to be generated)
│   └── test_results_kitti
│       └── predicted_des_L2_dis.npz (to be generated)
├── tools
│   ├── read_all_sets.py
│   ├── read_samples_haomo.py
│   ├── read_samples.py
│   └── utils
│       ├── gen_depth_data.py
│       ├── split_train_val.py
│       └── utils.py
├── train
│   ├── training_overlap_transformer_haomo.py
│   └── training_overlap_transformer_kitti.py
├── valid
│   └── valid_seq.py
├── visualize
│   ├── des_list.npy
│   └── viz_haomo.py
└── weights
    ├── pretrained_overlap_transformer_haomo.pth.tar
    └── pretrained_overlap_transformer.pth.tar

Dataset structure

In the file config.yaml, the parameters of data_root are described as follows:

  data_root_folder (KITTI sequences root) follows:
  ├── 00
  │   ├── depth_map
  │     ├── 000000.png
  │     ├── 000001.png
  │     ├── 000002.png
  │     ├── ...
  │   └── overlaps
  │     ├── train_set.npz
  ├── 01
  ├── 02
  ├── ...
  └── 10
  
  valid_scan_folder (KITTI sequence 02 velodyne) contains:
  ├── 000000.bin
  ├── 000001.bin
  ...

  gt_valid_folder (KITTI sequence 02 computed overlaps) contains:
  ├── 02
  │   ├── overlap_0.npy
  │   ├── overlap_10.npy
  ...

You need to download or generate the following files and put them in the right positions of the structure above:

  • You can find gt_valid_folder for sequence 02 here.
  • Since the whole KITTI sequences need a large memory, we recommend you generate range images such as 00/depth_map/000000.png by the preprocessing from Overlap_Localization or its C++ version, and we will not provide these images. Please note that in OverlapTransformer, the .png images are used instead of .npy files saved in Overlap_Localization.
  • More directly, you can generate .png range images by the script from OverlapNet updated by us.
  • overlaps folder of each sequence below data_root_folder is provided by the authors of OverlapNet here.

Quick Use

For a quick use, you could download our model pretrained on KITTI, and the following two files also should be downloaded :

Then you should modify demo1_config in the file config.yaml.

Run the demo by:

cd demo
python ./demo_compute_overlap_sim.py

You can see a query scan (000000.bin of KITTI 00) with a reprojected positive sample (000005.bin of KITTI 00) and a reprojected negative sample (000015.bin of KITTI 00), and the corresponding similarity.

Fig. 3 Demo for calculating overlap and similarity with our approach.

Training

In the file config.yaml, training_seqs are set for the KITTI sequences used for training.

You can start the training with

cd train
python ./training_overlap_transformer_kitti.py

You can resume from our pretrained model here for training.

Testing

Once a model has been trained , the performance of the network can be evaluated. Before testing, the parameters shoud be set in config.yaml

  • test_seqs: sequence number for evaluation which is "00" in our work.
  • test_weights: path of the pretrained model.
  • gt_file: path of the ground truth file provided by the author of OverlapNet, which can be downloaded here.

Therefore you can start the testing scripts as follows:

cd test
python test_kitti00_PR_prepare.py
python test_kitti00_PR.py

After you run test_kitti00_PR_prepare.py, a file named predicted_des_L2_dis.npz is generated in test_results_kitti, which is used by python test_kitti00_PR.py

For a quick test of the training and testing procedures, you could use our pretrained model.

Visualization

Visualize evaluation on KITTI 00

Firstly, to visualize evaluation on KITTI 00 with search space, the follwoing three files should be downloaded:

and modify the paths in the file config.yaml. Then

cd visualize
python viz_kitti.py

Fig. 4 Evaluation on KITTI 00 with search space from SuMa++ (a semantic LiDAR SLAM method).

Visualize evaluation on Haomo challenge 1 (after Haomo dataset is released)

We also provide a visualization demo for Haomo dataset after Haomo dataset is released (Fig. 1). Please download the descriptors of database (sequence 1-1 of Haomo dataset) firstly and then:

cd visualize
python viz_haomo.py

C++ implemention

We provide a C++ implemention of OverlapTransformer with libtorch for faster retrival.

  • Please download .pt and put it in the OT_libtorch folder.
  • Before building, make sure that PCL exists in your environment.
  • Here we use LibTorch for CUDA 11.3 (Pre-cxx11 ABI). Please modify the path of Torch_DIR in CMakeLists.txt.
  • For more details of LibTorch installation , please check this website.
    Then you can generate a descriptor of 000000.bin of KITTI 00 by
cd OT_libtorch/ws
mkdir build
cd build/
cmake ..
make -j6
./fast_ot 

You can find our C++ OT can generate a decriptor with less than 2 ms per frame.

License

Copyright 2022, Junyi Ma, Xieyuanli Chen, Jun Zhang, HAOMO.AI Technology Co., Ltd., China.

This project is free software made available under the GPL v3.0 License. For details see the LICENSE file.

Comments
  • ford campus dataset

    ford campus dataset

    Hello authors, thank you very much for sharing this project. Due to the differences in the data formats of the ford campus dataset and the KITTI dataset, I can only do spherical projection of KITTI through the demo1 of Dr. Chen's OverlapNet codes. Therefore, I would like to know the main steps of processing the ford campus data into range maps.

    opened by Bryan-ZhengRui 4
  • How to generate a three-channel depth map?

    How to generate a three-channel depth map?

    Hi, thank you very much for your work, and I admire it very much! But I generated a single-channel depth map based on gen_depth_data in your utils. How can I generate a three-channel depth map with different colors like your paper? Attached is the depth map I generated.

    000000

    opened by 2653888596 3
  • Fine Tuning and no. of epochs

    Fine Tuning and no. of epochs

    Dear Authors, Thanks for giving code for your novel method !! I have few questions:

    1. Can we fine-tune your kitti model on other datasets by making self.resume to True in this line? https://github.com/haomo-ai/OverlapTransformer/blob/da46c75eea877f46783f43b92481039e70065035/train/training_overlap_transformer_kitti.py#L60
    2. You have set max epochs to 100 in your code. But when I am doing fine-tuning(self.resume=True), then the training is starting from 20th epoch. So have you trained your kitti model for 19 epochs ?? I can't find that in paper and README. I am asking because the model is taking around 30mins for each epochs on kitti(whether fine-tuning or from scratch). So it's a bit long for training for 100 epochs.
    3. you have skipped those anchors where neg_num(no. of negative samples) are 0 for the current anchor. In my dataset, I am getting pos_num as 0 for some anchors. Hope it's fine to also skip when pos_num == 0 ? https://github.com/haomo-ai/OverlapTransformer/blob/da46c75eea877f46783f43b92481039e70065035/train/training_overlap_transformer_kitti.py#L151 @BIT-MJY @Chen-Xieyuanli
    opened by surajiitd 3
  • pretrained model to generate results in the paper

    pretrained model to generate results in the paper

    Hello, thanks for the great work!

    I download your pretrained model on kitti, generate depth data using gen_depth_data.py, and run

    python test_kitti00_prepare.py python test_kitti00_topN.py

    but I get 0.883 for Top1 and 0.950 for Top1%, which are good enough but have a little gap to the 0.906 and 0.964 in the paper.

    Could you please give me some suggestions to reproduce your results? Thanks!

    opened by mj735 3
  • Performance on 16 -beam lidar

    Performance on 16 -beam lidar

    Hi, I recently read your work on Overlap Transformers and this is a really interesting approach! I was wondering if performance on 16-beam lidars was evaluated?

    opened by Jay-Karhade 2
  • Is there a search space for evaluation on Haomo?

    Is there a search space for evaluation on Haomo?

    Hi authors,

    Really nice work!

    I have generated the results on KITTI 00 closed to the ones in your paper, but I want to know why there is no search space in the evaluation on Haomo dataset?

    opened by lqf211 2
  • Will a coarse rotation guess be provided after a place recog?

    Will a coarse rotation guess be provided after a place recog?

    Hi, Ma and Chen,

    Really nice contribution! Your released code is easy to run and queries really fast!

    Here is one request:

    From my understanding, this model provides a similarity score. Which is good enough to find old visit. But I didn't find a coarse rotation guess which is also interested in the application. Just as scancontext did.

    I would be really happy if you could give me more information about the possibility of get a coarse yaw from your model. :D

    good first issue 
    opened by Jarrome 2
  • Deploying C++ OT model on ROS

    Deploying C++ OT model on ROS

    Hello, thank you for your great work!

    Have you tried deploying the C++ OT model on ROS? I am having a hard time running the OT model with ROS Kinetic in C++. The libtorch breaks the ROS when I try to include it in my package CMakelist.txt. But this "fast_ot.cpp" works in my environment compiled by cmake.

    My Environment: Ubuntu 20.04, CUDA 11.1, Pytorch 1.10.0, Libtorch 1.8.0/1.9.0/1.10.0 (all I have tried, but with no success on ROS)

    opened by SiqianLi 4
  •  gt_valid_folder and cov_files

    gt_valid_folder and cov_files

    Hello authors,

    thank you for sharing your work!

    Is the files in gt_valid_folder generated from OverlapNet demo? And How to get the cov_file from suma++?

    I’m looking forward to hearing from you :)

    opened by smalltheater 2
Owner
HAOMO.AI
HAOMO.AI Technology Co., Ltd. (HAOMO.AI) is an artificial intelligence technology company dedicated to autonomous driving
HAOMO.AI
The official implementation of our CVPR 2021 paper - Hybrid Rotation Averaging: A Fast and Robust Rotation Averaging Approach

Graph Optimizer This repo contains the official implementation of our CVPR 2021 paper - Hybrid Rotation Averaging: A Fast and Robust Rotation Averagin

Chenyu 109 Dec 23, 2022
This repository is an open-source implementation of the ICRA 2021 paper: Locus: LiDAR-based Place Recognition using Spatiotemporal Higher-Order Pooling.

Locus This repository is an open-source implementation of the ICRA 2021 paper: Locus: LiDAR-based Place Recognition using Spatiotemporal Higher-Order

Robotics and Autonomous Systems Group 96 Dec 15, 2022
PRIN/SPRIN: On Extracting Point-wise Rotation Invariant Features

PRIN/SPRIN: On Extracting Point-wise Rotation Invariant Features Overview This repository is the Pytorch implementation of PRIN/SPRIN: On Extracting P

Yang You 17 Mar 2, 2022
The official repository for paper ''Domain Generalization for Vision-based Driving Trajectory Generation'' submitted to ICRA 2022

DG-TrajGen The official repository for paper ''Domain Generalization for Vision-based Driving Trajectory Generation'' submitted to ICRA 2022. Our Meth

Wang 25 Sep 26, 2022
Radar-to-Lidar: Heterogeneous Place Recognition via Joint Learning

radar-to-lidar-place-recognition This page is the coder of a pre-print, implemented by PyTorch. If you have some questions on this project, please fee

Huan Yin 37 Oct 9, 2022
Not All Points Are Equal: Learning Highly Efficient Point-based Detectors for 3D LiDAR Point Clouds (CVPR 2022, Oral)

Not All Points Are Equal: Learning Highly Efficient Point-based Detectors for 3D LiDAR Point Clouds (CVPR 2022, Oral) This is the official implementat

Yifan Zhang 259 Dec 25, 2022
This is the implementation of "SELF SUPERVISED REPRESENTATION LEARNING WITH DEEP CLUSTERING FOR ACOUSTIC UNIT DISCOVERY FROM RAW SPEECH" submitted to ICASSP 2022

CPC_DeepCluster This is the implementation of "SELF SUPERVISED REPRESENTATION LEARNING WITH DEEP CLUSTERING FOR ACOUSTIC UNIT DISCOVERY FROM RAW SPEEC

LEAP Lab 2 Sep 15, 2022
"MST++: Multi-stage Spectral-wise Transformer for Efficient Spectral Reconstruction" (CVPRW 2022) & (Winner of NTIRE 2022 Challenge on Spectral Reconstruction from RGB)

MST++: Multi-stage Spectral-wise Transformer for Efficient Spectral Reconstruction (CVPRW 2022) Yuanhao Cai, Jing Lin, Zudi Lin, Haoqian Wang, Yulun Z

Yuanhao Cai 274 Jan 5, 2023
[CVPR 2022] CoTTA Code for our CVPR 2022 paper Continual Test-Time Domain Adaptation

CoTTA Code for our CVPR 2022 paper Continual Test-Time Domain Adaptation Prerequisite Please create and activate the following conda envrionment. To r

Qin Wang 87 Jan 8, 2023
[IROS'21] SurRoL: An Open-source Reinforcement Learning Centered and dVRK Compatible Platform for Surgical Robot Learning

SurRoL IROS 2021 SurRoL: An Open-source Reinforcement Learning Centered and dVRK Compatible Platform for Surgical Robot Learning Features dVRK compati

Med-AIR@CUHK 55 Jan 3, 2023
Code for the RA-L (ICRA) 2021 paper "SeqNet: Learning Descriptors for Sequence-Based Hierarchical Place Recognition"

SeqNet: Learning Descriptors for Sequence-Based Hierarchical Place Recognition [ArXiv+Supplementary] [IEEE Xplore RA-L 2021] [ICRA 2021 YouTube Video]

Sourav Garg 63 Dec 12, 2022
Differentiable Factor Graph Optimization for Learning Smoothers @ IROS 2021

Differentiable Factor Graph Optimization for Learning Smoothers Overview Status Setup Datasets Training Evaluation Acknowledgements Overview Code rele

Brent Yi 60 Nov 14, 2022
Official page of Struct-MDC (RA-L'22 with IROS'22 option); Depth completion from Visual-SLAM using point & line features

Struct-MDC (click the above buttons for redirection!) Official page of "Struct-MDC: Mesh-Refined Unsupervised Depth Completion Leveraging Structural R

Urban Robotics Lab. @ KAIST 37 Dec 22, 2022
PyTorch code of my ICDAR 2021 paper Vision Transformer for Fast and Efficient Scene Text Recognition (ViTSTR)

Vision Transformer for Fast and Efficient Scene Text Recognition (ICDAR 2021) ViTSTR is a simple single-stage model that uses a pre-trained Vision Tra

Rowel Atienza 198 Dec 27, 2022
Official code of the paper "ReDet: A Rotation-equivariant Detector for Aerial Object Detection" (CVPR 2021)

ReDet: A Rotation-equivariant Detector for Aerial Object Detection ReDet: A Rotation-equivariant Detector for Aerial Object Detection (CVPR2021), Jiam

csuhan 334 Dec 23, 2022
Code for the CVPR2021 paper "Patch-NetVLAD: Multi-Scale Fusion of Locally-Global Descriptors for Place Recognition"

Patch-NetVLAD: Multi-Scale Fusion of Locally-Global Descriptors for Place Recognition This repository contains code for the CVPR2021 paper "Patch-NetV

QVPR 368 Jan 6, 2023
LiDAR R-CNN: An Efficient and Universal 3D Object Detector

LiDAR R-CNN: An Efficient and Universal 3D Object Detector Introduction This is the official code of LiDAR R-CNN: An Efficient and Universal 3D Object

TuSimple 295 Jan 5, 2023
HSC4D: Human-centered 4D Scene Capture in Large-scale Indoor-outdoor Space Using Wearable IMUs and LiDAR. CVPR 2022

HSC4D: Human-centered 4D Scene Capture in Large-scale Indoor-outdoor Space Using Wearable IMUs and LiDAR. CVPR 2022 [Project page | Video] Getting sta

null 51 Nov 29, 2022
Imposter-detector-2022 - HackED 2022 Team 3IQ - 2022 Imposter Detector

HackED 2022 Team 3IQ - 2022 Imposter Detector By Aneeljyot Alagh, Curtis Kan, Jo

Joshua Ji 3 Aug 20, 2022