TrajGen: Generating Realistic and Diverse Trajectories With Reactive and Feasible Agent Behaviors for Autonomous Driving
Implementation of the TrajGen and I-SIM simulator based on Interaction Dataset. TrajGen is a two-stage trajectory generation framework, which can capture realistic and diverse behaviors directly from human demonstration.
If you find this code useful, please reference in your paper:
@article{zhang2022trajgen,
title={TrajGen: Generating Realistic and Diverse Trajectories With Reactive and Feasible Agent Behaviors for Autonomous Driving},
author={Zhang, Qichao and Gao, Yinfeng and Zhang, Yikang and Guo, Youtian and Ding, Dawei and Wang, Yunpeng and Sun, Peng and Zhao, Dongbin},
journal={IEEE Transactions on Intelligent Transportation Systems},
year={2022},
doi={10.1109/TITS.2022.3202185}
}
To properly run TrajGen on your system, you should clone this repository, and follow the instruction below to install the dependencies for both I-SIM and TrajGen.
Since the HD maps of Interaction Dataset uses the format of Lanelet2, you need to build Lanelet2 Docker first, we provide a modified version of Lanelet2 in our repo:
cd Lanelet2
docker build -t isim .
After build, run docker container and do port mapping, we use port 5557-5561 as example:
docker run -it -e DISPLAY -p 5557-5561:5557-5561 -v $path for TrajGen$:/home/developer/workspace/interaction-dataset-master -v /tmp/.X11-unix:/tmp/.X11-unix --user="$(id --user):$(id --group)" --name isim57 isim:latest bash
Update dependencies:
sudo apt update
sudo apt install python-tk
Check wheather I-SIM can properly run:
cd interaction-dataset-master/python/interaction_gym/
python main_visualize_data.py "DR_USA_Intersection_EP0"
TrajGen requires python3(>=3.7) and tensorflow-gpu(>=1.14), as for other packages, please run:
pip install -r requirements.txt
This repo has contained predicted trajcetories generated by LaneGCN with Routeloss, which is the first stage of TrajGen framework. If you want to further understand how this work, please check LaneGCN with Routeloss. We also provide a pretrained model for testing.
To train or test TrajGen, your have to run I-SIM manually, we assume that I-SIM runs at port 5557 inside a docker container:
docker exec -it isim57 bash
cd interaction-dataset-master/python/interaction_gym/
python interaction_env.py --port=5557
Train TrajGen:
python python/interaction_rl/main.py --port=5557
Visualize training curves:
python python/interaction_rl/results/rl/$ports$/visualize_results.py
Test TrajGen:
python python/interaction_rl/main.py --port=5557 --test
Print test results:
python python/interaction_rl/results/test/print_results.py
We appreciate the following github repos for their valuable code base or dataset:
https://github.com/fzi-forschungszentrum-informatik/Lanelet2