Coder Social home page Coder Social logo

pankajrawat9075 / yolov5-vehicle-counting Goto Github PK

View Code? Open in Web Editor NEW

This project forked from charnkanit/yolov5-vehicle-counting

0.0 0.0 0.0 64.93 MB

A computer vision and artificial intelligence project to detect and counting vehicles. This project is using YOLOV5 and Deep Sort Algorithm to perform object recognition and tracking realtime.

Shell 1.38% Python 88.10% Jupyter Notebook 9.99% Dockerfile 0.53%

yolov5-vehicle-counting's Introduction

Yolov5-Vehicle-Counting

A computer vision and artificial intelligence project to detect and counting vehicles.

Description

This project is using YOLOV5 and Deep Sort Algorithm to perform object recognition and tracking realtime.

Dependencies

  • OS: Windows/ Linux
  • Python >= 3.8
pip install -r requirement.txt

Installing

Executing track.py to track and count object

  1. Media source
$ python track.py --source 0  # webcam
                           img.jpg  # image
                           vid.mp4  # video
                           path/  # whole directory
                           'https://youtu.be/link'  # YouTube
                           'rtsp://example.com/media.mp4'  # RTSP, RTMP, HTTP stream
  1. Yolo Model
$ python track.py --source 0 --yolo_model yolov5n.pt 
                                          yolov5s.pt 
                                          yolov5m.pt       
                                          yolov5l.pt 
                                          yolov5x.pt 
                                          ...
  1. Image size (pixels)
$ python track.py --source 0 --yolo_model yolov5n.pt --img 640  
                                                     --img 1280 
                       
  1. How to save output
$ python track.py --source 0 --yolo_model yolov5n.pt --img 640  --save-vid
                                                                --show-vid
                                                                --save-txt

Train your own weight with custom data

  1. Change to yolov5 directory
$ cd yolov5
  1. Prepare your custom data in /datasets directory

create datasets/data.yaml

$ cd datasets
$ nano data.yaml
# example of data.yaml
names:
- Car
- Motorcycle
- Truck
- Bus
- Bicycle
nc: 5                           #no. of classes
train: dataset/train/images     # path to train images directory
val: dataset/valid/images       # path to validation images directory

create train and validation directory

$ mkdir train valid
$ mkdir train/images train/labels valid/images valid/labels

check the directories are existed

$ ls */

# the output should be look like this
# 
# train/:
# images labels labels.cache
#
# valid/:
# images labels labels.cache
  1. Put dataset in /datasets/train and /datasets/valid directories
  1. Edit yolo config in /models or download from https://github.com/ultralytics/yolov5/tree/master/models
$ nano /models/yolov5.yaml

# Example in case of using yolov5m.yaml -> change no. of classes in parameters section to match your classes. Like below!
# Parameters
nc: 5 #  <--- this one (number of classes)
depth_multiple: 0.67  # model depth multiple
width_multiple: 0.75  # layer channel multiple
anchors:
  - [10,13, 16,30, 33,23]  # P3/8
  - [30,61, 62,45, 59,119]  # P4/16
  - [116,90, 156,198, 373,326]  # P5/32
                  .
                  .
                  .
  1. Run train.py (ex. img_size = 640px, batch_size = 16, epochs = 3)

For new train weight

$ python train.py --img 640 --batch 16 --epochs 48 --data models/custom_yolov5.yaml --weights '' --cache

For continue trained weight (trained weight name = 'custom_yolov5.pt')

$ python train.py --img 640 --batch 16 --epochs 48 --data models/custom_yolov5.yaml --weights custom_yolov5.pt --cache

Acknowledgments

Ultralytics (Yolov5)

Mikel Broström (Yolov5 + Deep Sort with OSNet)

MaryamBoneh (Vehicles Dataset)

Contributor

yolov5-vehicle-counting's People

Contributors

charnkanit avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.