Skip to content

Detect and track vehicles on a video stream and count those going through a defined line.

Notifications You must be signed in to change notification settings

bharath5673/python-traffic-counter-with-yolo-and-sort

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Traffic Counter

The purpose of this project is to detect and track vehicles on a video stream and count those going through a defined line.

highway.gif

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.

Quick Start

  1. Download the code to your computer.
  2. Download yolov3.weights and place it in /yolo-coco.
  3. Make sure you have Python 3.7.0 and OpenCV 3.4.2 installed.
  4. Run:
$ python main.py --input input/highway.mp4 --output output/highway.avi --yolo yolo-coco

Citation

YOLO :

@article{redmon2016yolo9000,
  title={YOLO9000: Better, Faster, Stronger},
  author={Redmon, Joseph and Farhadi, Ali},
  journal={arXiv preprint arXiv:1612.08242},
  year={2016}
}

SORT :

@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}
}

About

Detect and track vehicles on a video stream and count those going through a defined line.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%