Giter Site home page Giter Site logo

csg's Introduction

Critical Scenario Generation Toolkit

Introduction

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.

How to build

  1. Install system dependencies:
sudo apt-get install python3-tk
  1. Install python3 package:
pip3 install Cython numpy
pip3 install -r requirements.txt
  1. compile cython package
cd src/track/kcf && make & cd ../../../

How to run:

  1. Edit variables in config.py (Optional)
  2. Download machine learning models from Google Drive and unzip to "data" folder.
  3. 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 

Reqruiments

At least 1 GPU is needed. By default, the models are deployed on gpu:0. You can change your settings in "config" file.

Folder structure

+-- 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

Licence

check LICENSE

Citation

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}
}

csg's People

Contributors

dependabot[bot] avatar lidanzha avatar michaelbeale-il avatar panzwarzywniaka avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

csg's Issues

Incompatible PIL version

In the latest commit c2bdd66 you bumped the PIL version to 10.0.1.

However, it breaks your code in the following way:
Traceback (most recent call last): File "CSG.py", line 1859, in <module> tool = MainGUI(root) File "CSG.py", line 346, in __init__ warning_thumb=ImageOps.fit(warning_icon, self.icon_image_size, Image.ANTIALIAS) AttributeError: module 'PIL.Image' has no attribute 'ANTIALIAS'
This is because PIL.Image.ANTIALIAS was deprecated in 10.0.0.
Source: https://stackoverflow.com/questions/76616042/attributeerror-module-pil-image-has-no-attribute-antialias

I'll submit PR with the fix.

Documentation

Is there any documentation for this toolkit in detail?
Say, at least an example for the detailed description of the GUI interfaces on CSG V1.0.

Documentation for surveillance perspective

Hello,

I noticed that the demo.mp4 provided only includes the operation method of the tool from the perspective of the ego vehicle and does not include the operation method from the surveillance perspective. I found that there are some differences between these two scenarios. Could you please provide documentation for the tool from the surveillance perspective?

Thank you!

Error in camera calibration

Hi, trying to use your pipeline with another video from the web.
I created parallel lines and reference line but I get value error when computing camera parameters:

image

Do you have any suggestions?

Things I tried:

  • Diffrent parallel lines
  • different reference line
  • different value for reference distance

Kind regards

Python Version

What is your Python Version while running the installation process?

When I run pip install -r requirements.txt under conda environment of Python3.9 on my Linux Ubuntu 20.04 LTS, it outputs the message as follows:

...
Collecting tensorflow-gpu==2.12.0
  Using cached tensorflow-gpu-2.12.0.tar.gz (2.6 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [39 lines of output]
      Traceback (most recent call last):
        File "/home/alex/anaconda3/envs/csg/lib/python3.9/site-packages/setuptools/_vendor/packaging/requirements.py", line 35, in __init__
          parsed = _parse_requirement(requirement_string)
        File "/home/alex/anaconda3/envs/csg/lib/python3.9/site-packages/setuptools/_vendor/packaging/_parser.py", line 64, in parse_requirement
          return _parse_requirement(Tokenizer(source, rules=DEFAULT_RULES))
        File "/home/alex/anaconda3/envs/csg/lib/python3.9/site-packages/setuptools/_vendor/packaging/_parser.py", line 82, in _parse_requirement
          url, specifier, marker = _parse_requirement_details(tokenizer)
        File "/home/alex/anaconda3/envs/csg/lib/python3.9/site-packages/setuptools/_vendor/packaging/_parser.py", line 126, in _parse_requirement_details
          marker = _parse_requirement_marker(
        File "/home/alex/anaconda3/envs/csg/lib/python3.9/site-packages/setuptools/_vendor/packaging/_parser.py", line 147, in _parse_requirement_marker
          tokenizer.raise_syntax_error(
        File "/home/alex/anaconda3/envs/csg/lib/python3.9/site-packages/setuptools/_vendor/packaging/_tokenizer.py", line 165, in raise_syntax_error
          raise ParserSyntaxError(
      setuptools.extern.packaging._tokenizer.ParserSyntaxError: Expected end or semicolon (after name and no valid version specifier)
          python_version>"3.7"
                        ^
      
      The above exception was the direct cause of the following exception:
      
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-vyq5no4p/tensorflow-gpu_413d9a4060b747d8bc9ab94ec76b357c/setup.py", line 40, in <module>
          setuptools.setup()
        File "/home/alex/anaconda3/envs/csg/lib/python3.9/site-packages/setuptools/__init__.py", line 102, in setup
          _install_setup_requires(attrs)
        File "/home/alex/anaconda3/envs/csg/lib/python3.9/site-packages/setuptools/__init__.py", line 73, in _install_setup_requires
          dist.parse_config_files(ignore_option_errors=True)
        File "/home/alex/anaconda3/envs/csg/lib/python3.9/site-packages/setuptools/dist.py", line 655, in parse_config_files
          self._finalize_requires()
        File "/home/alex/anaconda3/envs/csg/lib/python3.9/site-packages/setuptools/dist.py", line 390, in _finalize_requires
          self._normalize_requires()
        File "/home/alex/anaconda3/envs/csg/lib/python3.9/site-packages/setuptools/dist.py", line 405, in _normalize_requires
          self.install_requires = list(map(str, _reqs.parse(install_requires)))
        File "/home/alex/anaconda3/envs/csg/lib/python3.9/site-packages/setuptools/_vendor/packaging/requirements.py", line 37, in __init__
          raise InvalidRequirement(str(e)) from e
      setuptools.extern.packaging.requirements.InvalidRequirement: Expected end or semicolon (after name and no valid version specifier)
          python_version>"3.7"
                        ^
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

I have changed to different versions of Python (3.6, 3.7, 3.8, 3.9, 3.12) to retry, but I gain almost the same error on installing the prerequisites.
Do you have some suggestions on the environment?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.