Skip to content

Zhanwei-Z/G2LTraj

Repository files navigation

G2LTraj: A Global-to-Local Generation Approach for Trajectory Prediction


A common pipeline of trajectory prediction models and the proposed G2LTraj.

Model Training

Setup

Environment
All models were trained and tested on Ubuntu 18.04 with Python 3.7 and PyTorch 1.12.1 with CUDA 11.1.

Dataset
Preprocessed ETH and UCY datasets are included in this repository, under ./datasets/. The train/validation/test splits are the same as those fond in Social-GAN.

You can also download the dataset by running the following script.

./scripts/download_datasets.sh

Baseline models
This repository supports six baseline models: AgentFormer, DMRGCN, Graph-TERN, PECNet, SGCN and Social-STGCNN. We have included model source codes from their official GitHub in the ./baselines/ folder.

Train G2LTraj

To train our G2LTraj on the ETH and UCY datasets at once, we provide a bash script train.sh for a simplified execution.

./scripts/train.sh

We provide additional arguments for experiments:

./scripts/train.sh -t <experiment_tag> -b <baseline_model> -c <config_file_path> -p <config_file_prefix> -d <space_seperated_dataset_string> -i <space_seperated_gpu_id_string>

# Supported baselines: agentformer, dmrgcn, graphtern, pecnet, sgcn, stgcnn
# Supported datasets: eth, hotel, univ, zara1, zara2

# Examples
./scripts/train.sh -b sgcn -d "hotel" -i "1"
./scripts/train.sh -b agentformer -t agentformer -d "zara2" -i "2"
./scripts/train.sh -b pecnet -c ./config/  -d "eth hotel univ zara1 zara2" -i "0 0 0 0 0"

If you want to train the model with custom hyper-parameters, use trainval.py instead of the script file.

python trainval.py --cfg <config_file_path> --tag <experiment_tag> --gpu_id <gpu_id> 

Model Evaluation

Pretrained Models

We will provide all pretrained models in the checkpoints folder.

Evaluate G2LTraj

To evaluate our G2LTraj at once, we provide a bash script test.sh for a simplified execution.

./scripts/test.sh -t <experiment_tag> -b <baseline_model> -c <config_file_path> -p <config_file_prefix> -d <space_seperated_dataset_string> -i <space_seperated_gpu_id_string>

# Examples
./scripts/test.sh -b sgcn -d "hotel" -i "1"
./scripts/test.sh -b agentformer -t agentformer -d "zara2" -i "2"
./scripts/test.sh -b pecnet -c ./config/ -d "eth hotel univ zara1 zara2" -i "0 0 0 0 0"

If you want to evaluate the model individually, you can use trainval.py with custom hyper-parameters.

python trainval.py --test --cfg <config_file_path> --tag <experiment_tag> --gpu_id <gpu_id> 

Citation

If you find our work useful in your research, please cite our paper G2LTraj:

@inproceedings{ijcai2024p285,
  title     = {G2LTraj: A Global-to-Local Generation Approach for Trajectory Prediction},
  author    = {Zhang, Zhanwei and Hua, Zishuo and Chen, Minghao and Lu, Wei and Lin, Binbin and Cai, Deng and Wang, Wenxiao},
  booktitle = {Proceedings of the Thirty-Third International Joint Conference on
               Artificial Intelligence, {IJCAI-24}},
  publisher = {International Joint Conferences on Artificial Intelligence Organization},
  editor    = {Kate Larson},
  pages     = {2579--2587},
  year      = {2024}
}

Acknowledgement

Our code builds upon EigenTrajectory. We appreciate all the contributors for their awesome work.

About

code for G2LTraj

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published