Vehicle direction identification consists of three module detection , tracking and direction recognization.
Algorithm used : Yolo algorithm for detection + SORT algorithm to track vehicles + vector based direction detection
- opencv = '4.5.4-dev'
- scipy = '1.4.1'
- filterpy
- lap
- scikit-image
- I hadn't uploaded model weights and configuration files (which were used for object detection) here because those were already available in yolo_detection repo
- download yolo tiny weights , config file and coco.names file from here : [https://github.com/hasit73/yolo_detection]
- For detection i was using same code which was available in yolo_detection repo.
- Loading model and user configurations
- perform io interfacing tasks
- use opencv modules to detect objects from user given media(photo/video)
- detection take place inside this file
- user configuration are mentioned inside this file
- for examples : input shapes and model parameters(weights file path , config file path etc) are added in config.json
- it have one Tracker class that will be used to track vehicles.
- SORT algorithm implementations
- Kalman filter operations
- Vector based direction recognization
-
clone this directory
-
use following command to run detection and tracking on your custom video
python main.py -c config.json -v <media_path>
Example:
python main.py -c config.json -v car1.mp4
- Note : Before executing this command make sure that you have downloaded model weights and config file for yolo object detection.
- output
demo.mp4
There are few primary drawbacks of this appoach
-
direction recogization totally depends on detection and tracking.
-
if camera properly arranged then it gives accurate results (Suppose any object is in front of camera and come forward towards camera then it gives bad results) but if you try to use this approach in cctv suviellence then it gives satisfactory results.
-
in few cases , it performs bad, because right now it works on only single keypoint (center of object) we can improve its performace by detecting multiple keypoints and use majority votes result.