Skip to main content

Parallelized differentiable IDM implementation, for the paper [Gradient-based Trajectory Optimization with Parallelized Traffic Simulation] (ICRA 2025)

Project description

DiffIDM [Arxiv]

This is the official code of our paper "Gradient-based Trajectory Optimization with Parallelized Traffic Simulation", which has been accepted to ICRA 2025. Here we provide the code for parallelized differentiable IDM computation layer, which could be easily adopted for larger scale traffic simulators. The computation layer can handle upto 2 million vehicles in real time using either CPU or GPU. We also provide our experiment code for filtering vehicle trajectories in NGSim dataset using our simulator. Please see our paper for more details.

Parallelization scheme

Install

You need to install pytorch to use our computation layer. Then, you can install our computation layer using pip.

pip install diffidm

After installation, you can use the computation layer as follows.

import torch
from diffidm.layer import IDMLayer

num_vehicles = int(1e6)   # 1M vehicles

### randomly generate IDM variables

Usage: Trajectory filtering for NGSIM dataset

As demonstrated in our paper, we can use our computation layer to filter physically unrealistic vehicle motions from their trajectories captured in real-world. We tested our filtering algorithm on NGSIM dataset. To run the algorithm, first download the dataset (1.53GB) from this page to data directory, under the name of ngsim.csv. Then, preprocess the data with the following command.

python ngsim_preprocess.py

This preprocessing step generates input data for our filtering algorithm, which would be saved in input/. Then, we can use the following command to filter the NGSIM trajectories in us-101 category using our computation layer. Please see ngsim_filter.py for the details abour arguments.

CUDA_VISIBLE_DEVICES=0 OMP_NUM_THREADS=1 python ngsim_filter.py --token=us-101 --device=cuda 

The filtered trajectories and related optimization results (e.g. IDM parameters for each trip) are stored under output/ directory. Finally, we can evaluate the filtered trajectories by comparing them with the ground truth data and generate the experimental results in the paper with following command. Also see ngsim_eval.py for the details about arguments.

python ngsim_eval.py --token=us-101 --render-traj-id=1000

The evaluation results are saved in eval/.

Citation

If you found our work to be useful, please consider citing our work.

@article{son2024gradient,
  title={Gradient-based Trajectory Optimization with Parallelized Differentiable Traffic Simulation},
  author={Son, Sanghyun and Zheng, Laura and Clipp, Brian and Greenwell, Connor and Philip, Sujin and Lin, Ming C},
  journal={arXiv preprint arXiv:2412.16750},
  year={2024}
}

Acknowledgement

We used Wei Ma's NGSIM interface code for preprocessing NGSIM dataset. We appreciate this great work.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

diffidm-0.0.0.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

diffidm-0.0.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file diffidm-0.0.0.tar.gz.

File metadata

  • Download URL: diffidm-0.0.0.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for diffidm-0.0.0.tar.gz
Algorithm Hash digest
SHA256 5ac316f006be1521092cd766f70fd664b64b8ad6734a3ae807dcc68a1a17dd2b
MD5 0ea55755a0c354c798a0b64a7f4c42ab
BLAKE2b-256 3495eda50a6a967138f8cdf43c30a9c98ac55328abd70744910f1e491b973e9e

See more details on using hashes here.

File details

Details for the file diffidm-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: diffidm-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for diffidm-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc96bcced45505f00e497b9380d8dec7f39af90322a569759bb15d84333eded0
MD5 11ac85944ce694be5eb5b81a375ab20f
BLAKE2b-256 82f6067788ae83134a53c3065ad1331bb7417b86b55477fcec06d106d83f2973

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page