All Projects → duongttr → vehicles-counting-yolov4-deepsort

duongttr / vehicles-counting-yolov4-deepsort

Licence: MIT License
A project for counting vehicles using YOLOv4 + DeepSORT + Flask + Ngrok + TF2

Programming Languages

python
139335 projects - #7 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to vehicles-counting-yolov4-deepsort

Deep-Learning-with-GoogleColab
Deep Learning Applications (Darknet - YOLOv3, YOLOv4 | DeOldify - Image Colorization, Video Colorization | Face-Recognition) with Google Colaboratory - on the free Tesla K80/Tesla T4/Tesla P100 GPU - using Keras, Tensorflow and PyTorch.
Stars: ✭ 63 (+173.91%)
Mutual labels:  darknet, google-colab, yolov4
odam
ODAM - Object detection and Monitoring
Stars: ✭ 16 (-30.43%)
Mutual labels:  darknet, vehicle-counting, yolov4
multi-camera-pig-tracking
Official Implementation of "Tracking Grow-Finish Pigs Across Large Pens Using Multiple Cameras"
Stars: ✭ 25 (+8.7%)
Mutual labels:  deepsort, yolov4
onnx2tensorRt
tensorRt-inference darknet2onnx pytorch2onnx mxnet2onnx python version
Stars: ✭ 14 (-39.13%)
Mutual labels:  darknet, yolov4
yolo deepsort
Fast MOT base on yolo+deepsort, support yolo3 and yolo4
Stars: ✭ 47 (+104.35%)
Mutual labels:  deepsort, yolov4
Tensorflow Yolov4 Tflite
YOLOv4, YOLOv4-tiny, YOLOv3, YOLOv3-tiny Implemented in Tensorflow 2.0, Android. Convert YOLO v4 .weights tensorflow, tensorrt and tflite
Stars: ✭ 1,881 (+8078.26%)
Mutual labels:  tf2, yolov4
yolor
implementation of paper - You Only Learn One Representation: Unified Network for Multiple Tasks (https://arxiv.org/abs/2105.04206)
Stars: ✭ 1,867 (+8017.39%)
Mutual labels:  darknet, yolov4
go-darknet
Go bindings for Darknet (YOLO v4 / v3)
Stars: ✭ 56 (+143.48%)
Mutual labels:  darknet, yolov4
simpleAICV-pytorch-ImageNet-COCO-training
SimpleAICV:pytorch training example on ImageNet(ILSVRC2012)/COCO2017/VOC2007+2012 datasets.Include ResNet/DarkNet/RetinaNet/FCOS/CenterNet/TTFNet/YOLOv3/YOLOv4/YOLOv5/YOLOX.
Stars: ✭ 276 (+1100%)
Mutual labels:  darknet, yolov4
object-detection-indonesian-traffic-signs-using-yolo-algorithm
Pendeteksian rambu lalu lintas khas Indonesia menggunakan dataset custom dan menggunakan algoritma Deep Learning You Only Look Once v4
Stars: ✭ 26 (+13.04%)
Mutual labels:  darknet, yolov4
darknet
php ffi darknet
Stars: ✭ 21 (-8.7%)
Mutual labels:  darknet, yolov4
onnx tensorrt project
Support Yolov5(4.0)/Yolov5(5.0)/YoloR/YoloX/Yolov4/Yolov3/CenterNet/CenterFace/RetinaFace/Classify/Unet. use darknet/libtorch/pytorch/mxnet to onnx to tensorrt
Stars: ✭ 145 (+530.43%)
Mutual labels:  darknet, yolov4
YOLOv4-Hat-detection
基于YOLOv4的安全帽佩戴检测
Stars: ✭ 57 (+147.83%)
Mutual labels:  yolov4
Creators.TF-Community-Launcher
The Creators.TF Community Launcher is a launcher created to help install and update mod content for TF2.
Stars: ✭ 49 (+113.04%)
Mutual labels:  tf2
facenet-darknet-inference
Face recognition using facenet
Stars: ✭ 29 (+26.09%)
Mutual labels:  darknet
pgrok
Free Introspected tunnels to localhost, like ngrok but free and unlimited
Stars: ✭ 244 (+960.87%)
Mutual labels:  ngrok
neptune-examples
Examples of using Neptune to keep track of your experiments (maintenance only).
Stars: ✭ 22 (-4.35%)
Mutual labels:  google-colab
bert quora question pairs
BERT Model Fine-tuning on Quora Questions Pairs
Stars: ✭ 28 (+21.74%)
Mutual labels:  google-colab
labelReader
Programmatically find and read labels using Machine Learning
Stars: ✭ 44 (+91.3%)
Mutual labels:  darknet
darknet ros
Robotics Operating System Package for Yolo v3 based on darknet with optimized tracking using Kalman Filter and Optical Flow.
Stars: ✭ 51 (+121.74%)
Mutual labels:  darknet

Vehicles Counting using YOLOv4 + DeepSORT + Flask + Ngrok

🚙 🛵 🚛 🚌

A project for counting vehicles using YOLOv4 for training, DeepSORT for tracking, Flask for deploying to web (watch result purpose only) and Ngrok for public IP address

Getting Started

This project has 3 main parts:

  1. Preparing data
  2. Training model using the power of YOLOv4
  3. Implementing DeepSORT algorithm for counting vehicles

Shortcuts

Note: For private reason, please ask for permission before using datasets and pre-trained model!

Shortcuts Links
📕 Colab notebooks Part 1, Part 2, Part 3
📀 Datasets Daytime, Nighttime
🚂 My pre-trained model GGDrive Mirror (Works well in well-lit conditions)

Preparing data

Preparing data notebook

I splitted my data into 2 scenes: daytime and nighttime, and training 8 classes (4 classes each scene, which are motorbike, car, bus, truck).

Prepare your own data or you can download my cleaned data with annotations:

If you prepare your own data, remember your annotation files fit this format:

  1. Every image has its own annotation file (.txt)
  2. Each file contains a list of objects' bounding box (read this for more details):
<object-id> <x> <y> <width> <height>
...

Training model using YOLOv4

Training model notebook

Training model on your local computer is really complicated in environment installation and slow-like-a-snail if you don't have a powerful GPU. In this case, I used Google Colab.

Read more: Testing your trained model on local machine with OpenCV

Implementing DeepSORT algorithm for counting vehicles

Implementing DeepSORT notebook

First, setting up environment on your machine:

Conda (Recommended)

# Tensorflow CPU
conda env create -f conda-cpu.yml
conda activate yolov4-cpu

# Tensorflow GPU
conda env create -f conda-gpu.yml
conda activate yolov4-gpu

Pip

(TensorFlow 2 packages require a pip version > 19.0.)

# TensorFlow CPU
pip install -r requirements.txt

# TensorFlow GPU
pip install -r requirements-gpu.txt

# Google Colab
!pip install -r requirements-colab.txt

Convert YOLOv4 model to Tensorflow Keras

Copy your trained model in previous part to this project and run save_model.py in cmd:

  • --weights: Path to .weights file (your trained model)
  • --output: Path to converted model.
  • --model: Model version (yolov4 in this case)
python save_model.py --weights ./yolov4_final.weights --output ./checkpoints/yolov4-416 --model yolov4

Download my .weights model if you want: GGDrive mirror

Counting now!

Import VehiclesCounting class in object_tracker.py file and using run() to start running:

# Import this main file
from object_tracker import VehiclesCounting

# Initialize
# check the list of parameters below to modify values as you want
# check object_tracker.py file to check the default values

vc = VehiclesCounting()

# Run it
vc.run()

VehicleCounting's parameters:

  • file_counter_log_name: input your file counter log name
  • framework: choose your model framework (tf, tflite, trt)
  • weights: path to your .weights
  • size: resize images to
  • tiny: (yolo,yolo-tiny)
  • model: (yolov3,yolov4)
  • video: path to your video or set 0 for webcam or youtube url
  • output: path to your results
  • output_format: codec used in VideoWriter when saving video to file
  • iou: iou threshold
  • score: score threshold
  • dont_show: dont show video output
  • info: show detailed info of tracked objects
  • detect_line_position: (0..1) of height of video frame.
  • detect_line_angle: (0..180) degrees of detect line.

Contact me

References

I want to give my big thanks to all of these authors' repo:

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].