The official implementation of Spatiotemporal Gated Traffic Trajectory Simulation with Semantic-aware Graph Learning (Information Fusion 2024).
Please consider giving this repository a star β if you find it helpful! π
Check out our paper:
Spatiotemporal Gated Traffic Trajectory Simulation with Semantic-aware Graph Learning.
Yu Wang, Ji Cao, Wenjie Huang, Zhihua Liu, Tongya Zhengβ , Mingli Song. [Link]
Abstract: Traffic trajectories of various vehicles, bicycles and pedestrians can help understand the traffic dynamics in a fine-grained manner like traffic flow, traffic congestion and ride-hailing demand. The comprehensive usage of traffic trajectory data has not been fully investigated due to the prevalent privacy concerns and commercial limitations. The traffic trajectory simulation task has emerged to generate high-fidelity trajectories in demand for downstream tasks to fill the gap between the scarce trajectory data and the widespread applications. Previous state-of-the-art methods build the spatiotemporal dependencies of trajectories with Graph Neural Networks (GNNs) under generative adversarial training, yielding better yet unstable trajectory quality. We observe that the unsatisfied synthetic trajectories are caused by the insufficient spatiotemporal modeling of road networks and trajectory semantics. In this paper, we propose a novel SpatioTEmporal GAted (STEGA) framework equipped with semantic-aware graph learning for traffic trajectory simulation to enable the explicit modeling of spatiotemporal dependencies throughout the learning pipeline. On the one hand, STEGA employs a graph encoder with the semantics of road networks for the spatial points of a trajectory, together with a time encoder for the time points. On the other hand, STEGA devises two spatiotemporal gates with the semantic graphs for the predictions of the future trajectory. Boosted by the semantic-aware graph learning, the proposed STEGA outperforms the state-of-the-art counterparts consistently at both macro- and micro-level metrics on two datasets. Elaborate ablation studies and downstream tasks of the synthetic trajectories further demonstrate the superiority of STEGA. Our code is available at https://github.com/Star607/STEGA.
If you find our work useful in your research, please consider citing π:
@article{wang2024spatiotemporal,
title={Spatiotemporal Gated Traffic Trajectory Simulation with Semantic-aware Graph Learning},
author={Yu Wang, Ji Cao, Wenjie Huang, Zhihua Liu, Tongya Zheng, Mingli Song},
journal={Information Fusion},
volume={108},
pages={102404},
year={2024},
issn={1566-2535},
doi={https://doi.org/10.1016/j.inffus.2024.102404},
url={https://www.sciencedirect.com/science/article/pii/S1566253524001829}
}
-
Environment
- Tested OS: Linux
- Python >= 3.9
- PyTorch == 1.10.2
-
Dependencies
- Install PyTorch 1.10.2 with the correct CUDA version.
- Install dgl 1.1.0 with the correct CUDA version.
- Execute
pip install -r requirements.txt
command to install all of the Python modules and packages used in this project.
Data is from the opensource dataset of TS-TrajGen.
βββ data
β βββ BJ_Taxi
β βββ adjacent_mx_fill.npz.npy
β βββ adjacent_mx.npz
β βββ dist_geo.npy
β βββ node_feature.pt
β βββ od_and_probs_float.pt
β βββ rid_gps.json
β βββ road2grid.json
β βββ roadmap.geo
β βββ roadmap.rel
β βββ start_t_probs.pt
β βββ traj_tes.csv
β βββ traj_tra.csv
β βββ traj_val.csv
βββ distance_gat_fc.py
βββ functional.py
βββ graph_model.py
βββ helpers.py
βββ model.py
βββ picture
β βββ framework.png
βββ README.md
βββ requirements.txt
βββ sample.py
βββ train.py
-
Model Training
python train.py
--data
sets the dataset--datapath
refers to the path of each dataset--out_dir
is the file directory to save the trained model
-
Trajectory Simulation
python sample.py
--data
sets the dataset--datapath
refers to the path of each dataset--out_dir
is the file directory to save the trained model and simulated trajectories
The implemention is based on nanoGPT.