This repo offers the source code for Critical Scnenario Generation (CSG) toolkit. The toolkit aims to extract dynamic (trajectories) and static (road) elements from a given surveillance or dash camera video, and fromulated as OpenDrive and OpenScenario files as outputs.
- Install system dependencies:
sudo apt-get install python3-tk
- Install python3 package:
pip3 install Cython numpy
pip3 install -r requirements.txt
- compile cython package
cd src/track/kcf && make & cd ../../../
- Edit variables in config.py (Optional)
- Download machine learning models from Google Drive and unzip to "data" folder.
- Run
- For survelliance video:
python3 CSG.py
- For dash camera video:
It uses ORB-SLAM2 to get extrinsic parameters of moving camera. Please install ORB-SLAM2 first and put the executable file under the "/src/SLAM" folder.
Then run:
python3 CSG_ego.py
At least 1 GPU is needed. By default, the models are deployed on gpu:0. You can change your settings in "config" file.
+-- critical-scenario-generation
¦ +-- data
¦ ¦ +-- yolo
¦ ¦ +-- vehicle_reid
¦ ¦ +-- mask_rcnn_ego
¦ ¦ +-- mask_rcnn
¦ ¦ +-- lane
¦ ¦ +-- depth
¦ +-- src
¦ ¦ +-- SLAM
¦ ¦ ¦ +-- mono_kitti
¦ ¦ +-- ...
¦ +-- Lib_OpenSCENARIO
¦ +-- icon
¦ +-- CSG.py
¦ +-- CSG_ego.py
¦ +-- ScaleSolver.py
¦ +-- config.py
¦ +-- requirements.txt
check LICENSE
If you use our source code, please consider citing the following:
@InProceedings{csg2020,
title={CSG: critical scenario generation from real traffic accidents},
author={Zhang, Xinxin and Li, Fei and Wu, Xiangbin},
booktitle = {IV},
year={2020}
}