tensorrt_yolov5_tracker icon indicating copy to clipboard operation
tensorrt_yolov5_tracker copied to clipboard

This is a project to deploy object tracking algorithm with yolov5 and TensorRT. Sort and Deep-sort algorithm are used to track the objects.(本项目用tensorrt进行目标跟踪的部署,检测器采用yolov5,跟踪...

tensorrt_yolov5_tracker

This is a project to deploy object tracking algorithm with yolov5 and TensorRT. Sort and Deep-sort algorithm are used to track the objects. Thanks for the contribution of tensorrtx and sort-cpp! Now this project implements the tracki algorithm with yolov5 and sort(c++ version). Deep-sort, multi-thread acceleration and python implemention will be updated soon. Please give a star if this project helps ^_^

example result of object tracking

Table of Contents

  • ToDo
  • Install
  • Usage
  • Reference
  • License

ToDo

1.Deep-sort tracker.

2.Multi-thread acceleration for c++.

3.Python implemention.

Install

$ git https://github.com/AsakusaRinne/tensorrt_yolov5_tracker.git
$ cd tensorrt_yolov5_tracker
$ mkdir build
$ cd build
$ cmake ..
$ make

Usage

You could change the batch size in yolov5/yolov5.h You could change the input image size in yolov5/yololayer.h

We provide the support for building models of yolov5-3.1 and yolov5-4.0 in our project. The default branch is corresponding to yolov5-4.0. Please change to c269f65 if you want to use yolov5-3.1 models to build engines.

If other versions are wanted, please kindly refer to tensorrtx to build the engine and then copy to the folder of this project.

Build engine

At first, please put the yolov5/gen_wts.py in the folder of corresponding version of Yolov5. For example, if you use the model of yolov5-4.0, please download the release of yolov5-4.0 and put the gen_wts.py in its folder. Then run the code to convert model from .pt to .wts. Then please use the following instructions to build your engines.

$ sudo ./Tracker -s [.wts filename] [.engine filename] [s, m, l, or x] # build yolov5 model of [s, m, l, or x]

$ sudo ./Tracker -s  [.wts filename] [.engine filename] [depth] [width] # build yolov5 model of scales which are not s, m, l, or x
**for example**
$ sudo ./Tracker -s  ../yolov5/weights/yolov5.wts ../engines/yolov5.engine 0.17 0.25

Process video

$ sudo ./Tracker -v [video filename] [engine filename]

The output video will be in the folder output Note that the track time includes the time of drawing boxes on images and saving them to the disk, which makes it a little long. You can delete the codes for drawing and saving if they are not needed to accelerate the process.

Reference

tensorrtx

Yolov5

sort-cpp

License

MIT license