Package: collision-warning-service
CollisionWarningServiceThe 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.RequirementsThere are few basic requirements for the algorithm itselfnumpypyyamlopencv-pythonorpy-opencvif you use condapillowshapelyfilterpypytorchAdditional packages are required if you want to use the service as a Network Application within 5G-Era framework/era_5g_interfaceera_5g_clientsimple-websocketpython-socketioflaskInstallationGetting started - standalone exampleAs an example, we use the video posted by u/Big-Replacement-7684 inr/IdiotsInCarsshowing typical dangerous situation that might result in car crash.# This will load configurations for video3.mp4 and show visualization.>pythonfcw_example.pyRelevant configurations are invideos/video3.yaml- camera config, andconfig/config.yamlalgorithm settings.Running with your videosCalibrate cameraSetup algorithm parametersRun the exampleNetwork Application for 5G-ERARun FCW service/NetAppDockerThe 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.dockerbuild-ffcw_service.Dockerfile-tbut5gera/fcw_service:0.1.0.\&&dockerrun-p5897:5897--networkhost--gpusallbut5gera/fcw_service:0.1.0Local startupThe FCW Service can also be run locally usingfcw/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):setNETAPP_PORT=5897or on Linux:exportNETAPP_PORT=5897Requirements:gitpython3.8or laterffmpegCUDApoetryAt now, FCW Service package collision-warning-service contains both server and client (examples) parts. This package depends onera-5g-interface>=0.4.1era-5g-client>=0.4.1Clone this repository somewhere first:gitclonehttps://github.com/5G-ERA/CollisionWarningService.gitcdCollisionWarningServiceInstallation of collision-warning-service:cd..
poetryinstallRun FCW service:poetryrunfcw_serviceFor CUDA accelerated version, on Windows may be needed e.g.:pip3install--upgrade--force-reinstalltorchtorchvisiontorchaudio--extra-index-urlhttps://download.pytorch.org/whl/cu118It depends on the version of CUDA on the systemhttps://pytorch.org/get-started/locally/.Run clientSet NETAPP_PORT environment variable (default ishttp://localhost:5896):setNETAPP_ADDRESS=http://localhost:5897or on Linux:exportNETAPP_ADDRESS=http://localhost:5897Run FCW python simple client example:poetryrunfcw_client_python_simple-cconfig/config.yaml--cameravideos/video3.yamlvideos/video3.mp4or run simple client with rtsp stream (yaml files are not compatible with tshi rtsp stream, it is for example only):poetryrunfcw_client_python_simple-cconfig/config.yaml--cameravideos/video3.yamlrtsp://root:upgm_c4m3r4@upgm-ipkam5.fit.vutbr.cz/axis-media/media.ampor run advanced client:poetryrunfcw_client_python-cconfig/config.yaml--cameravideos/video3.yamlvideos/video3.mp4NotesWe use slightly modified version of SORT tracker fromabewleygitub repository.