abuelgasimsaadeldin / yolov5-deepsort-vehicle-counter

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vehicle Detection, Tracking and Counting

This system is able to detect and classify 4 different classes of vehicles including; car, motorcycle, bus and truck and count the number of vehicles in each classes as they pass through a virtual polygon area.

image

Steps to Setup on Nvidia Jetson Nano

1) SWAP Jetson Nano to Free Space

$ sudo systemctl disable nvzramconfig  
$ sudo fallocate -l 4G /mnt/4GB.swap  
$ sudo chmod 600 /mnt/4GB.swap  
$ sudo mkswap /mnt/4GB.swap  
$ sudo su  
$ echo "/mnt/4GB.swap swap swap defaults 0 0" >> /etc/fstab  
$ exit  

REBOOT!   

2) Install torch and torchvision libraries

$ ./install_torch.sh

3) Install OpenCV

$ wget https://github.com/Qengineering/Install-OpenCV-Jetson-Nano/raw/main/OpenCV-4-5-5.sh
$ sudo chmod 755 ./OpenCV-4-5-5.sh
$ ./OpenCV-4-5-5.sh

4) Install requirements (only this step required for running on PC)

$ pip install -r requirements.txt

Run Inference

detect.py: Detects vehicles present in each frame in a video and displays the results. (suitable for videos)

$ python detect.py --source data/vehicle_test_videos/live.mp4

count.py: Detects and counts the number of vehicles present in an images and displays the results. (suitable for images)

$ python count.py --source data/vehicle_test_images/   

track.py: Detects, tracks and counts the number of vehicles as they cross through a virtual polygon area. (suitable for videos)

$ python track.py --source data/vehicle_test_videos/live.mp4

Live Setup

image

About

License:Apache License 2.0


Languages

Language:Python 98.6%Language:Cython 0.8%Language:Cuda 0.2%Language:C++ 0.1%Language:Shell 0.1%Language:Makefile 0.1%