This study is published in Analytic Methods in Accident Research and accessible via https://doi.org/10.1016/j.amar.2024.100369. For your convenience, an unofficially formatted version is available at arXiv. Questions, suggestions, and collaboration are welcome. Please feel free to reach out via email or GitHub Issues.
Dynamic visualisations in this paper are saved in the folder ./Data/DynamicFigures/. Below we present the example in Figure 9 of a conflict where the ego (red) vehicle changes lane twice continuously and has a potential collision with the target (blue) vehicle in the intermediate lane.
- Conflicts are modelled as context-dependent extreme events in normal interactions.
- Unified framework enables consistent conflict detection across traffic environments.
- Statistical learning enables data-driven and comprehensive analysis of conflicts.
- The unified approach detects conflicts at least as well as any existing metrics.
- This approach supports scalable and reliable traffic safety research in the future.
Thanks to @Jeffrey-Lim for providing the solution with Rye.
To reuse the methods in general, with any version of python that satisfies the requirements of gpytorch version 1.11, the existing code should work without any modification. Minor modifications may be needed for other dependencies.
To reproduce the results in the same python environment, please ensure Rye is installed on your machine and run:
rye syncAlternatively, you may manually install gpytorch=1.11 and pytables with Python 3.10+. For an encapsulated environment, you may create a virtual environment with Python 3.12.4 and install the dependencies from requirements-dev.lock using pip:
pip install -r requirements-dev.lock- Step 1 Getting familiar with use
- Go the directory
./DirectReuse/and use the jupyter notebooktest.ipynbto familiarise with the functions. The notebook provides test examples for both conflict probability estimation and conflict intensity evaluation.
- Go the directory
- Step 2 Model preparation
- Copy the files in the directory
./DirectReuse/, except fortest.ipynb, to where you want to reuse the model.
- Copy the files in the directory
- Step 3 Use it in oneline
- Now the model is ready to use after
from unified_conflit_detection import *, with one single functionassess_conflict(states,*args)! The function takes the states of two potentially interacting vehicles as input and returns either 1) conflict probability at a certain intensity level or 2) maximum possible conflict intensity.
- Now the model is ready to use after
*Note: the trained model currently considers limited information for methodology demonstration purposes. You may consider training a more sophisticated model, or following up with the authors for future updates.
- Raw data
Apply for and download the highD dataset from the website and put the data in the folder./Data/RawData/highD/. - Test data
We have processed and saved the 100Car NDS data in the folder./Data/RawData/100Car/. If interested, the readers are welcome to explore original 100Car NDS data with the code in the repository. - Results
Resulting data, i.e., a zipped file of the./Data/folder excluding subfolders./Data/RawData/and./Data/ProcessedData/, can be downloaded from https://doi.org/10.4121/06415947-2b9b-4435-833e-e513ae71a6ed.
-
Step 1 Data processing
- Step 1.1 Run
./DataProcessing/preprocessing_highD.pyto add heading directions of vehicles. - Step 1.2 Run
./DataProcessing/extraction_highD_LC.pyto extract trajectories involving lane-changing interactions in the highD dataset. - Step 1.3 Run
./DataProcessing/matching_100Car.pyto select applicable crashes and near-crashes in the 100Car NDS data.
- Step 1.1 Run
-
Step 2 Gaussian Process Regression model training
- Step 1.1 Run
./GaussianProcessingRegression/model_training.pyto train and test the Gaussian Process Regression models. - Step 1.2 Use
./GaussianProcessingRegression/model_evaluation.ipynbto visually evaluate the trained models.
- Step 1.1 Run
-
Step 3 Demonstration part I: conflict probability estimation
- Step 3.1 Run
./Demonstration/ConflictProbability/pre_computation.pyto pre-compute the parameters of proximity distribution for each time moment in the near-crashes. - Step 3.2 Run
./Demonstration/ConflictProbability/collision_warning.pyto perform collision warnings with PSD, DRAC, TTC, and the proposed unified metric, under a variety of thresholds. - Step 3.3 Use
./Demonstration/ConflictProbability/result_analysis.ipynbto find the optimal threshold for each metric. - Step 3.4 Run
./Demonstration/ConflictProbability/optimal_warning.pyto perform collision warnings with the optimal thresholds. - Step 3.5 Use
./Demonstration/ConflictProbability/result_analysis.ipynbagain to analyse the results together.
- Step 3.1 Run
-
Step 4 Demonstration part II: conflict intensity evaluation
- Step 4.1 Run
./Demonstration/IntensityEvaluation/lane_change_selection.pyto evaluate the conflict intensity of lane-changing interactions in highD data. - Step 4.2 Use
./Demonstration/IntensityEvaluation/result_analysis.ipynbto analyse the results.
- Step 4.1 Run
-
Step 5 Dynamic visualisation of examples
- Step 5.1 Run
./Visualisation/video_recoder_100Car.pyto produce images for the dynamic visualisation of near-crashes that have at least one metric failed to indicate a conflict. - Step 5.2 Run
./Visualisation/video_recoder_highD_LC.pyto produce images for the dynamic visualisation of some lane-changing interactions in highD data. - Step 5.3 Run
./Visualisation/video_maker.pyto generate videos from the images. - Step 5.4 Run
./Visualisation/gif_maker.pyto generate gifs from the images (1/4 of the original resolution).
- Step 5.1 Run
@article{jiao2024unified,
title={A Unified Probabilistic Approach to Traffic Conflict Detection},
author={Yiru Jiao and Simeon C. Calvert and Sander {van Cranenburgh} and Hans {van Lint}},
year={2025},
journal={Analytic Methods in Accident Research},
volume={45},
pages={100369}
}