Skip to content

Commit e089267

Browse files
authored
Fix scene flow ground truth generation in Argoverse 2 (#5)
* !fix(gt): expanding the bbx based on object speed for non-ego motion distortion in data. check more details on the pull request description. * docs(README): fix typo on readme and comments in code. * tested successfully on docker things also. * fix(env): add c++ compiler into env and pathtools for potential err on run codes. * docs(bib): add himo into cite for reference on fixed flow gt.
1 parent f7e59aa commit e089267

File tree

7 files changed

+73
-19
lines changed

7 files changed

+73
-19
lines changed

Dockerfile

-1
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,3 @@ RUN apt-get update && apt-get install libgl1 -y
3232
RUN cd /home/kin/workspace/OpenSceneFlow && /opt/conda/bin/mamba env create -f environment.yaml
3333
RUN cd /home/kin/workspace/OpenSceneFlow/assets/cuda/mmcv && /opt/conda/envs/opensf/bin/python ./setup.py install
3434
RUN cd /home/kin/workspace/OpenSceneFlow/assets/cuda/chamfer3D && /opt/conda/envs/opensf/bin/python ./setup.py install
35-

README.md

+34-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</p>
66

77
OpenSceneFlow is a codebase for point cloud scene flow estimation.
8-
It is also an official implementation of the following paper (sored by the time of publication):
8+
It is also an official implementation of the following papers (sored by the time of publication):
99

1010
- **Flow4D: Leveraging 4D Voxel Network for LiDAR Scene Flow Estimation**
1111
*Jaeyeul Kim, Jungwan Woo, Ukcheol Shin, Jean Oh, Sunghoon Im*
@@ -28,9 +28,10 @@ International Conference on Robotics and Automation (**ICRA**) 2024
2828
[ Backbone ] [ Supervised ] - [ [arXiv](https://arxiv.org/abs/2401.16122) ] [ [Project](https://github.com/KTH-RPL/DeFlow) ] &rarr; [here](#deflow)
2929

3030

31-
💞 If you find *OpenSceneFlow* useful to your research, please cite [our works 📖](#cite-us) and give a star 🌟 as encouragement. (੭ˊ꒳​ˋ)੭✧
31+
💞 If you find *OpenSceneFlow* useful to your research, please cite [**our works** 📖](#cite-us) and give a star 🌟 as encouragement. (੭ˊ꒳​ˋ)੭✧
3232

33-
🎁 <b>One repository, All methods!</b>. Additionally, *OpenSceneFlow* integrates the following excellent work: [ICLR'24 ZeroFlow](https://arxiv.org/abs/2305.10424), [ICCV'23 FastNSF](https://arxiv.org/abs/2304.09121), [RA-L'21 FastFlow](https://arxiv.org/abs/2103.01306), [NeurIPS'21 NSFP](https://arxiv.org/abs/2111.01253),
33+
🎁 <b>One repository, All methods!</b>
34+
Additionally, *OpenSceneFlow* integrates following excellent works: [ICLR'24 ZeroFlow](https://arxiv.org/abs/2305.10424), [ICCV'23 FastNSF](https://arxiv.org/abs/2304.09121), [RA-L'21 FastFlow](https://arxiv.org/abs/2103.01306), [NeurIPS'21 NSFP](https://arxiv.org/abs/2111.01253). (More on the way...)
3435

3536
<details> <summary> Summary of them:</summary>
3637

@@ -42,7 +43,7 @@ International Conference on Robotics and Automation (**ICRA**) 2024
4243

4344
</details>
4445

45-
💡: Want to learn how to add your own network in this structure? Check [Contribute section] and know more about the code. Fee free to pull request and your bibtex [here](#cite-us) by pull request.
46+
💡: Want to learn how to add your own network in this structure? Check [Contribute section](assets/README.md#contribute) and know more about the code. Fee free to pull request and your bibtex [here](#cite-us) by pull request.
4647

4748
---
4849

@@ -56,23 +57,29 @@ International Conference on Robotics and Automation (**ICRA**) 2024
5657

5758
## 0. Installation
5859

59-
**Environment**: Setup
60+
There are two ways to install the codebase: directly on your [local machine](#environment-setup) or in a [Docker container](#docker-recommended-for-isolation).
61+
62+
### Environment Setup
6063

6164
```bash
6265
git clone --recursive https://github.com/KTH-RPL/OpenSceneFlow.git
6366
cd OpenSceneFlow && mamba env create -f environment.yaml
67+
68+
# You may need export your LD_LIBRARY_PATH with env lib
69+
# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/kin/mambaforge/lib
6470
```
6571

66-
CUDA package (need install nvcc compiler), the compile time is around 1-5 minutes:
72+
CUDA package (we already install nvcc compiler inside conda env), the compile time is around 1-5 minutes:
6773
```bash
6874
mamba activate opensf
6975
# CUDA already install in python environment. I also tested others version like 11.3, 11.4, 11.7, 11.8 all works
7076
cd assets/cuda/mmcv && python ./setup.py install && cd ../../..
7177
cd assets/cuda/chamfer3D && python ./setup.py install && cd ../../..
7278
```
7379

74-
Or you always can choose [Docker](https://en.wikipedia.org/wiki/Docker_(software)) which isolated environment and free yourself from installation, you can pull it by.
75-
If you have different arch, please build it by yourself `cd OpenSceneFlow && docker build -t zhangkin/opensf` by going through [build-docker-image](assets/README.md#build-docker-image) section.
80+
### Docker (Recommended for Isolation)
81+
82+
You always can choose [Docker](https://en.wikipedia.org/wiki/Docker_(software)) which isolated environment and free yourself from installation. Pull the pre-built Docker image or build manually.
7683

7784
```bash
7885
# option 1: pull from docker hub
@@ -83,25 +90,36 @@ docker run -it --gpus all -v /dev/shm:/dev/shm -v /home/kin/data:/home/kin/data
8390
# and better to read your own gpu device info to compile the cuda extension again:
8491
cd /home/kin/workspace/OpenSceneFlow/assets/cuda/mmcv && /opt/conda/envs/opensf/bin/python ./setup.py install
8592
cd /home/kin/workspace/OpenSceneFlow/assets/cuda/chamfer3D && /opt/conda/envs/opensf/bin/python ./setup.py install
93+
94+
mamba activate opensf
8695
```
8796

97+
If you prefer to build the Docker image by yourself, Check [build-docker-image](assets/README.md#build-docker-image) section for more details.
8898

8999
## 1. Data Preparation
90100

91101
Refer to [dataprocess/README.md](dataprocess/README.md) for dataset download instructions. Currently, we support **Argoverse 2**, **Waymo**, and **custom datasets** (more datasets will be added in the future).
92102

93-
After downloading, convert the raw data to `.h5` format for easy training, evaluation, and visualization. Follow the steps in [dataprocess/README.md#process](dataprocess/README.md#process). For a quick start, use our **mini processed dataset**, which includes one scene in `train` and `val`. It is pre-converted to `.h5` format with label data ([Zenodo](https://zenodo.org/records/13744999/files/demo_data.zip)/[HuggingFace](https://huggingface.co/kin-zhang/OpenSceneFlow/blob/main/demo_data.zip)).
103+
After downloading, convert the raw data to `.h5` format for easy training, evaluation, and visualization. Follow the steps in [dataprocess/README.md#process](dataprocess/README.md#process).
104+
105+
For a quick start, use our **mini processed dataset**, which includes one scene in `train` and `val`. It is pre-converted to `.h5` format with label data ([Zenodo](https://zenodo.org/records/13744999/files/demo_data.zip)/[HuggingFace](https://huggingface.co/kin-zhang/OpenSceneFlow/blob/main/demo_data.zip)).
94106

95107

96108
```bash
97109
wget https://huggingface.co/kin-zhang/OpenSceneFlow/resolve/main/demo_data.zip
98-
unzip demo_data.zip -p /home/kin/data/av2
110+
unzip demo_data.zip -d /home/kin/data/av2/h5py
99111
```
100112

101113
Once extracted, you can directly use this dataset to run the [training script](#2-quick-start) without further processing.
102114

103115
## 2. Quick Start
104116

117+
Don't forget to active Python environment before running the code.
118+
119+
```bash
120+
mamba activate opensf
121+
```
122+
105123
### Flow4D
106124

107125
Train Flow4D with the leaderboard submit config. [Runtime: Around 18 hours in 4x RTX 3090 GPUs.]
@@ -225,6 +243,12 @@ https://github.com/user-attachments/assets/07e8d430-a867-42b7-900a-11755949de21
225243
pages={2105-2111},
226244
doi={10.1109/ICRA57147.2024.10610278}
227245
}
246+
@article{zhang2025himu,
247+
title={HiMo: High-Speed Objects Motion Compensation in Point Cloud},
248+
author={Zhang, Qingwen and Khoche, Ajinkya and Yang, Yi and Ling, Li and Sina, Sharif Mansouri and Andersson, Olov and Jensfelt, Patric},
249+
year={2025},
250+
journal={arXiv preprint arXiv:2503.00803},
251+
}
228252
```
229253

230254
And our excellent collaborators works as followings:

conf/save.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
dataset_path: /home/kin/data/av2/preprocess_v2/demo/sensor/val
1+
dataset_path: /home/kin/data/av2/h5py/demo/sensor/val
22
checkpoint: /home/kin/model_zoo/seflow_best.ckpt
33
res_name: # if None will directly be the `model_name.ckpt` in checkpoint path
44

dataprocess/extract_av2.py

+33-6
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import pickle
3636
from zipfile import ZipFile
3737
import pandas as pd
38+
from copy import deepcopy
3839

3940
import os, sys
4041
BASE_DIR = os.path.abspath(os.path.join( os.path.dirname( __file__ ), '..' ))
@@ -132,23 +133,49 @@ def compute_flow(sweeps, cuboids, poses):
132133
valid = np.ones(len(sweeps[0].xyz), dtype=np.bool_)
133134
# classes = -np.ones(len(sweeps[0].xyz), dtype=np.int8)
134135
classes = np.zeros(len(sweeps[0].xyz), dtype=np.uint8)
136+
137+
# # old version
138+
# for id in cuboids[0]:
139+
# c0 = cuboids[0][id]
140+
# c0.length_m += BOUNDING_BOX_EXPANSION # the bounding boxes are a little too tight and some points are missed
141+
# c0.width_m += BOUNDING_BOX_EXPANSION
142+
# obj_pts, obj_mask = c0.compute_interior_points(sweeps[0].xyz)
143+
# classes[obj_mask] = CATEGORY_TO_INDEX[str(c0.category)]
135144

145+
# if id in cuboids[1]:
146+
# c1 = cuboids[1][id]
147+
# c1_SE3_c0 = c1.dst_SE3_object.compose(c0.dst_SE3_object.inverse())
148+
# obj_flow = c1_SE3_c0.transform_point_cloud(obj_pts) - obj_pts
149+
# flow[obj_mask] = obj_flow.astype(np.float32)
150+
# else:
151+
# valid[obj_mask] = 0
152+
153+
# NOTE(HiMo): box expansion based on the object velocity
154+
# check more detail: https://kin-zhang.github.io/HiMo
136155
for id in cuboids[0]:
137-
c0 = cuboids[0][id]
138-
c0.length_m += BOUNDING_BOX_EXPANSION # the bounding boxes are a little too tight and some points are missed
139-
c0.width_m += BOUNDING_BOX_EXPANSION
156+
c0 = deepcopy(cuboids[0][id])
140157
obj_pts, obj_mask = c0.compute_interior_points(sweeps[0].xyz)
141-
classes[obj_mask] = CATEGORY_TO_INDEX[str(c0.category)]
142-
143158
if id in cuboids[1]:
144159
c1 = cuboids[1][id]
160+
c1_SE3_c0_ego_frame = ego1_SE3_ego0.inverse().compose(c1.dst_SE3_object.compose(c0.dst_SE3_object.inverse()))
161+
rel_obj_flow = c1_SE3_c0_ego_frame.transform_point_cloud(obj_pts) - obj_pts
162+
delta_move = abs(np.linalg.norm(rel_obj_flow, axis=0).mean())
163+
164+
if delta_move > 0.04: # only when it's moving
165+
c0 = cuboids[0][id]
166+
c0.length_m += (BOUNDING_BOX_EXPANSION + min(delta_move/2, 2)) # since 180/360 for two LiDARs orientation
167+
c0.width_m += BOUNDING_BOX_EXPANSION
168+
c0.height_m += BOUNDING_BOX_EXPANSION
169+
obj_pts, obj_mask = c0.compute_interior_points(sweeps[0].xyz)
170+
171+
# NOTE(Qingwen): after expansion, we need to recompute the flow
145172
c1_SE3_c0 = c1.dst_SE3_object.compose(c0.dst_SE3_object.inverse())
146173
obj_flow = c1_SE3_c0.transform_point_cloud(obj_pts) - obj_pts
174+
classes[obj_mask] = CATEGORY_TO_INDEX[str(c0.category)]
147175
flow[obj_mask] = obj_flow.astype(np.float32)
148176
else:
149177
valid[obj_mask] = 0
150178
return flow, classes, valid, ego1_SE3_ego0
151-
152179
sweeps = [Sweep.from_feather(data_dir / log_id / "sensors" / "lidar" / f"{ts}.feather") for ts in timestamps]
153180

154181
# ================== Load annotations ==================

environment.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ dependencies:
2626
- scikit-learn==1.3.2
2727
- hdbscan
2828
- setuptools==69.5.1
29+
- gxx_linux-64==11.4.0
30+
- pathtools
2931
- pip:
3032
- open3d==0.18.0
3133
- dztimer

src/models/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
# If you find this repo helpful, please cite the respective publication as
88
# listed on the above website.
99
"""
10+
import warnings
11+
warnings.simplefilter(action="ignore", category=FutureWarning)
1012

1113
from .deflow import DeFlow
1214
from .fastflow3d import FastFlow3D

tools/visualization.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def check_flow(
6969

7070
def vis(
7171
data_dir: str ="/home/kin/data/av2/preprocess/sensor/mini",
72-
res_name: str = "flow", # "flow", "flow_est"
72+
res_name: str = "flow", # any res_name we write before in HDF5Data
7373
start_id: int = 0,
7474
point_size: float = 2.0,
7575
mode: str = "vis",

0 commit comments

Comments
 (0)