Giter VIP home page Giter VIP logo

yolov5_fastreid_deepsort_tensorrt's Introduction

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 [email protected]:linghu8812/tensorrt_tracker.git
mkdir build && cd build
cmake ..
make -j

4. Run project

Run the following command

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

results demo:

tensorrt_tracker

Reference

yolov5_fastreid_deepsort_tensorrt's People

Contributors

linghu8812 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.