Skip to content

rukon-uddin/Yolov5-DeepSort-Heatmap

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Use this repo to only use tracking: https://github.com/yasarniyazoglu/YoloV5-and-DeepSort-Custom-Dataset
Thanks to: https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch

Yolov5 + Deep Sort with PyTorch + Heatmap

Introduction

This repository contains a two-stage-tracker. The detections generated by YOLOv5, a family of object detection architectures and models pretrained on the COCO dataset, are passed to a Deep Sort algorithm which tracks the objects. It can track and draw the heatmap of any object that your Yolov5 model was trained to detect. In my case I used only person to draw the heatmap.

Before you run the HeatMap

  1. Clone the repository recursively:

git clone https://github.com/rukon-uddin/Yolov5-DeepSort-Heatmap.git

  1. Run:

pip install -r requirements.txt

Tracking sources and Draw Heatmap

Tracking can be run on most video formats

python track.py --source ... --show-vid
  • Video: --source file.mp4, *.avi
  • Webcam: --source 0
  • RTSP stream: --source rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa
  • HTTP stream: --source http://wmccpinetop.axiscam.net/mjpg/video.mjpg

Select a Yolov5 family model

There is a clear trade-off between model inference speed and accuracy. In order to make it possible to fulfill your inference speed/accuracy needs you can select a Yolov5 family model for automatic download

$ python track.py --source 0 --yolo_weights yolov5s.pt --img 640
                                            yolov5m.pt
                                            yolov5l.pt 
                                            yolov5x.pt --img 1280

Draw HeatMap of single class

By default the tracker tracks and draws heatmap of all MS COCO classes. But its very convenient to only draw heatmap of a single class, for example you want to check the car intensity on the road, or person intensity on a street.

If you only want to track persons I recommend you to get these weights for increased performance

python3 track.py --source 0 --yolo_weights yolov5/weights/crowdhuman_yolov5m.pt --classes 0  # tracks persons, only

If you want to track a subset of the MS COCO classes, add their corresponding index after the classes flag

python3 track.py --source 0 --yolo_weights yolov5s.pt --classes 16 17  # tracks cats and dogs, only

Here is a list of all the possible objects that a Yolov5 model trained on MS COCO can detect. Notice that the indexing for the classes in this repo starts at zero.

About

Get HeatMap of any object using this repo

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages