Early collision warning Network Application for Transportation use case
Project description
CollisionWarningService
The algorithm detects and tracks objects in video using SORT algorithm. For all objects, their projection to road plane is calculated (i.e. camera calibration is necessary). Location of objects on the road plane is filtered by Kalman Filter - which gives us the ability to predict future movement of objects. If the future path of an object strikes warning zone, alarm event is emitted. The event contains detailed description of the offensive behaviour, like location on screen and in the world, relative speed and direction of object, and time of entering the warning zone.
Requirements
There are few basic requirements for the algorithm itself
numpy
pyyaml
opencv-python
orpy-opencv
if you use condapillow
shapely
filterpy
pytorch
Additional packages are required if you want to use the service as a Network Application within 5G-Era framework/
era_5g_interface
era_5g_client
simple-websocket
python-socketio
flask
Installation
Getting started - standalone example
As an example, we use the video posted by u/Big-Replacement-7684 in r/IdiotsInCars showing typical dangerous situation that might result in car crash.
# This will load configurations for video3.mp4 and show visualization.
> python fcw_example.py
Relevant configurations are in videos/video3.yaml
- camera config, and config/config.yaml
algorithm settings.
Running with your videos
Calibrate camera
Setup algorithm parameters
Run the example
Network Application for 5G-ERA
Run FCW service/NetApp
Docker
The FCW service can be started in docker, e.g.The FCL service can be run in docker (docker/fcw_service.Dockerfile), for example in this way, where the GPU of the host computer is used and TCP port 5897 is mapped to the host network.
docker build -f fcw_service.Dockerfile -t but5gera/fcw_service:0.1.0 . \
&& docker run -p 5897:5897 --network host --gpus all but5gera/fcw_service:0.1.0
Local startup
The FCW Service can also be run locally using fcw/service/interface.py, but all necessary dependencies must be installed in the used python environment and the NETAPP_PORT environment variable should be set (default is 5896):
set NETAPP_PORT=5897
or on Linux:
export NETAPP_PORT=5897
Requirements:
git
python3.8
or laterffmpeg
CUDA
poetry
At now, FCW Service package collision-warning-service contains both server and client (examples) parts. This package depends on
era-5g-interface>=0.4.0
era-5g-client>=0.4.0
Clone this repository somewhere first:
git clone https://github.com/5G-ERA/CollisionWarningService.git
cd CollisionWarningService
Installation of collision-warning-service:
cd ..
poetry install
Run FCW service:
poetry run fcw_service
For CUDA accelerated version, on Windows may be needed e.g.:
pip3 install --upgrade --force-reinstall torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu118
It depends on the version of CUDA on the system https://pytorch.org/get-started/locally/.
Run client
Set NETAPP_PORT environment variable (default is http://localhost:5896):
set NETAPP_ADDRESS=http://localhost:5897
or on Linux:
export NETAPP_ADDRESS=http://localhost:5897
Run FCW python simple client example:
poetry run fcw_client_python_simple -c config/config.yaml --camera videos/video3.yaml videos/video3.mp4
or run simple client with rtsp stream (yaml files are not compatible with tshi rtsp stream, it is for example only):
poetry run fcw_client_python_simple -c config/config.yaml --camera videos/video3.yaml rtsp://root:upgm_c4m3r4@upgm-ipkam5.fit.vutbr.cz/axis-media/media.amp
or run advanced client:
poetry run fcw_client_python -c config/config.yaml --camera videos/video3.yaml videos/video3.mp4
Notes
We use slightly modified version of SORT tracker from abewley gitub repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for collision_warning_service-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 562e7fc6eb6694f80623ab7946ebae7b145cbebd3b2be7bf66e7f154300964b1 |
|
MD5 | 399614ff9985d91a31c2191bc38b3e71 |
|
BLAKE2b-256 | 6f86287d4dc9c0a90143ccffa507ead302712bae959133fda7d250c09c6d8f71 |
Hashes for collision_warning_service-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c48d7d1f8b5f158f6ee477934a7f2defdddd6d25b617efc1d9260d5505fb45d |
|
MD5 | 53a5907f9504104095304761061f6cd9 |
|
BLAKE2b-256 | e0fb3f704b1a6fa983f0791fd3a7d80dc297bc19dd09d6ad7a575bd7bf1ac509 |