Skip to content

Aditya-Sihmar/women_safety

Repository files navigation

Yolov5 + Deep Sort with PyTorch

Introduction

This repository contains a two-stage-tracker. The detections generated by YOLOv5 (https://github.com/ultralytics/yolov5) are passed to a Deep Sort algorithm (https://github.com/ZQPei/deep_sort_pytorch) which tracks the objects. It can track any object that your Yolov5 model was trained to detect.

Tutorials

Before you run the tracker

  1. Make sure that you fulfill all the requirements: Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.7. To install, run:

pip install -r requirements.txt

  1. Clone the repository recursively:

git clone --recurse-submodules https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch.git

If you already cloned and forgot to use --recurse-submodules you can run git submodule update --init

  1. Github block pushes of files larger than 100 MB. Hence you need to download two different weights: the ones for yolo and the ones for deep sort

Tracking sources

Tracking can be run on most video formats

python3 track.py --source ...
  • Video: --source file.mp4
  • Webcam: --source 0
  • RTSP stream: --source rtsp://170.93.143.139/rtplive/470011e600ef003a004ee33696235daa
  • HTTP stream: --source http://wmccpinetop.axiscam.net/mjpg/video.mjpg

Filter tracked classes

By default the tracker tracks class 0, this is, persons. In this case I recommend you to get these weights for increased performance

parser.add_argument('--classes', nargs='+', default=[0], type=int, help='filter by class') # tracks persons only

If you want to track all 80 MS COCO classes just delete the default value

parser.add_argument('--classes', nargs='+', type=int, help='filter by class') # tracks all MS COCO classes

If you want to select only a few classes to track add their associated integer to default

parser.add_argument('--classes', nargs='+', default=[16, 17], type=int, help='filter by class') # 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.

MOT compliant results

Can be saved to inference/output by

python3 track.py --source ... --save-txt

Other information

For more detailed information about the algorithms and their corresponding lisences used in this project access their official github implementations.

About

AI model to ensure women safety in public places

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages