Skip to content

Detecting traffic using OpenCV and YOLO and tracking the vehicles for counting using Sort

Notifications You must be signed in to change notification settings

green-mint/traffic-counter-using-YOLO-and-OpenCV

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Traffic Detection and Counting Using YOLOv3

Video Visualization Demo

demo video

Data:

The data has been obtained from a youtube video. Click here to download.

Due to the sheer size of the file I had to trim it down to approximately 30 sec to obtain results faster.

Implementation Guide:

  1. Clone the repo and cd into it
$ git clone https://github.com/green-mint/traffic-counter-using-YOLO.git
$ cd traffic-counter-using-YOLO
  1. Download yolov3.weights and move them into the yolov3 directory. Your directory structure should now be similar to
├── demo
│   └── traffic_counter.gif
├── input.mp4
├── README.md
├── requirements.txt
├── tracker.py
├── traffic_main.py
├── utils.py
└── yolov3
    ├── coco.names
    ├── yolov3.cfg
    └── yolov3.weights
  1. Create a new python virtual environment and install the required libraries by running the following commands
$ python3 -m venv path/to/virtual/environment
$ source path/to/virtual/environment/bin/activate
$ pip install -r requirements.txt
  1. Run the traffic-main.py script to test your input video
$ python traffic-main.py --input/-i path/to/input/clip.mp4 --output/-o path/to/output/clip.avi

Additional optional arguments are --confidence/-c and --threshold/-t with default=0.5 and default=0.3 respectively

Citations:

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

Detecting traffic using OpenCV and YOLO and tracking the vehicles for counting using Sort

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages