InterHub: A Naturalistic Trajectory Dataset with Dense Interaction for Autonomous Driving
Xiyan Jiang1, Xiaocong Zhao1,*, Yiru Liu1, Zirui Li2, Peng Hang1, Lu Xiong1, and Jian Sun1,*
1 Tongji University, 2 Beijing Institute of Technology
* Correspondance: [email protected], [email protected]
This repo is intended to serve as a starting point for driving-interaction-related research. We provide (a) a publicly accessible dataset InterHub with rich interaction events and (b) tools for interaction extraction.
Naturalistic driving datasets are reorganized using a unified data interface trajdata to provide extensibility and easy access to multiple driving data resources. Then, driving interaction events covering a wide range of interaction archetypes, as well as their combinations, are extracted using the formal method. Rich features of the extracted scenarios, including interaction intensity, AV involvement, and conflict type, are analyzed and annotated to support applications with varied needs regarding driving interaction data.
We offer three tools to help users navigate InterHub:
-
0_data_unify.py converts various data resources into a unified format for seamless interaction event extraction.
-
1_interaction_extract.py extracts interactive segments from unified driving records.
-
2_case_visualize.py showcases typical interaction scenarios in InterHub.
Referencing the method proposed in Li G, Jiao Y, Calvert S C, et al. (with our approach considering merging scenarios), we classify the interaction into 12 categories based on the driving direction relationship between two key agents before and after the intersection:
In addition to indexing and tracing information about interaction scenarios, we also provide the following interesting labels to facilitate more targeted retrieval and utilization of interaction scenarios.
Column | Data Type | Information |
---|---|---|
key_agents |
str |
The IDs of the two key vehicles in the interaction: Separated by semicolons (; ). |
pre-post_direction |
str |
The driving direction relationship label before and after the intersection (e.g., P-M , C-O ). - P-M : The two agents were running parallel (P ) before the intersection and merged (M ) after the intersection. - C-O : The two agents were running crossed (C ) before the intersection and opposite (O ) after the intersection. |
turn_label |
str |
The turning direction of the two vehicles: Recorded in the td_i-td_j format, where td_i and td_j represent the turning directions, each being one of: - S (straight) - L (left turn) - R (right turn) - U (U-turn). |
priority_label |
str |
The ID of the vehicle with right of priority among the key_agents . |
For the full dataset information, please refer to Dataset Information.
- Supplementary material, video, slides
- Preprint paper release 20241128
- Visualization scripts 20241106
- Installation tutorial 20241106
- Initial repo 20241019
Ensure the following prerequisites are satisfied. We recommend using conda for Python environment management.
-
Create and activate a conda environment:
conda create --name interhub python=3.8 conda activate interhub
-
Upgrade pip to the latest version:
python -m pip install --upgrade pip
-
(Optional) Change pip source for faster installation if encountering network issues:
pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
-
Install required packages:
pip install -r requirements.txt
-
Install required trajdata package for the mini dataset from INTERACTION:
pip install "trajdata[interaction]"
-
A subset of the original interaction_multi dataset is provided in
data/0_origin_datasets/interaction_multi
for a quick try. Unify the data with:python 0_data_unify.py --desired_data interaction_multi --load_path data/0_origin_datasets/interaction_multi --save_path data/1_unified_cache
-
Extract interaction events from the subset:
python 1_interaction_extract.py --desired_data interaction_multi --cache_location data/1_unified_cache --save_path data/2_extracted_results
-
Visualize the interaction events:
python 2_case_visualize.py --cache_location data/1_unified_cache/interaction_multi --interaction_idx_info data/2_extracted_results/results.csv --top_n 3
See
figs/case
for visualization results.
1.1 For ready-to-use interaction data in InterHub, download and use the data from InterHub, unzip it, and place it in the data/1_unified_cache
folder. Proceed to 2. Interaction Event Extract.
1.2 For working from scratch or extracting from other data resources, the origin datasets are necessary. Refer to dataset.md for details on building the needed dataset structure. Preprocess the dataset to form a data cache if using initial or unprocessed datasets.
For datasets including INTERACTION, nuPlan, Waymo, lyft, 0_data_unify.py
provides scripts for preprocessing raw data into a unified data cache. The project trajdata is used in this step. Replace arguments according to the dataset you want to process:
-
desired_data: List of datasets to process, e.g.,
["interaction_multi"]
. See support list in dataset.md. -
load_path: Path where raw data is stored, e.g.,
'data/0_origin_datasets/interaction_multi'
. -
cache_location: Path where the generated cache will be stored. Ensure enough memory, e.g.,
'data/1_unified_cache/interaction_multi'
.
python 0_data_unify.py \
--desired_data 'waymo_train' \
--load_path path/to/your/dataset \
--save_path path/to/your/dataset/cache \
--processes 14
python 1_interaction_extract.py \
--desired_data dataset_name \
--cache_location path/to/your/dataset/cache \
--save_path path/to/save/your/result \
--timerange=5
Replace cache_location
and save_path
with your paths. By default, a subset of interaction_multi
dataset is read from the data/1_unified_cache
folder.
Run 2_case_visualize.py
to plot interaction segments and generate GIFs.
Run 3_paper_plot.py
to plot results in the paper using metadata of interaction events in the full InterHub dataset.
This project, InterHub, incorporates code from trajdata, developed by NVIDIA Research. We are not affiliated with NVIDIA or the contributors of trajdata. We extend our sincere gratitude to the trajdata team for their outstanding work in simplifying trajectory data processing.
The use of trajdata code in this project is in accordance with their original license terms. All rights and credits for the trajdata components belong to their respective owners.
If you find this repository useful for your research, please consider giving us a star 🌟 and citing our paper.
@article{jiang2024interhub,
title={InterHub: A Naturalistic Trajectory Dataset with Dense Interaction for Autonomous Driving},
author={Jiang, Xiyan and Zhao, Xiaocong and Liu, Yiru and Li, Zirui and Hang, Peng and Xiong, Lu and Sun, Jian},
journal={arXiv preprint arXiv:2411.18302},
year={2024},
doi={10.48550/arXiv.2411.18302}
}