Learning Cooperative Trajectory Representations for Motion Forecasting

May 26, 2025 ยท View on GitHub

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

MetricEgoV2I
minADE1.161.05
minFDE2.021.79
MR0.300.25

V2X-Traj Validation Set Results

MetricEgoV2VV2IV2X
minADE0.900.770.800.72
minFDE1.561.261.320.13
MR0.170.120.130.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.