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
numpypyyamlopencv-pythonorpy-opencvif you use condapillowshapelyfilterpypytorch
Additional packages are required if you want to use the service as a Network Application within 5G-Era framework/
era_5g_interfaceera_5g_clientsimple-websocketpython-socketioflask
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:
gitpython3.8or laterffmpegCUDApoetry
At now, FCW Service package collision-warning-service contains both server and client (examples) parts. This package depends on
era-5g-interface>=0.4.1era-5g-client>=0.4.1
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.
Metadata
Release files for collision-warning-service 0.4.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| collision_warning_service-0.4.1.tar.gz | 31.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| collision_warning_service-0.4.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 72.4 kB
Release files / collision_warning_service-0.4.1.tar.gz
| Download URL | collision_warning_service-0.4.1.tar.gz |
|---|---|
| Size | 31.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d3d931bc9338a251da03adaac67c5b441e33f1b4bf0f748e46bd1496867d5816
|
|
BLAKE2b-256 checksum How to use checksums |
9a473ad5a2268efdbb11ab2f46078cbe5b7fa95c73960a9cb12e6a88248741c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.2 Windows/10
|
Release files / collision_warning_service-0.4.1-py3-none-any.whl
| Download URL | collision_warning_service-0.4.1-py3-none-any.whl |
|---|---|
| Size | 40.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
94cb0e41da50ce696818092445ac8fc272d518c0b772f769c33e3638a146fbb1
|
|
BLAKE2b-256 checksum How to use checksums |
b2a03ba5387ce67ad68fe039a76639702cb607b295a63e9ff7d08812800ebe10
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.5.1 CPython/3.11.2 Windows/10
|