Giter VIP home page Giter VIP logo

yolov7_deepsort_tensorrt's Introduction

Object Tracking with TensorRT

Introduction

This is an implementation of MOT tracking algorithm deep sort cplusplus code. Deep sort is basicly the same with sort but added a CNN model to extract features in image of human part bounded by a detector. This CNN model is indeed a RE-ID model. The idea of deepsort is adopted in object tracking.

We use yolov7 model as the object detector. And the feature extractor is RE-ID model as which fast-reid is used. The purpose of using these lightweight models is to ensure the real-time efficiency of video processing. The model inference base on TensorRT engine. It also supports yolov5 as a detector.

Model

Object detection

  • YOLOV7
  • YOLOV5s

ReID

  • fast-reid(mobilenet-v2)

Project structure

Expand
yolov7_deepsort_tensorrt/
|-- build
|-- configs
|-- depends
|   `-- yaml-cpp
|       |-- include
|       |   `-- yaml-cpp
|       |       |-- contrib
|       |       `-- node
|       |           `-- detail
|       `-- libs
|-- includes
|-- samples
|-- scripts
|-- src
`-- weights

Dependencies

Expand
OpenCV >= 4.1.1
CUDA Version: 11.1
CUDNN Version: 8.1.0
Tensorrt: 7.2.2
Yaml: 0.7.0

Quick Start

Expand

0. Check all dependencies installed

see Dependencies for more detail.

1. Clone this repository and models

1.1 Get this repository

git clone https://github.com/xuarehere/yolov7_deepsort_tensorrt.git

1.2 Get the models

cd scripts/
bash scripts/get_weight.sh

In addition, you could get the model from the releases. Then, the step2 and the step3 could be skipped Optionally.

2. Get detector parameters(Optionally)

cd weights
# Get model parameters
cd ../

yolov7

Please use the unofficial project unofficial-yolov7 to get the ONNX model. Run the following command

git clone https://github.com/linghu8812/yolov7.git
cd yolov7
python export.py --weights ./weights/yolov7.pt --simplify --grid 

3. Get ReID parameters(Optionally)

cd weights
# Get model parameters
cd ../

Please use the official project fast-reid to get the 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

4. Prepare video for inference

We provide a default video for inference(001.avi). You could change it with yours.

5. Buid project

5.1 Use build.sh

cd scripts
bash build.sh

If the directory ./build exists, you want to remove it and build it again, please use the command:

cd scripts
bash build.sh rm

5.2 Build it manually

mkdir build 
cd scripts
cd ../build/  && cmake .. && make -j$(nproc) && cd -

6. Run demo

cd scripts
bash yolov7_deepsort.sh

Demo videos and images

Reference

Expand

yolov7_deepsort_tensorrt's People

Contributors

xuarehere avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

yolov7_deepsort_tensorrt's Issues

How to get #include <cuda_runtime_api.h>

My cuda,cudnn,yaml,tensorrt is the same as yours
but when i am camke ,it show No CUDA toolset found.

my cmake is 3.20.0.
Can you tell me how to get <cuda_runtime_api.h>?
thank you very much

asert(engine->getNbBindings() == 2) error

I did a custom train at Yolov7
asert(engine->getNbBindings() == 2);
In this code, getNbBindings() has a value of 5
Are there any issues I need to pay attention to in train?

'''
[W] [TRT] CUDA lazy loading is not enabled. Enabling it can significantly reduce device memory usage. See CUDA_MODULE_LOADING in https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#env-vars
alta-yolov7-deepsort: ../alta-yolov7-deepsort/model.cpp:96: void Model::LoadEngine(): Assertion `engine->getNbBindings() == 2' failed.
'''

How to batch input

Hello

Thank you for your good code.

I have a question about batch input....

I change config file BATCH_SIZE: 1 to BATCH_SIZE: 2.
Then, I just change add the same image as like below.

    vec_org_img.push_back(src_img);
    vec_org_img.push_back(src_img);

But ... There is some bug.

What should I do for batch input processing?

:-)

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.