Skip to content

Commit 45f1185

Browse files
committed
womd-prediction
1 parent 5447137 commit 45f1185

File tree

104 files changed

+12649
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

104 files changed

+12649
-4
lines changed

README.md

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
<h1 align="center"> BeTop: Reasoning Multi-Agent Behavioral Topology
22
for Interactive Autonomous Driving </h1>
33

4+
<div align="center">
5+
6+
[![arXiv](https://img.shields.io/badge/arXiv-2409.18031-479ee2.svg)](https://arxiv.org/abs/2409.18031)
7+
8+
</div>
9+
10+
411
<div id="top" align="center">
512
<p align="center">
613
<img src="assets/betop_teaser.png" width="1000px" >
714
</p>
815
</div>
916

10-
> [Haochen Liu](https://scholar.google.com/citations?user=iizqKUsAAAAJ&hl), [Li Chen](https://scholar.google.com/citations?user=ulZxvY0AAAAJ&hl=zh-CN), [Yu Qiao](https://scholar.google.com/citations?user=gFtI-8QAAAAJ&hl=zh-CN&inst=8669986779262753491&oi=ao), [Chen Lv](https://scholar.google.com/citations?user=UKVs2CEAAAAJ&hl=zh-CN&inst=8669986779262753491&oi=ao) and [Hongyang Li](https://scholar.google.com/citations?user=Hfrih1EAAAAJ&hl=zh-CN&inst=8669986779262753491&oi=ao)
17+
> - [Haochen Liu](https://scholar.google.com/citations?user=iizqKUsAAAAJ&hl), [Li Chen](https://scholar.google.com/citations?user=ulZxvY0AAAAJ&hl=zh-CN), Yu Qiao, Chen Lv and Hongyang Li
18+
> - [arXiv paper](https://arxiv.org/abs/2409.18031) | Slides TODO
19+
> - If you have any questions, please feel free to contact: *Haochen Liu* ( [email protected] )
1120
1221
<!-- > 📜 Preprint: <a href="https://arxiv.org/abs/2409.09016"><img src="https://img.shields.io/badge/arXiv-Paper-<color>"></a> -->
1322

23+
---
24+
25+
**[2024-11]** Prediction project released.
1426

1527
Full code and checkpoints release is coming soon. Please stay tuned.
1628

@@ -32,12 +44,37 @@ The synergetic framework, *BeTopNet*, integrates topology reasoning with predict
3244
</p>
3345
</div>
3446

35-
## TODO list
47+
## Get Started
48+
49+
### Prediction
50+
51+
We provide the full prediction implementation of BeTopNet in Waymo Open Motion Dataset (WOMD).
52+
53+
**Features:**
54+
- :white_check_mark: Full support for WOMD Prediction Challenges
55+
- :white_check_mark: Flexible Toolbox for prediction tasks
56+
- :white_check_mark: Pipeline for reproduced popular Baselines
57+
58+
**[Guideline](womd/README.md)**
59+
- [Data Preparation](/docs/womd/DataPrep_pred.md)
60+
- [Training & Evaluation](/docs//womd/TrainEval_pred.md)
61+
- [Testing & Submission](/docs//womd/Submission_pred.md)
62+
63+
## TODO List
3664

3765
- [x] Initial release
38-
- [ ] Prediction pipeline in WOMD
66+
- [x] Prediction pipeline in WOMD
3967
- [ ] Planning pipeline in nuPlan
4068

4169
## Citation
4270

43-
If you find the project helpful for your research, please consider citing our paper:
71+
If you find the project helpful for your research, please consider citing our paper:
72+
73+
```bibtex
74+
@inproceedings{liu2024betop,
75+
title={Reasoning Multi-Agent Behavioral Topology for Interactive Autonomous Driving},
76+
author={Haochen Liu and Li Chen and Yu Qiao and Chen Lv and Hongyang Li},
77+
booktitle={NeurIPS},
78+
year={2024}
79+
}
80+
```

docs/womd/DataPrep_pred.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Preparation for WOMD prediction
2+
3+
## Installation
4+
5+
Run the following command to install the BeTopNet (WOMD) package:
6+
7+
```bash
8+
cd womd && pip install -e .
9+
```
10+
11+
To build the necessary CUDA dependencies, please refer to [EQNet](https://github.com/dvlab-research/DeepVision3D/tree/master/EQNet/eqnet/ops).
12+
13+
Make sure the corresponding WOMD package are successfully installed
14+
15+
## Data Preparation
16+
17+
### 1. Download the Data
18+
19+
Download the ```scenario/``` part of Waymo Open Motion Dataset under certain path and your specified task: [Link](https://console.cloud.google.com/storage/browser/waymo_open_dataset_motion_v_1_3_0;tab=objects?prefix=&forceOnObjectsSortingFiltering=false)
20+
21+
Download the ```intention_points.pkl```. You may find the corresponding files in the following [Link](https://github.com/OpenDriveLab/BeTop/releases/tag/womd)
22+
23+
### 2. Preprocess the Raw Data:
24+
25+
**[NOTE]** The ```data_process``` code assumes you have downloaded both motion & interaction data, so you may modify according to your need.
26+
27+
Run the following command to preprocess the raw data:
28+
29+
```bash
30+
cd tools/data_tools
31+
python3 data_process.py your_downloaded_path your_preferred_info_path
32+
```
33+
34+
### 3. **[Optional]** Cache Preprocessed Data
35+
36+
For memory-efficient training, you can preprocess the info data in ```.npz``` format cache:
37+
38+
```bash
39+
cd tools/data_tools
40+
python3 cache_offline_data.py --cache_path YOUR_CACHE_PATH --cfg ../cfg/BeTopNet_full_64.yaml
41+
```
42+
43+
**[NOTE]** The caching process would require around ```3-4TB``` storage space.

docs/womd/Submission_pred.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Submission for WOMD Leaderboard
2+
3+
## Submission Info
4+
5+
Specify your registered information in submission code:
6+
7+
1. Trace to Line 188 in ```womd/tools/submission.py```.
8+
2. Specify your information in the following format:
9+
10+
```python
11+
submission_info = dict(
12+
account_name='your Waymo account email',
13+
unique_method_name='xxx',
14+
authors=['A', 'B', 'xxx'],
15+
affiliation='your affiliation',
16+
uses_lidar_data=False,
17+
uses_camera_data=False,
18+
uses_public_model_pretraining=False,
19+
public_model_names='N/A',
20+
num_model_parameters='N/A',
21+
)
22+
```
23+
24+
25+
## Submission File Generation
26+
27+
Run the submission pipeline:
28+
29+
```bash
30+
cd womd/tools
31+
python3 test_submission.py \
32+
--cfg_file cfg/YOUR_CHOSEN_BASELINE.yaml \
33+
--batch_size BATCH \
34+
--ckpt MODEL_CKPT \
35+
--output_dir path_to_save_submission_file \
36+
#--eval \ # whether to submit the eval / test portal
37+
#--interactive # whether to submit the motion / interaction prediction task
38+
```
39+
40+
**Note:** Fot the last two arguments, the default setup is for ```test``` submission for *Motion Prediction* challenge.
41+
42+
- Use ```--eval``` if you want to check the evaluation on the Leaderboard portal.
43+
- Add the ```--interactive``` argument if you want to submit for *Interaction Prediction* challenge.
44+
45+
## Upload
46+
47+
Submit your results to the Leaderboard portal:
48+
49+
You can find the corresponding ```.tar.gz``` file under your specified ```--output_dir```. Submit to the Leaderboard portal:
50+
51+
- [Motion Prediction challenge](https://waymo.com/open/challenges/2024/motion-prediction/)
52+
- [Interaction Prediction challenge](https://waymo.com/open/challenges/2021/interaction-prediction/)

docs/womd/TrainEval_pred.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Training & Evaluation for WOMD prediction
2+
3+
## Baseline Model Selection
4+
Choose a baseline model to train through config files in ```womd/tools/cfg/```:
5+
6+
```bash
7+
BeTopNet-full: cfg/BeTopNet_full_64.yaml
8+
BeTopNet-e2e: cfg/BeTopNet_e2e_6.yaml
9+
MTR++: cfg/MTR_PlusPlus.yaml
10+
Wayformer: cfg/Wayformer.yaml
11+
```
12+
13+
## Training
14+
To start the training pipeline, run the following command:
15+
16+
```bash
17+
cd womd/tools
18+
bash scripts/dist_train.sh N_GPUS --cfg_file cfg/YOUR_CHOSEN_BASELINE.yaml --epoch 30 --batch_size BATCH --extra_tag XXX
19+
```
20+
21+
**[TIPS]** If you have not cached the data, your may set ```BATCH = 10*N_GPUS``` using A100(80G) gpus. Otherwise, you may leverage a larger batch size.
22+
23+
## Evaluation
24+
To evaluate the trained model, use the following command:
25+
26+
```bash
27+
cd womd/tools
28+
bash scripts/dist_test.sh N_GPUS --cfg_file cfg/YOUR_CHOSEN_BASELINE.yaml --batch_size BATCH --ckpt YOUR_MODEL_CKPT
29+
```

womd/README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# BeTopNet (WOMD Prediction)
2+
3+
This folder contains the full prediction implementation of BeTopNet in [Waymo Open Motion Dataset (WOMD)](https://waymo.com/open/challenges).
4+
5+
6+
## Highlights
7+
8+
Our prediction pipeline contains the following features:
9+
10+
:white_check_mark: **Full support for WOMD Prediction Challenges:**
11+
12+
- Full pipeline for [WOMD Motion Prediction](https://waymo.com/open/challenges/2024/motion-prediction/) challenge.
13+
- Full pipeline for [WOMD Interaction Prediction](https://waymo.com/open/challenges/2021/interaction-prediction/) challenge.
14+
15+
:white_check_mark: **Flexible Toolbox for prediction tasks:**
16+
17+
- Memory Efficient: Cached dataset and model training.
18+
- User-Friendly Tools: Simple tools for model training/evaluation and **Leaderboard submission**.
19+
- Scene Renderer: Visualize predicted trajectories.
20+
21+
:white_check_mark: **Pipeline for reproduced popular Baselines:**
22+
23+
- [Wayformer](https://arxiv.org/pdf/2207.05844) baseline reproduction.
24+
- [MTR++](https://arxiv.org/pdf/2306.17770) baseline reproduction (Deprecated).
25+
26+
## Get Started
27+
28+
- [Installation & Data Preparation](../docs//womd/DataPrep_pred.md)
29+
- [Training & Evaluation](../docs//womd/TrainEval_pred.md)
30+
- [Submission to Leaderboard](../docs//womd/Submission_pred.md)
31+
32+
33+
## Acknowledgment / Related resources
34+
35+
:star_struck: We would like to thank the following repositories and works for providing a foundation for building our pipelines:
36+
37+
- [MTR](https://github.com/sshaoshuai/MTR)
38+
- [UniTraj](https://github.com/vita-epfl/UniTraj)
39+
- [TopoNet](https://github.com/OpenDriveLab/TopoNet)

womd/betopnet/config.py

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
'''
2+
Mostly from Motion Transformer (MTR): https://arxiv.org/abs/2209.13508
3+
'''
4+
5+
from pathlib import Path
6+
7+
import yaml
8+
from easydict import EasyDict
9+
10+
def log_config_to_file(cfg, pre='cfg', logger=None):
11+
for key, val in cfg.items():
12+
if isinstance(cfg[key], EasyDict):
13+
logger.info('\n%s.%s = edict()' % (pre, key))
14+
log_config_to_file(cfg[key], pre=pre + '.' + key, logger=logger)
15+
continue
16+
logger.info('%s.%s: %s' % (pre, key, val))
17+
18+
19+
def cfg_from_list(cfg_list, config):
20+
"""Set config keys via list (e.g., from command line)."""
21+
from ast import literal_eval
22+
assert len(cfg_list) % 2 == 0
23+
for k, v in zip(cfg_list[0::2], cfg_list[1::2]):
24+
key_list = k.split('.')
25+
d = config
26+
for subkey in key_list[:-1]:
27+
assert subkey in d, 'NotFoundKey: %s' % subkey
28+
d = d[subkey]
29+
subkey = key_list[-1]
30+
assert subkey in d, 'NotFoundKey: %s' % subkey
31+
try:
32+
value = literal_eval(v)
33+
except:
34+
value = v
35+
36+
if type(value) != type(d[subkey]) and isinstance(d[subkey], EasyDict):
37+
key_val_list = value.split(',')
38+
for src in key_val_list:
39+
cur_key, cur_val = src.split(':')
40+
val_type = type(d[subkey][cur_key])
41+
cur_val = val_type(cur_val)
42+
d[subkey][cur_key] = cur_val
43+
elif type(value) != type(d[subkey]) and isinstance(d[subkey], list):
44+
val_list = value.split(',')
45+
for k, x in enumerate(val_list):
46+
val_list[k] = type(d[subkey][0])(x)
47+
d[subkey] = val_list
48+
else:
49+
assert type(value) == type(d[subkey]), \
50+
'type {} does not match original type {}'.format(type(value), type(d[subkey]))
51+
d[subkey] = value
52+
53+
54+
def merge_new_config(config, new_config):
55+
if '_BASE_CONFIG_' in new_config:
56+
with open(new_config['_BASE_CONFIG_'], 'r') as f:
57+
try:
58+
yaml_config = yaml.load(f, Loader=yaml.FullLoader)
59+
except:
60+
yaml_config = yaml.load(f)
61+
config.update(EasyDict(yaml_config))
62+
63+
for key, val in new_config.items():
64+
if not isinstance(val, dict):
65+
config[key] = val
66+
continue
67+
if key not in config:
68+
config[key] = EasyDict()
69+
merge_new_config(config[key], val)
70+
71+
return config
72+
73+
74+
def cfg_from_yaml_file(cfg_file, config):
75+
with open(cfg_file, 'r') as f:
76+
try:
77+
new_config = yaml.load(f, Loader=yaml.FullLoader)
78+
except:
79+
new_config = yaml.load(f)
80+
81+
merge_new_config(config=config, new_config=new_config)
82+
83+
return config
84+
85+
86+
87+
cfg = EasyDict()
88+
cfg.ROOT_DIR = (Path(__file__).resolve().parent / '../').resolve()
89+
cfg.LOCAL_RANK = 0

0 commit comments

Comments
 (0)