Files
FastDeploy/examples/vision/tracking/pptracking/cpp
ChaoII 22d60fdadf [Model] add tracking trail on vis_mot (#461)
* add override mark

* delete some

* recovery

* recovery

* add tracking

* add tracking py_bind and example

* add pptracking

* add pptracking

* iomanip head file

* add opencv_video lib

* add python libs package

Signed-off-by: ChaoII <849453582@qq.com>

* complete comments

Signed-off-by: ChaoII <849453582@qq.com>

* add jdeTracker_ member variable

Signed-off-by: ChaoII <849453582@qq.com>

* add 'FASTDEPLOY_DECL' macro

Signed-off-by: ChaoII <849453582@qq.com>

* remove kwargs params

Signed-off-by: ChaoII <849453582@qq.com>

* [Doc]update pptracking docs

* delete 'ENABLE_PADDLE_FRONTEND' switch

* add pptracking unit test

* update pptracking unit test

Signed-off-by: ChaoII <849453582@qq.com>

* modify test video file path and remove trt test

* update unit test model url

* remove 'FASTDEPLOY_DECL' macro

Signed-off-by: ChaoII <849453582@qq.com>

* fix build python packages about pptracking on win32

Signed-off-by: ChaoII <849453582@qq.com>

* update comment

Signed-off-by: ChaoII <849453582@qq.com>

* add pptracking model explain

Signed-off-by: ChaoII <849453582@qq.com>

* add tracking trail on vis_mot

* add tracking trail

* modify code for  some suggestion

* remove unused import

* fix import bug

Signed-off-by: ChaoII <849453582@qq.com>
Co-authored-by: Jason <jiangjiajun@baidu.com>
2022-11-03 09:57:07 +08:00
..

PP-Tracking C++部署示例

本目录下提供infer.cc快速完成PP-Tracking在CPU/GPU以及GPU上通过TensorRT加速部署的示例。

在部署前,需确认以下两个步骤

以Linux上 PP-Tracking 推理为例在本目录执行如下命令即可完成编译测试如若只需在CPU上部署可在Fastdeploy C++预编译库下载CPU推理库

#下载SDK编译模型examples代码SDK中包含了examples代码
wget https://bj.bcebos.com/fastdeploy/release/cpp/fastdeploy-linux-x64-gpu-0.4.0.tgz
tar xvf fastdeploy-linux-x64-gpu-0.4.0.tgz
cd fastdeploy-linux-x64-gpu-0.4.0/examples/vision/tracking/pptracking/cpp/
mkdir build && cd build
cmake .. -DFASTDEPLOY_INSTALL_DIR=${PWD}/../../../../../../../fastdeploy-linux-x64-gpu-0.4.0
make -j

# 下载PP-Tracking模型文件和测试视频
wget https://bj.bcebos.com/paddlehub/fastdeploy/fairmot_hrnetv2_w18_dlafpn_30e_576x320.tgz
tar -xvf fairmot_hrnetv2_w18_dlafpn_30e_576x320.tgz
wget https://bj.bcebos.com/paddlehub/fastdeploy/person.mp4


# CPU推理
./infer_demo fairmot_hrnetv2_w18_dlafpn_30e_576x320 person.mp4 0
# GPU推理
./infer_demo fairmot_hrnetv2_w18_dlafpn_30e_576x320 person.mp4 1
# GPU上TensorRT推理
./infer_demo fairmot_hrnetv2_w18_dlafpn_30e_576x320 person.mp4 2

以上命令只适用于Linux或MacOS, Windows下SDK的使用方式请参考:

PP-Tracking C++接口

PPTracking类

fastdeploy::vision::tracking::PPTracking(
        const string& model_file,
        const string& params_file = "",
        const string& config_file,
        const RuntimeOption& runtime_option = RuntimeOption(),
        const ModelFormat& model_format = ModelFormat::PADDLE)

PP-Tracking模型加载和初始化其中model_file为导出的Paddle模型格式。

参数

  • model_file(str): 模型文件路径
  • params_file(str): 参数文件路径
  • config_file(str): 推理部署配置文件
  • runtime_option(RuntimeOption): 后端推理配置默认为None即采用默认配置
  • model_format(ModelFormat): 模型格式默认为Paddle格式

Predict函数

PPTracking::Predict(cv::Mat* im, MOTResult* result)

模型预测接口,输入图像直接输出检测结果。

参数

  • im: 输入图像注意需为HWCBGR格式
  • result: 检测结果包括检测框跟踪id各个框的置信度对象类别idMOTResult说明参考视觉模型预测结果