Skip to content

AIR-THU/V2X-Graph

Repository files navigation

Learning Cooperative Trajectory Representations for Motion Forecasting

NeurIPS 2024 License

This repository contains the official PyTorch implementation of our NeurIPS 2024 paper: "Learning Cooperative Trajectory Representations for Motion Forecasting".

Table of Contents

Installation

Setup Environment

# Clone the repository
git clone https://github.com/AIR-THU/V2X-Graph
cd V2X-Graph

# Create and activate conda environment
conda create -n v2x_graph python=3.8
conda activate v2x_graph

# Install dependencies
pip install -r requirements.txt

Install Required APIs

# Clone and install DAIR-V2X-Seq API:
git clone https://github.com/AIR-THU/DAIR-V2X-Seq
export PYTHONPATH="${PYTHONPATH}:/path/to/DAIR-V2X-Seq/projects/dataset"

# Install Argoverse 1 API:
pip install git+https://github.com/argoverse/argoverse-api.git

Dataset Preparation

Download the Required Datasets

Generate Trajectory Matching Labels

# For V2X-Seq-TFD
python generate_label.py \
    --data_root /path/to/V2X-Seq-TFD/cooperative-vehicle-infrastructure \
    --dataset V2X-Seq-TFD

# For V2X-Traj
python generate_label.py \
    --data_root /path/to/v2x-traj \
    --dataset V2X-Traj

Preprocess the Datasets

# For V2X-Seq-TFD
python preprocess.py \
    --root /path/to/V2X-Seq-TFD/cooperative-vehicle-infrastructure \
    --dataset V2X-Seq-TFD

# For V2X-Traj
python preprocess.py \
    --root /path/to/v2x-traj \
    --dataset V2X-Traj

Quick Start

Train or eval the model with different cooperation settings:

  • V2X-Seq-TFD supports: ego/v2i
  • V2X-Traj supports: ego/v2v/v2i/v2x

Training

# For V2X-Seq-TFD
python train.py \
    --root /path/to/V2X-Seq-TFD/cooperative-vehicle-infrastructure \
    --dataset V2X-Seq-TFD \
    --cooperation v2i

# For V2X-Traj
python train.py \
    --root /path/to/v2x-traj \
    --dataset V2X-Traj \
    --cooperation v2x

Evaluation

# For V2X-Seq-TFD
python eval.py \
    --root /path/to/V2X-Seq-TFD/cooperative-vehicle-infrastructure \
    --dataset V2X-Seq-TFD \
    --cooperation v2i \
    --ckpt_path /path/to/V2X-Graph/checkpoints/v2x-seq-tfd/v2i.ckpt

# For V2X-Traj
python eval.py \
    --root /path/to/v2x-traj \
    --dataset V2X-Traj \
    --cooperation v2x \
    --ckpt_path /path/to/V2X-Graph/checkpoints/v2x-traj/v2x.ckpt

Benchmark Results

V2X-Seq-TFD Validation Set Results

Metric Ego V2I
minADE 1.16 1.05
minFDE 2.02 1.79
MR 0.30 0.25

V2X-Traj Validation Set Results

Metric Ego V2V V2I V2X
minADE 0.90 0.77 0.80 0.72
minFDE 1.56 1.26 1.32 0.13
MR 0.17 0.12 0.13 0.11

Citation

If you find this work useful in your research, please consider citing:

@inproceedings{ruan2024v2xgraph,
  title={Learning Cooperative Trajectory Representations for Motion Forecasting},
  author={Hongzhi Ruan and Haibao Yu and Wenxian Yang and Siqi Fan and Zaiqing Nie},
  booktitle={Advances in Neural Information Processing Systems (NeurIPS)},
  year={2024}
}

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Related Resources

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages