WuPedin / Multi-class_Yolov5_DeepSort_Pytorch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Multi-class Yolov5 + Deep Sort with PyTorch

Introduction

This repository is modified from mikel-brostrom/Yolov5_DeepSort_Pytorch (https://github.com/mikel-brostrom/Yolov5_DeepSort_Pytorch). I fixed some bugs and extend it to multi-class version.It contains YOLOv5 (https://github.com/ultralytics/yolov5) and Deep Sort (https://github.com/ZQPei/deep_sort_pytorch). The deep sort model in this repository was only trained by pedestrians.

Requirements

Python 3.6 or later with all requirements.txt dependencies installed, including torch>=1.6. To install run:

pip install -U -r requirements.txt

All dependencies are included in the associated docker images. Docker requirements are:

  • nvidia-docker
  • Nvidia Driver Version >= 440.44

Alternatively, you can build a docker image by Dockerfile supplied here if you use Centos7.

  • sudo docker pull nvidia/cuda:10.1-cudnn7-devel-centos7
  • sudo docker build -t [image_name] .
  • sudo docker run --runtime=nvidia --name [container_name] --shm-size [8G] -t -i [image_name:tag] /bin/bash

Download Weights

Download Sample Video

Tracking

Tracking can be run on most video formats. Results are saved to ./inference/output.

python3 track.py --source nba.mp4 --weights nba.pt --device ...
  • 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

Train Yolov5

  • Put your images in dataset/images and annotations(in PASCAL format) in dataset/annotations.
  • Modify yolov5/data/data.yaml
  • python3 label_split.py
  • cd yolov5
  • CUDA_VISIBLE_DEVICE=... python3 train.py --img 640 --batch 16 --epochs 500 --data ./data/data.yaml --cfg ./models/yolov5s.yaml --weights weights/nba.pt

Reference

For more details, you can check three orgin repositories.

About


Languages

Language:Python 95.7%Language:Shell 2.0%Language:Cuda 1.2%Language:C++ 0.9%Language:Dockerfile 0.1%Language:C 0.1%Language:HTML 0.0%