TrajGPT: Controlled Synthetic Trajectory Generation Using a Multitask Transformer-Based Spatiotemporal Model
(We will update this README with details of TrajGPT once the paper is publicly available.)
Recommended setup: GPU with more than 4GB VRAM and CUDA version 12.3.
Use conda to create a virtual environment and pip to install the requirements.
conda create --name trajgpt python==3.10.13
conda activate trajgpt
pip install -r requirements.txt
To reproduce the results of TrajGPT on GeoLife, please follow these instructions:
- Enter the root directory of TrajGPT.
cd your/path/to/TrajGPT
- Download dataset from GeoLife GPS Trajectories.
wget -O data/geolife.zip https://download.microsoft.com/download/F/4/8/F4894AA5-FDBC-481E-9285-D5F8C4C4F039/Geolife%20Trajectories%201.3.zip
- Unzip the data to the
data
folder.
unzip data/geolife.zip -d data
- Convert point-by-point trajectories to sequences of visits (a.k.a. staypoints).
python3 utils/preprocess.py
This step takes around 5 minutes and only needs to be run once.
- Run
main.py
. It took around 45 minutes on NVIDIA A100 GPU, or reaching patience after hundreds of epochs. Please specify the task by replacing$task
with one ofnext_prediction
orinfilling
:
python3 main.py --task $task
This software is produced by Shang-Ling (Kate) Hsu, the first author of TrajGPT. The subsequent authors of TrajGPT are: Emmanuel Tung, Dr. John Krumm, Dr. Cyrus Shahabi, and Dr. Khurram Shafique.
We are committed to open-sourcing this project and ensuring that everyone can reproduce the results presented in our paper. If you have any questions, please feel free to open an issue.