Skip to content

Commit dd3f774

Browse files
committed
feat(data): update waymo process script.
scripts from running exp on our new SSL method SeFlow
1 parent 3b5442e commit dd3f774

File tree

5 files changed

+562
-27
lines changed

5 files changed

+562
-27
lines changed

README.md

+14-5
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@ DeFlow: Decoder of Scene Flow Network in Autonomous Driving
55
[![PWC](https://img.shields.io/endpoint.svg?url=https://paperswithcode.com/badge/deflow-decoder-of-scene-flow-network-in/scene-flow-estimation-on-argoverse-2)](https://paperswithcode.com/sota/scene-flow-estimation-on-argoverse-2?p=deflow-decoder-of-scene-flow-network-in)
66
[![poster](https://img.shields.io/badge/ICRA24|Poster-6495ed?style=flat&logo=Shotcut&logoColor=wihte)](https://hkustconnect-my.sharepoint.com/:b:/g/personal/qzhangcb_connect_ust_hk/EXP_uXYmm_tItTWc8MafXHoB-1dVrMnvF1-lCzU1PXAvqQ?e=2FPfBS)
77
[![video](https://img.shields.io/badge/video-YouTube-FF0000?logo=youtube&logoColor=white)](https://youtu.be/bZ4uUv0nDa0)
8+
[![blog](https://img.shields.io/badge/Blog%7C%E7%9F%A5%E4%B9%8E%E4%B8%AD%E6%96%87-1772f6?style=flat&logo=Shotcut)](https://zhuanlan.zhihu.com/p/706514747)
89

910
Task: Scene Flow Estimation in Autonomous Driving.
1011

1112
🔥 2024/07/02: Check the self-supervised version in our new ECCV'24 [SeFlow](https://github.com/KTH-RPL/SeFlow). The 1st ranking in new leaderboard among self-supervise methods.
1213

13-
Pre-trained weights for models are available in [Zenodo](https://zenodo.org/records/12173874) or [Onedrive link](https://hkustconnect-my.sharepoint.com/:f:/g/personal/qzhangcb_connect_ust_hk/Et85xv7IGMRKgqrVeJEVkMoB_vxlcXk6OZUyiPjd4AArIg?e=lqRGhx).
14+
Pre-trained weights for models are available in [Zenodo](https://zenodo.org/records/12632962) or [Onedrive link](https://hkustconnect-my.sharepoint.com/:f:/g/personal/qzhangcb_connect_ust_hk/Et85xv7IGMRKgqrVeJEVkMoB_vxlcXk6OZUyiPjd4AArIg?e=lqRGhx).
1415
Check usage in [2. Evaluation](#2-evaluation) or [3. Visualization](#3-visualization).
1516

1617
**Scripts** quick view in our scripts:
1718

1819
- `dataprocess/extract_*.py` : pre-process data before training to speed up the whole training time.
19-
[Dataset we included now: Argoverse 2, more on the way: Waymo and Nuscenes, custom data.]
20+
[Dataset we included now: Argoverse 2 and Waymo, more on the way: Nuscenes, custom data.]
2021

2122
- `1_train.py`: Train the model and get model checkpoints. Pls remember to check the config.
2223

@@ -77,7 +78,9 @@ python 1_train.py model=fastflow3d lr=2e-6 epochs=50 batch_size=16
7778
python 1_train.py model=deflow lr=2e-6 epochs=50 batch_size=16
7879
```
7980

80-
To help community benchmarking, we provide our weights including fastflow3d, deflow [Onedrive link](https://hkustconnect-my.sharepoint.com/:f:/g/personal/qzhangcb_connect_ust_hk/Et85xv7IGMRKgqrVeJEVkMoB_vxlcXk6OZUyiPjd4AArIg?e=lqRGhx). These checkpoints also include parameters and status of that epoch inside it. If you are interested in weights of ablation studies, please contact us.
81+
To help community benchmarking, we provide our weights including fastflow3d, deflow [Zendo](https://zenodo.org/records/12632962).
82+
These checkpoints also include parameters and status of that epoch inside it. If you are interested in weights of ablation studies, please contact us.
83+
Note: Please use these weights by following the term of use of the trained dataset (since weights are trained on these datasets) as [Argoverse 2 Term of Use](https://www.argoverse.org/about.html) mentioned: Using it under Non-Commercially (CC BY-NC-SA 4.0).
8184

8285
## 2. Evaluation
8386

@@ -88,7 +91,7 @@ You can view Wandb dashboard for the training and evaluation results or [run/sub
8891
Since in training, we save all hyper-parameters and model checkpoints, the only thing you need to do is to specify the checkpoint path. Remember to set the data path correctly also.
8992
```bash
9093
# downloaded pre-trained weight, or train by yourself
91-
wget https://zenodo.org/records/12173874/files/deflow_best.ckpt
94+
wget https://zenodo.org/records/12632962/files/deflow_best.ckpt
9295

9396
python 2_eval.py checkpoint=/home/kin/deflow_best.ckpt av2_mode=val # it will directly prints all metric
9497
# it will output the av2_submit.zip or av2_submit_v2.zip for you to submit to leaderboard
@@ -121,7 +124,7 @@ We provide a script to visualize the results of the model. You can specify the c
121124

122125
```bash
123126
# downloaded pre-trained weight, or train by yourself
124-
wget https://zenodo.org/records/12173874/files/deflow_best.ckpt
127+
wget https://zenodo.org/records/12632962/files/deflow_best.ckpt
125128

126129
python 3_vis.py checkpoint=/home/kin/deflow_best.ckpt dataset_path=/home/kin/data/av2/preprocess/sensor/vis
127130

@@ -153,6 +156,12 @@ https://github.com/KTH-RPL/DeFlow/assets/35365764/9b265d56-06a9-4300-899c-96047a
153156
journal={arXiv preprint arXiv:2401.16122},
154157
year={2024}
155158
}
159+
@article{zhang2024seflow,
160+
author={Zhang, Qingwen and Yang, Yi and Li, Peizheng and Andersson, Olov and Jensfelt, Patric},
161+
title={SeFlow: A Self-Supervised Scene Flow Method in Autonomous Driving},
162+
journal={arXiv preprint arXiv:2407.01702},
163+
year={2024}
164+
}
156165
```
157166

158167
This implementation is based on codes from several repositories. Thanks to these authors who kindly open-sourcing their work to the community. Please see our paper reference part to get more information.

dataprocess/README.md

+32-4
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ README for downloading and preprocessing the dataset. We includes waymo, argover
88

99
We've updated the process dataset for:
1010

11-
- [x] Argoverse 2.0: check [here](#argoverse-20). Involved from DeFlow
12-
- [ ] Waymo: done coding, public after review. Will be involved later by another paper.
11+
- [x] Argoverse 2.0: check [here](#argoverse-20). The process script Involved from [DeFlow](https://github.com/KTH-RPL/DeFlow).
12+
- [x] Waymo: check [here](#waymo-dataset). The process script was involved from [SeFlow](https://github.com/KTH-RPL/SeFlow).
1313
- [ ] nuScenes: done coding, public after review. Will be involved later by another paper.
1414

1515
## Download
@@ -83,13 +83,39 @@ gsutil -m cp -r "gs://waymo_open_dataset_scene_flow/valid" .
8383
gsutil -m cp -r "gs://waymo_open_dataset_scene_flow/train" .
8484
```
8585

86+
And flowlabel data can be downloaded here with ground segmentation by HDMap follow the same style of [ZeroFlow](https://github.com/kylevedder/zeroflow/blob/master/data_prep_scripts/waymo/extract_flow_and_remove_ground.py).
87+
88+
You can download the processed map folder here to free yourself downloaded another type of data again:
89+
90+
```bash
91+
wget https://zenodo.org/records/12632962/files/waymo_map.tar.gz
92+
tar -xvf waymo_map.tar.gz -C /home/kin/data/waymo/flowlabel
93+
# you will see there is a `map` folder in the `flowlabel` folder now.
94+
```
95+
96+
#### Dataset frames
97+
98+
| Dataset | # Total Scene | # Total Frames |
99+
| ------- | ------------- | -------------- |
100+
| train | 799 | 155687 |
101+
| val | 203 | 39381 |
102+
86103
## Process
87104
This directory contains the scripts to preprocess the datasets.
88105

89106
- `extract_av2.py`: Process the datasets in Argoverse 2.0.
90107
- `extract_nus.py`: Process the datasets in nuScenes.
91108
- `extract_waymo.py`: Process the datasets in Waymo.
92109

110+
Example Running command:`
111+
```bash
112+
# av2:
113+
python dataprocess/extract_av2.py --av2_type sensor --data_mode train --argo_dir /home/kin/data/av2 --output_dir /home/kin/data/av2/preprocess
114+
115+
# waymo:
116+
python dataprocess/extract_waymo.py --mode train --flow_data_dir /home/kin/data/waymo/flowlabel --map_dir /home/kin/data/waymo/flowlabel/map --output_dir /home/kin/data/waymo/preprocess --nproc 48
117+
```
118+
93119
All these preprocess scripts will generate the same format `.h5` file. The file contains the following in codes:
94120

95121
File: `[*:logid].h5` file named in logid. Every timestamp is the key of group (f[key]).
@@ -120,6 +146,8 @@ After preprocessing, all data can use the same dataloader to load the data. As a
120146
Or you can run testing file to visualize the data.
121147

122148
```bash
123-
python3 tests/preview_data.py --data_dir /home/kin/data/av2/preprocess/sensor/mini
124-
python3 tests/preview_data.py --data_dir /home/kin/data/nuScenes/preprocess/v1.0-mini
149+
# view gt flow
150+
python3 tests/scene_flow.py --data_dir /home/kin/data/av2/preprocess/sensor/mini --flow_mode flow
151+
152+
python3 tests/scene_flow.py --data_dir /home/kin/data/waymo/preprocess/val --flow_mode flow
125153
```

dataprocess/extract_av2.py

+5-18
Original file line numberDiff line numberDiff line change
@@ -35,30 +35,17 @@
3535
from zipfile import ZipFile
3636
import pandas as pd
3737

38+
import os, sys
39+
BASE_DIR = os.path.abspath(os.path.join( os.path.dirname( __file__ ), '..' ))
40+
sys.path.append(BASE_DIR)
41+
from scripts.utils.mics import create_reading_index
42+
3843
BOUNDING_BOX_EXPANSION: Final = 0.2
3944
CATEGORY_TO_INDEX: Final = {
4045
**{"NONE": 0},
4146
**{k.value: i + 1 for i, k in enumerate(AnnotationCategories)},
4247
}
4348

44-
def create_reading_index(data_dir: Path):
45-
start_time = time.time()
46-
data_index = []
47-
for file_name in tqdm(os.listdir(data_dir), ncols=100, desc='Create reading index'):
48-
if not file_name.endswith(".h5"):
49-
continue
50-
scene_id = file_name.split(".")[0]
51-
timestamps = []
52-
with h5py.File(data_dir/file_name, 'r') as f:
53-
timestamps.extend(f.keys())
54-
timestamps.sort(key=lambda x: int(x)) # make sure the timestamps are in order
55-
for timestamp in timestamps:
56-
data_index.append([scene_id, timestamp])
57-
58-
with open(data_dir/'index_total.pkl', 'wb') as f:
59-
pickle.dump(data_index, f)
60-
print(f"Create reading index Successfully, cost: {time.time() - start_time:.2f} s")
61-
6249
def create_eval_mask(data_mode: str, output_dir_: Path, mask_dir: str):
6350
"""
6451
Need download the official mask file run: `s5cmd --no-sign-request cp "s3://argoverse/tasks/3d_scene_flow/zips/*" .`

0 commit comments

Comments
 (0)