The purpose of this project is to detect and track vehicles on a video stream and count those going through a defined line.
It uses:
-
YOLO to detect objects on each of the video frames.
-
SORT to track those objects over different frames.
Once the objects are detected and tracked over different frames a simple mathematical calculation is applied to count the intersections between the vehicles previous and current frame positions with a defined line.
The code on this prototype uses the code structure developed by Adrian Rosebrock for his article YOLO object detection with OpenCV.
- Download the code to your computer.
- Download yolov3.weights and place it in
/yolo-coco
. - Make sure you have Python 3.7.0 and OpenCV 3.4.2 installed.
- Run:
$ python main.py --input input/highway.mp4 --output output/highway.avi --yolo yolo-coco
@article{redmon2016yolo9000,
title={YOLO9000: Better, Faster, Stronger},
author={Redmon, Joseph and Farhadi, Ali},
journal={arXiv preprint arXiv:1612.08242},
year={2016}
}
@inproceedings{Bewley2016_sort,
author={Bewley, Alex and Ge, Zongyuan and Ott, Lionel and Ramos, Fabio and Upcroft, Ben},
booktitle={2016 IEEE International Conference on Image Processing (ICIP)},
title={Simple online and realtime tracking},
year={2016},
pages={3464-3468},
keywords={Benchmark testing;Complexity theory;Detectors;Kalman filters;Target tracking;Visualization;Computer Vision;Data Association;Detection;Multiple Object Tracking},
doi={10.1109/ICIP.2016.7533003}
}