基于yolov5+fastreid+deepsort的TensorRT目标跟踪

13 篇文章 2 订阅
11 篇文章 3 订阅

Object Tracking with TensorRT

Introduction

This is an implementation for object tracking in cplusplus code. The object detector uses yolov5s model. The idea of deepsort is adopted in object tracking. The implementation of sort refers to the sort-cpp. When extracting object features, it is extracted through the fast-reid trained model, and the person ReID uses mobilenetv2. The purpose of using these lightweight models is to ensure the real-time efficiency of video processing. The model inference base on TensorRT engine.

How to run?

0. Build environments

The TenosrRT environments build from Dockerfile, run with the following command.

docker build -t tensorrt_tracker:0.1.0_rc .

Following yolov5 and fast-reid requirements file to install their depends packages.

1. Transform PyTorch weights to ONNX

  • Transform yolov5 weights

Use this yolov5 repo to transform yolov5 *.pt weights to ONNX models. Run the following command

git clone https://github.com/linghu8812/yolov5.git
python3 export.py ---weights weights/yolov5s.pt --batch-size 1 --imgsz 640 --include onnx --simplify

A pretrained yolov5 ONNX detection model can be downloaded form here, link: https://pan.baidu.com/s/1RUz7Xk78lvKCeZNk_BBvoQ, code: jung. download this model and put it to the weights folder.

  • Transform fastreid weights

Use official fast-reid to transform PyTorch weights to ONNX model. Run the following command

https://github.com/JDAI-CV/fast-reid.git
python3 tools/deploy/onnx_export.py --config-file configs/Market1501/mgn_R50-ibn.yml --name mgn_R50-ibn --output outputs/onnx_model --batch-size 32 --opts MODEL.WEIGHTS market_mgn_R50-ibn.pth

A pretrained fast-reid ONNX detection model can be downloaded form here, link: https://pan.baidu.com/s/19TuHxxuVYLBzie5_Vu0cCQ, code: 1e35. download this model and put it to the weights folder.

2. Get video for inference ready

Put video file for inference to samples folder. Here is a video demo for inference can be used: https://pan.baidu.com/s/1Yyh1lwmzNl_gjvNz9EVI5w, code: fpi0.

3. Build project

Run the following command

git clone git@github.com:linghu8812/tensorrt_tracker.git
mkdir build && cd build
cmake ..
make -j
  1. Run project

Run the following command

./object_tracker ../configs/config.yaml ../samples/test.mpg

results demo:

在这里插入图片描述

Reference

评论 21
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值