mramezani64 commited on
Commit
834df91
·
verified ·
1 Parent(s): e734e5c

Upload 7 files

Browse files
.gitattributes CHANGED
@@ -57,3 +57,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
57
  # Video files - compressed
58
  *.mp4 filter=lfs diff=lfs merge=lfs -text
59
  *.webm filter=lfs diff=lfs merge=lfs -text
60
+ media/CS_Wild_Places_README.pdf filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,245 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HOTFormerLoc: Hierarchical Octree Transformer for Versatile Lidar Place Recognition Across Ground and Aerial Views
2
+
3
+ ### What's new ###
4
+ * [2025-07-31] HOTFormerLoc v1.1.0 release, fixing significant memory consumption and batch construction time in certain instances.
5
+ * [2025-03-26] Training and evaluation code released. CS-Wild-Places dataset released.
6
+
7
+ ## Description
8
+ This is the official repository for the paper:
9
+
10
+ **HOTFormerLoc: Hierarchical Octree Transformer for Versatile Lidar Place Recognition Across Ground and Aerial Views**, CVPR 2025 by *Ethan Griffiths, Maryam Haghighat, Simon Denman, Clinton Fookes, and Milad Ramezani*\
11
+ [[**Website**](https://csiro-robotics.github.io/HOTFormerLoc)] <!-- [[**Paper**](https://cvpr.thecvf.com)] --> [[**arXiv**](https://arxiv.org/abs/2503.08140)] <!-- [[**Video**](https://youtube.com)] --> [[**CS-Wild-Places Dataset**](https://data.csiro.au/collection/csiro:64896)] [[**CS-Wild-Places README**](https://github.com/csiro-robotics/HOTFormerLoc/blob/main/media/CS_Wild_Places_README.pdf)]
12
+
13
+ ![Network Architecture](media/hotformerloc_architecture.png)
14
+ *HOTFormerLoc Architecture*
15
+
16
+ We present **HOTFormerLoc**, a novel and versatile **H**ierarchical **O**ctree-based **T**rans**Former** for large-scale 3D place recognition. We propose an octree-based multi-scale attention mechanism that captures spatial and semantic features across granularities, making it suitable for both ground-to-ground and ground-to-aerial scenarios across urban and forest environments.
17
+
18
+ <!-- <img src="media/radar_plot.svg" alt="Hero Figure" width="50%" height="auto" style="float: right;"> -->
19
+
20
+ In addition, we introduce our novel dataset: [**CS-Wild-Places**](https://data.csiro.au/collection/csiro:64896), a 3D cross-source dataset featuring point cloud data from aerial and ground lidar scans captured in four dense forests. Point clouds in CS-Wild-Places contain representational gaps and distinctive attributes such as varying point densities and noise patterns, making it a challenging benchmark for cross-view localisation in the wild.
21
+
22
+ ![CS-Wild-Places](media/CSWildPlaces_overview.png)
23
+ *CS-Wild-Places dataset. (Top row) birds eye view of aerial global maps from all four forests.
24
+ (Bottom row) sample ground and aerial submap from each forest.*
25
+
26
+ Our results demonstrate that HOTFormerLoc achieves a top-1 average recall improvement of 5.5% – 11.5% on the CS-Wild-Places benchmark. Furthermore, it consistently outperforms SOTA 3D place recognition methods, with an average performance gain of 4.9% on well established urban and forest datasets.
27
+
28
+ <!-- ![Hero Figure](media/radar_plot.svg) -->
29
+ <img src="media/radar_plot.svg" alt="Hero Figure" width="50%" height="auto" style="display: block; margin: auto;">
30
+
31
+ ### Citation
32
+ If you find this work useful, please consider citing:
33
+ ```
34
+ @InProceedings{HOTFormerLoc,
35
+ author = {Griffiths, Ethan and Haghighat, Maryam and Denman, Simon and Fookes, Clinton and Ramezani, Milad},
36
+ title = {{HOTFormerLoc}: {Hierarchical Octree Transformer} for {Versatile Lidar Place Recognition Across Ground} and {Aerial Views}},
37
+ booktitle = {2025 {IEEE}/{CVF Conference} on {Computer Vision} and {Pattern Recognition} ({CVPR})},
38
+ year = {2025},
39
+ month = {June},
40
+ }
41
+ ```
42
+ <!-- month = {todo},
43
+ pages = {todo} -->
44
+
45
+ ## Environment and Dependencies
46
+ Code was tested using Python 3.11 with PyTorch 2.1.1 and CUDA 12.1 on a Linux system. We use conda to manage dependencies (although we recommend [mamba](https://mamba.readthedocs.io/en/latest/installation/mamba-installation.html) for a much faster install).
47
+
48
+ ### Installation
49
+ ```
50
+ # Note: replace 'mamba' with 'conda' if using a vanilla conda install
51
+ mamba create -n hotformerloc python=3.11 -c conda-forge
52
+ mamba activate hotformerloc
53
+ mamba install 'numpy<2.0' -c conda-forge
54
+ mamba install pytorch==2.1.1 torchvision==0.16.1 pytorch-cuda=12.1 -c pytorch -c nvidia -c conda-forge
55
+ pip install -r requirements.txt
56
+ pip install libs/dwconv
57
+ ```
58
+
59
+ Modify the `PYTHONPATH` environment variable to include the absolute path to the repository root folder (ensure this variable is set every time you open a new shell):
60
+ ```export PYTHONPATH
61
+ export PYTHONPATH=$PYTHONPATH:<path/to/HOTFormerLoc>
62
+ ```
63
+
64
+ ## Datasets
65
+
66
+ ### Wild-Places
67
+ We train on the Wild-Places dataset introduced in *Wild-Places: A Large-Scale Dataset for Lidar Place Recognition in Unstructured Natural Environments* ([link](https://arxiv.org/pdf/2211.12732)).
68
+
69
+ Download the dataset [here](https://csiro-robotics.github.io/Wild-Places/#8-Download), and place or symlink the data in `data/wild_places`.
70
+
71
+ Run the following to fix the broken timestamps in the poses files:
72
+ ```
73
+ cd datasets/WildPlaces
74
+ python fix_broken_timestamps.py \
75
+ --root '../../data/wild_places/data/' \
76
+ --csv_filename 'poses.csv' \
77
+ --csv_savename 'poses_fixed.csv' \
78
+ --cloud_folder 'Clouds'
79
+
80
+ python fix_broken_timestamps.py \
81
+ --root '../../data/wild_places/data/' \
82
+ --csv_filename 'poses_aligned.csv' \
83
+ --csv_savename 'poses_aligned_fixed.csv' \
84
+ --cloud_folder 'Clouds_downsampled'
85
+ ```
86
+
87
+ Before network training or evaluation, run the below code to generate pickles with positive and negative point clouds for each anchor point cloud:
88
+ ```
89
+ cd datasets/WildPlaces
90
+ python generate_training_tuples.py \
91
+ --root '../../data/wild_places/data/'
92
+
93
+ python generate_test_sets.py \
94
+ --root '../../data/wild_places/data/'
95
+ ```
96
+
97
+ ### CS-Wild-Places
98
+ We train on our novel CS-Wild-Places dataset, introduced in further detail in our [paper](https://arxiv.org/abs/2503.08140). CS-Wild-Places is built upon the ground traversals introduced by Wild-Places, so it is required to download the Wild-Places dataset alongside our data following the instructions in the above section (generating train/test pickles for Wild-Places is not required for CS-Wild-Places, so this step can be skipped). Note that the full Wild-Places dataset must be downloaded as our post-processing utilises the full resolution submaps.
99
+
100
+ Download our dataset from [CSIRO's data access portal](https://data.csiro.au/collection/csiro:64896), and place or symlink the data in `data/CS-Wild-Places` (this should point to the top-level directory, with the `data/` and `metadata/` subdirectories). Note that our experiments only require the post-processed submaps (folder `postproc_voxel_0.80m_rmground_normalised`), so you can ignore the raw submaps if space is an issue. Check the [README](./media/CS_Wild_Places_README.pdf) for further information and installation instructions for CS-Wild-Places.
101
+
102
+ Assuming you have followed the above instructions to setup Wild-Places, you can use the below command to post-process the Wild-Places ground submaps into the format required for CS-Wild-Places (set num_workers to a sensible number for your system). Note that this may take several hours depending on your CPU:
103
+ ```
104
+ cd datasets/CSWildPlaces
105
+ python postprocess_wildplaces_ground.py \
106
+ --root '../../data/wild_places/data/' \
107
+ --cswildplaces_save_dir '../../data/CS-Wild-Places/data/CS-Wild-Places/postproc_voxel_0.80m_rmground_normalised' \
108
+ --remove_ground \
109
+ --downsample \
110
+ --downsample_type 'voxel' \
111
+ --voxel_size 0.8 \
112
+ --normalise \
113
+ --num_workers XX \
114
+ --verbose
115
+ ```
116
+ Note that this script will generate the submaps used for the results reported in the paper, i.e. voxel downsampled, ground points removed, and normalised. We also provide a set of unnormalised submaps for convenience, and the corresponding Wild-Places ground submaps can be generated by omitting the `--normalise` option, and by setting `--cswildplaces_save_dir` to `'../../data/CS-Wild-Places/data/CS-Wild-Places/postproc_voxel_0.80m_rmground'`.
117
+
118
+ Before network training or evaluation, run the below code to generate pickles with positive and negative point clouds for each anchor point cloud:
119
+
120
+ ```
121
+ cd datasets/CSWildPlaces
122
+ python generate_train_test_tuples.py \
123
+ --root '../../data/CS-Wild-Places/data/CS-Wild-Places/postproc_voxel_0.80m_rmground_normalised/' \
124
+ --eval_thresh '30' \
125
+ --pos_thresh '15' \
126
+ --neg_thresh '60' \
127
+ --buffer_thresh '30' \
128
+ --v2_only
129
+ ```
130
+ Note that training and evaluation pickles are saved to the directory specified in `--root` by default.
131
+
132
+ ### CS-Campus3D
133
+ We train on the CS-Campus3D dataset introduced in *CrossLoc3D: Aerial-Ground Cross-Source 3D Place Recognition* ([link](https://arxiv.org/pdf/2303.17778)).
134
+
135
+ Download the dataset [here](https://drive.google.com/file/d/1yxVicykRMg_HAfZG2EQUl1R3_wxpxStd/view?usp=sharing), and place or symlink the data in `data/benchmark_datasets_cs_campus3d`.
136
+
137
+ Run the below commands to convert the CS_Campus3D train and test pickles into a suitable format for use with HOTFormerLoc.
138
+
139
+ ```
140
+ cd datasets/CSCampus3D
141
+ python save_queries_HOTFormerLoc_format.py
142
+ ```
143
+
144
+ ### Oxford RobotCar
145
+ We trained on a subset of Oxford RobotCar and the In-house (U.S., R.A., B.D.) datasets introduced in
146
+ *PointNetVLAD: Deep Point Cloud Based Retrieval for Large-Scale Place Recognition* ([link](https://arxiv.org/pdf/1804.03492)).
147
+ There are two training datasets:
148
+ - Baseline Dataset - consists of a training subset of Oxford RobotCar
149
+ - Refined Dataset - consists of training subset of Oxford RobotCar and training subset of In-house
150
+
151
+ We report results on the Baseline set in the paper.
152
+
153
+ For dataset description see the PointNetVLAD paper or github repository ([link](https://github.com/mikacuy/pointnetvlad)).
154
+
155
+ You can download the dataset from
156
+ [here](https://drive.google.com/open?id=1rflmyfZ1v9cGGH0RL4qXRrKhg-8A-U9q)
157
+ ([alternative link](https://drive.google.com/file/d/1-1HA9Etw2PpZ8zHd3cjrfiZa8xzbp41J/view?usp=sharing)), then place or symlink the data in `data/benchmark_datasets`.
158
+
159
+ Before network training or evaluation, run the below code to generate pickles with positive and negative point clouds for each anchor point cloud.
160
+
161
+ ```generate pickles
162
+ cd datasets/pointnetvlad
163
+
164
+ # Generate training tuples for the Baseline Dataset
165
+ python generate_training_tuples_baseline.py --dataset_root '../../data/benchmark_datasets'
166
+
167
+ # (Optionally) Generate training tuples for the Refined Dataset
168
+ python generate_training_tuples_refine.py --dataset_root '../../data/benchmark_datasets'
169
+
170
+ # Generate evaluation tuples
171
+ python generate_test_sets.py --dataset_root '../../data/benchmark_datasets'
172
+ ```
173
+
174
+ ## Training
175
+ To train **HOTFormerLoc**, download the datasets and generate training pickles as described above for any dataset you wish to train on.
176
+ The configuration files for each dataset can be found in `config/`.
177
+ Set the `dataset_folder` parameter to the dataset root folder (only necessary if you have issues with the default relative path).
178
+ If running out of GPU memory, decrease `batch_split_size` and `val_batch_size` parameter value. If running out of RAM, you may need to decrease the `batch_size` parameter or try reducing `num_workers` to 1, but note that a smaller batch size may slightly reduce performance. We use wandb for logging by default, but this can be disabled in the config.
179
+
180
+ To train the network, run:
181
+
182
+ ```
183
+ cd training
184
+
185
+ # To train HOTFormerLoc on CS-Wild-Places
186
+ python train.py --config ../config/config_cs-wild-places.txt --model_config ../models/hotformerloc_cs-wild-places_cfg.txt
187
+
188
+ # To train HOTFormerLoc on Wild-Places
189
+ python train.py --config ../config/config_wild-places.txt --model_config ../models/hotformerloc_wild-places_cfg.txt
190
+
191
+ # To train HOTFormerLoc on CS-Campus3D
192
+ python train.py --config ../config/config_cs-campus3d.txt --model_config ../models/hotformerloc_cs-campus3d_cfg.txt
193
+
194
+ # To train HOTFormerLoc on Oxford RobotCar
195
+ python train.py --config ../config/config_oxford.txt --model_config ../models/hotformerloc_oxford_cfg.txt
196
+ ```
197
+
198
+ If training on a SLURM cluster, we provide the `submitit_train_job_single_node.py` script to automate training job submission, with support for automatic checkpointing and resubmission on job timeout. Make sure to set job parameters appropriately for your cluster.
199
+
200
+ ### Pre-trained Weights
201
+
202
+ Pre-trained weights for HOTFormerLoc and other experiments can be downloaded and placed in the `weights` directory. You can download them individually below, or download and extract all from [this link](https://www.dropbox.com/scl/fi/qjyh966styqlye38a4c37/pretrained_weights.tar.gz?rlkey=qkuhupf3og7mfkfid8dts7xej&st=wx8q2v68&dl=0).
203
+ | Model | Dataset | Weights Download |
204
+ |--------------|-----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
205
+ | HOTFormerLoc | CS-Wild-Places | [hotformerloc_cs-wild-places.pth](https://www.dropbox.com/scl/fi/bcgcmbyic591f3bviib64/hotformerloc_cs-wild-places.pth?rlkey=vrw0seq6nfbsihijbhqatll2u&st=d7enawjw&dl=0) |
206
+ | HOTFormerLoc | CS-Campus3D | [hotformerloc_cs-campus3D.pth](https://www.dropbox.com/scl/fi/l9jyn5310gjf80zw35v7z/hotformerloc_cs-campus3d.pth?rlkey=s0bpcysyc1xt2357shhclpnlw&st=zhh679b9&dl=0) |
207
+ | HOTFormerLoc | Wild-Places | [hotformerloc_wild-places.pth](https://www.dropbox.com/scl/fi/yd94iy9dq6k1m312ifnyx/hotformerloc_wild-places.pth?rlkey=5ndv0p48c7hyjvah90eab1l1e&st=zl1716hh&dl=0) |
208
+ | HOTFormerLoc | Oxford RobotCar | [hotformerloc_oxford.pth](https://www.dropbox.com/scl/fi/4r3470zo9zomkyjys5nrm/hotformerloc_oxford.pth?rlkey=eocfo3yvmhuqqgsmjtypgf78s&st=ybhzcj6y&dl=0) |
209
+ | MinkLoc3Dv2 | CS-Wild-Places | [minkloc3dv2_cs-wild-places.pth](https://www.dropbox.com/scl/fi/2w4l8gv7qbmp0lh4eztsf/minkloc3dv2_cs-wild-places.pth?rlkey=udxvtkr6yfgdnyizra4gmw0qa&st=p0evrh61&dl=0) |
210
+ | CrossLoc3D | CS-Wild-Places | [crossloc3d_cs-wild-places.pth](https://www.dropbox.com/scl/fi/5ikt1jvr2fabiaw8mhqbb/crossloc3d_cs-wild-places.pth?rlkey=lb4gp2n814im3twy4zy5d67bd&st=znup5ewi&dl=0) |
211
+ | LoGG3D-Net | CS-Wild-Places | [logg3dnet_cs-wild-places.pth](https://www.dropbox.com/scl/fi/51se5akdyg35xy2dsrosj/logg3dnet_cs-wild-places.pth?rlkey=4nvvp8gw656wdbj3081jzcn0i&st=n5ytpnzc&dl=0) |
212
+
213
+ ## Evaluation
214
+
215
+ To evaluate the pretrained models run the following commands:
216
+
217
+ ```
218
+ cd eval
219
+
220
+ # To evaluate HOTFormerLoc trained on CS-Wild-Places
221
+ python pnv_evaluate.py --config ../config/config_cs-wild-places.txt --model_config ../models/hotformerloc_cs-wild-places_cfg.txt --weights ../weights/hotformerloc_cs-wild-places.pth
222
+
223
+ # To evaluate HOTFormerLoc trained on Wild-Places
224
+ python pnv_evaluate.py --config ../config/config_wild-places.txt --model_config ../models/hotformerloc_wild-places_cfg.txt --weights ../weights/hotformerloc_wild-places.pth
225
+
226
+ # To evaluate HOTFormerLoc trained on CS-Campus3D
227
+ python pnv_evaluate.py --config ../config/config_cs-campus3d.txt --model_config ../models/hotformerloc_cs-campus3d_cfg.txt --weights ../weights/hotformerloc_cs-campus3d.pth
228
+
229
+ # To evaluate HOTFormerLoc trained on Oxford RobotCar
230
+ python pnv_evaluate.py --config ../config/config_oxford.txt --model_config ../models/hotformerloc_oxford_cfg.txt --weights ../weights/hotformerloc_oxford.pth
231
+ ```
232
+
233
+ Below are the results for all evaluated models on CS-Wild-Places:
234
+
235
+ ![CS-Wild-Places_baseline](media/dataset_cswp_baseline.png)
236
+ *Comparison of SOTA on CS-Wild-Places Baseline evaluation set.*
237
+
238
+ ![CS-Wild-Places_unseen](media/dataset_cswp_unseen.png)
239
+ *Comparison of SOTA on CS-Wild-Places Unseen evaluation set.*
240
+
241
+ See the paper for full results and comparison with SOTA on all datasets.
242
+
243
+ ## Acknowledgements
244
+
245
+ Special thanks to the authors of [MinkLoc3Dv2](https://github.com/jac99/MinkLoc3Dv2) and [OctFormer](https://github.com/octree-nn/octformer) for their excellent code, which formed the foundation of this codebase. We would also like to thank the authors of [Wild-Places](https://csiro-robotics.github.io/Wild-Places/) for their fantastic dataset which serves as the base that CS-Wild-Places is built upon.
media/CSWildPlaces_overview.png ADDED

Git LFS Details

  • SHA256: cb0a960e271f86dcfcd89ff90791552e33bf6f0ba575cfafda0218d4f6d2760f
  • Pointer size: 132 Bytes
  • Size of remote file: 6.91 MB
media/CS_Wild_Places_README.pdf ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:64635a1575203bab6553cd0935888639eb0080e7b4b89f31803b13109663763e
3
+ size 8727600
media/dataset_cswp_baseline.png ADDED

Git LFS Details

  • SHA256: d10709ef5b117d2c006486b52cfbdbc359b21cda85039d20b9f0128a53a69672
  • Pointer size: 130 Bytes
  • Size of remote file: 62.6 kB
media/dataset_cswp_unseen.png ADDED

Git LFS Details

  • SHA256: 7d52b797bd34d53fc844dc709d9134d7e18b4b4ce2283262c9c9824a8f7bec41
  • Pointer size: 130 Bytes
  • Size of remote file: 63.4 kB
media/hotformerloc_architecture.png ADDED

Git LFS Details

  • SHA256: f1d6c57aada7796b6fadf4a91d09c9c9adb1e2f03ab674ef4414a13d9bc6d936
  • Pointer size: 131 Bytes
  • Size of remote file: 372 kB
media/radar_plot.svg ADDED