Files
FastDeploy/examples/vision/keypointdetection/det_keypoint_unite/cpp
huangjianhui b565c15bf7 [Model] Add tinypose single && pipeline model (#177)
* Add tinypose model

* Add PPTinypose python API

* Fix picodet preprocess bug && Add Tinypose examples

* Update tinypose example code

* Update ppseg preprocess if condition

* Update ppseg backend support type

* Update permute.h

* Update README.md

* Update code with comments

* Move files dir

* Delete premute.cc

* Add single model pptinypose

* Delete pptinypose old code in ppdet

* Code format

* Add ppdet + pptinypose pipeline model

* Fix bug for posedetpipeline

* Change Frontend to ModelFormat

* Change Frontend to ModelFormat in __init__.py

* Add python posedetpipeline/

* Update pptinypose example dir name

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Create keypointdetection_result.md

* Create README.md

* Create README.md

* Create README.md

* Update README.md

* Update README.md

* Create README.md

* Fix det_keypoint_unite_infer.py bug

* Create README.md

* Update PP-Tinypose by comment

* Update by comment

* Add pipeline directory

* Add pptinypose dir

* Update pptinypose to align accuracy

* Addd warpAffine processor

* Update GetCpuMat to  GetOpenCVMat

* Add comment for pptinypose && pipline

* Update docs/main_page.md

* Add README.md for pptinypose

* Add README for det_keypoint_unite

* Remove ENABLE_PIPELINE option

* Remove ENABLE_PIPELINE option

* Change pptinypose default backend

* PP-TinyPose Pipeline support multi PP-Detection models

* Update pp-tinypose comment

* Update by comments

* Add single test example

Co-authored-by: Jason <jiangjiajun@baidu.com>
2022-10-21 09:28:23 +08:00
..

PP-PicoDet + PP-TinyPose (Pipeline) C++部署示例

本目录下提供det_keypoint_unite_infer.cc快速完成多人模型配置 PP-PicoDet + PP-TinyPose 在CPU/GPU以及GPU上通过TensorRT加速部署的单图多人关键点检测示例。执行如下脚本即可完成

注意: PP-TinyPose单模型独立部署请参考PP-TinyPose 单模型

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

以Linux上推理为例在本目录执行如下命令即可完成编译测试

wget https://bj.bcebos.com/fastdeploy/release/cpp/fastdeploy-linux-x64-gpu-0.3.0.tgz
tar xvf fastdeploy-linux-x64-gpu-0.3.0.tgz
cd fastdeploy-linux-x64-gpu-0.3.0/examples/vision/keypointdetection/tiny_pose/cpp/
mkdir build
cd build
cmake .. -DFASTDEPLOY_INSTALL_DIR=${PWD}/../../../../../../../fastdeploy-linux-x64-gpu-0.3.0
make -j

# 下载PP-TinyPose和PP-PicoDet模型文件和测试图片
wget https://bj.bcebos.com/paddlehub/fastdeploy/PP_TinyPose_256x192_infer.tgz
tar -xvf PP_TinyPose_256x192_infer.tgz
wget https://bj.bcebos.com/paddlehub/fastdeploy/PP_PicoDet_V2_S_Pedestrian_320x320_infer.tgz
tar -xvf PP_PicoDet_V2_S_Pedestrian_320x320_infer.tgz
wget https://bj.bcebos.com/paddlehub/fastdeploy/000000018491.jpg

# CPU推理
./infer_demo PP_PicoDet_V2_S_Pedestrian_320x320_infer PP_TinyPose_256x192_infer 000000018491.jpg 0
# GPU推理
./infer_demo PP_PicoDet_V2_S_Pedestrian_320x320_infer PP_TinyPose_256x192_infer 000000018491.jpg 1
# GPU上TensorRT推理
./infer_demo PP_PicoDet_V2_S_Pedestrian_320x320_infer PP_TinyPose_256x192_infer 000000018491.jpg 2

运行完成可视化结果如下图所示

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

PP-TinyPose C++接口

PP-TinyPose类

fastdeploy::pipeline::PPTinyPose(
        fastdeploy::vision::detection::PPYOLOE* det_model,
        fastdeploy::vision::keypointdetection::PPTinyPose* pptinypose_model)

PPTinyPose Pipeline模型加载和初始化。

参数

  • model_det_modelfile(fastdeploy::vision::detection): 初始化后的检测模型,参考PP-TinyPose
  • pptinypose_model(fastdeploy::vision::keypointdetection): 初始化后的检测模型Detection暂时只提供PaddleDetection系列

Predict函数

PPTinyPose::Predict(cv::Mat* im, KeyPointDetectionResult* result)

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

参数

  • im: 输入图像注意需为HWCBGR格式
  • result: 关键点检测结果,包括关键点的坐标以及关键点对应的概率值, KeyPointDetectionResult说明参考视觉模型预测结果

类成员属性

后处理参数

  • detection_model_score_threshold(bool): 输入PP-TinyPose模型前Detectin模型过滤检测框的分数阈值