- 人工智能
- 深度学习
- 计算机视觉
【免费下载链接】PaddleDetection
Object Detection toolkit based on PaddlePaddle. It supports object detection, instance segmentation, multiple object tracking and real-time multi-person keypoint detection.
FastDeploy 是 PaddleDetection 官方推荐的跨平台推理部署方案,支持在 NVIDIA GPU、X86 CPU、飞腾 CPU、ARM CPU 以及 Intel GPU(独立/集成显卡)上快速部署目标检测与关键点检测模型。本文以仓库中 deploy/fastdeploy/cpu-gpu/README.md 为主线,完整覆盖"使用预导出模型快速体验 → 自行导出部署模型 → Python/C++ 部署示例 → 底层 Runtime 配置解析"的全流程,帮助你用一套统一的 API 把 PP-YOLOE、PicoDet、PP-TinyPose 等模型落地到 CPU/GPU 乃至 TensorRT 加速环境。
1. 方案说明:一套 FastDeploy,多硬件覆盖
PaddleDetection 借助 FastDeploy 实现检测模型的跨硬件部署,原生支持的硬件包括:
- NVIDIA GPU(通过 Paddle Inference 后端或 TensorRT 加速)
- X86 CPU(如 Intel 系列处理器)
- 飞腾 CPU(国产化场景)
- ARM CPU(嵌入式/边缘设备)
- Intel GPU(独立显卡/集成显卡)
FastDeploy 对模型系列做了统一的抽象:PPYOLOE、PicoDet、PaddleYOLOX、PPYOLO、FasterRCNN、SSD、PaddleYOLOv5、PaddleYOLOv6、PaddleYOLOv7、RTMDet、CascadeRCNN、PSSDet、RetinaNet、PPYOLOESOD、FCOS、TTFNet、TOOD、GFL等所有类名的构造函数和预测函数在参数上完全一致。这意味着你只需要吃透一个模型的示例(例如 PP-YOLOE),即可举一反三调用全部模型,这一设计贯穿 Python 与 C++ 两套接口。
2. 快速上手:使用预导出的模型列表
为了方便开发者测试,仓库提供了 PaddleDetection 导出的各系列推理模型(.tgz压缩包,解压后即包含model.pdmodel、model.pdiparams、infer_cfg.yml三个文件),可直接下载运行。其中精度指标来源于 PaddleDetection 对各模型的官方介绍。
2.1 目标检测及实例分割模型
| 模型 | 参数大小 | 精度 | 备注 |
|---|---|---|---|
| picodet_l_320_coco_lcnet | 23MB | Box AP 42.6% | |
| ppyoloe_crn_l_300e_coco | 200MB | Box AP 51.4% | |
| ppyoloe_plus_crn_m_80e_coco | 83.3MB | Box AP 49.8% | |
| ppyolo_r50vd_dcn_1x_coco | 180MB | Box AP 44.8% | 暂不支持TensorRT |
| ppyolov2_r101vd_dcn_365e_coco | 282MB | Box AP 49.7% | 暂不支持TensorRT |
| yolov3_darknet53_270e_coco | 237MB | Box AP 39.1% | |
| yolox_s_300e_coco | 35MB | Box AP 40.4% | |
| faster_rcnn_r50_vd_fpn_2x_coco | 160MB | Box AP 40.8% | 暂不支持TensorRT |
| mask_rcnn_r50_1x_coco | 128M | Box AP 37.4%, Mask AP 32.8% | 暂不支持TensorRT、ORT |
| ssd_mobilenet_v1_300_120e_voc | 24.9M | Box AP 73.8% | 暂不支持TensorRT、ORT |
| ssd_vgg16_300_240e_voc | 106.5M | Box AP 77.8% | 暂不支持TensorRT、ORT |
| ssdlite_mobilenet_v1_300_coco | 29.1M | 暂不支持TensorRT、ORT | |
| rtmdet_l_300e_coco | 224M | Box AP 51.2% | |
| rtmdet_s_300e_coco | 42M | Box AP 44.5% | |
| yolov5_l_300e_coco | 183M | Box AP 48.9% | |
| yolov5_s_300e_coco | 31M | Box AP 37.6% | |
| yolov6_l_300e_coco | 229M | Box AP 51.0% | |
| yolov6_s_400e_coco | 68M | Box AP 43.4% | |
| yolov7_l_300e_coco | 145M | Box AP 51.0% | |
| yolov7_x_300e_coco | 277M | Box AP 53.0% | |
| cascade_rcnn_r50_fpn_1x_coco | 271M | Box AP 41.1% | 暂不支持TensorRT、ORT |
| cascade_rcnn_r50_vd_fpn_ssld_2x_coco | 271M | Box AP 45.0% | 暂不支持TensorRT、ORT |
| faster_rcnn_enhance_3x_coco | 119M | Box AP 41.5% | 暂不支持TensorRT、ORT |
| fcos_r50_fpn_1x_coco | 129M | Box AP 39.6% | 暂不支持TensorRT |
| gfl_r50_fpn_1x_coco | 128M | Box AP 41.0% | 暂不支持TensorRT |
| ppyoloe_crn_l_80e_sliced_visdrone_640_025 | 200M | Box AP 31.9% | |
| retinanet_r101_fpn_2x_coco | 210M | Box AP 40.6% | 暂不支持TensorRT、ORT |
| retinanet_r50_fpn_1x_coco | 136M | Box AP 37.5% | 暂不支持TensorRT、ORT |
| tood_r50_fpn_1x_coco | 130M | Box AP 42.5% | 暂不支持TensorRT、ORT |
| ttfnet_darknet53_1x_coco | 178M | Box AP 33.5% | 暂不支持TensorRT、ORT |
| yolov8_x_500e_coco | 265M | Box AP 53.8% | |
| yolov8_l_500e_coco | 173M | Box AP 52.8% | |
| yolov8_m_500e_coco | 99M | Box AP 50.2% | |
| yolov8_s_500e_coco | 43M | Box AP 44.9% | |
| yolov8_n_500e_coco | 13M | Box AP 37.3% |
从上表可以看出一个关键规律:标注"暂不支持 TensorRT、ORT"的模型通常属于两阶段(如 Faster/Mask/Cascade RCNN、RetinaNet)或依赖特定后处理的检测器,这些模型在导出与后端选择上需要额外注意,详见第 3.3 节"导出须知"。
2.2 关键点检测模型
| 模型 | 说明 | 模型格式 | 版本 |
|---|---|---|---|
| PP-TinyPose-128x96 | 单人关键点检测模型 | Paddle | Release/2.5 configs/keypoint/tiny_pose |
| PP-TinyPose-256x192 | 单人关键点检测模型 | Paddle | Release/2.5 configs/keypoint/tiny_pose |
| PicoDet-S-Lcnet-Pedestrian-192x192 + PP-TinyPose-128x96 | 单人关键点检测串联配置 | Paddle | Release/2.5 configs/keypoint/tiny_pose |
| PicoDet-S-Lcnet-Pedestrian-320x320 + PP-TinyPose-256x192 | 多人关键点检测串联配置 | Paddle | Release/2.5 configs/keypoint/tiny_pose |
PP-TinyPose 的训练配置在当前仓库 configs/keypoint/tiny_pose 中即可找到(tinypose_128x96.yml、tinypose_256x192.yml等),说明这套部署方案与仓库内的关键点模型体系是完整打通的。注意"串联配置"意味着需要先跑检测模型(PicoDet)框出人体,再对每个目标跑关键点模型,这正是第 5.3 节 Pipeline 示例的内容。
3. 自行导出 PaddleDetection 部署模型
预导出模型仅覆盖固定配置,实际项目中往往需要自行导出训练好的模型。
3.1 模型版本与支持范围
支持PaddleDetection ≥ 2.4 版本导出的模型部署。FastDeploy 已实测成功部署的模型系列包括:
- PP-YOLOE(含 PP-YOLOE+)系列
- PicoDet 系列
- PP-YOLO 系列(含 v2)
- YOLOv3 系列
- YOLOX 系列
- FasterRCNN 系列
- MaskRCNN 系列
- SSD 系列
- YOLOv5 / YOLOv6 / YOLOv7 / YOLOv8 系列(来自 PaddleYOLO 仓库)
- RTMDet 系列(来自 PaddleYOLO 仓库)
- CascadeRCNN 系列
- PSSDet 系列
- RetinaNet 系列
- PPYOLOESOD 系列
- FCOS 系列
- TTFNet 系列
- TOOD 系列
- GFL 系列
- PP-PicoDet + PP-TinyPose 系列
3.2 模型导出
PaddleDetection 模型的导出流程请参考仓库文档 deploy/EXPORT_MODEL.md。导出工具位于 tools/export_model.py,其命令行参数支持--output_dir(输出目录,默认output_inference)与--for_fd标志。
值得注意的是,当前仓库的导出工具已内置了针对 FastDeploy 的适配:export_model.py中的--for_fd参数会传入trainer.export(output_dir, for_fd=FLAGS.for_fd)(见 tools/export_model.py),用于导出适配 FastDeploy 推理的模型格式。导出结果包含model.pdmodel、model.pdiparams和infer_cfg.yml三个文件,其中 FastDeploy 会从infer_cfg.yml中读取模型推理时所需的预处理信息(归一化、resize 等),因此这三个文件缺一不可。
3.3 导出须知
自行导出推理模型时,请务必注意以下三点:
- 不要在导出时去除 NMS:正常导出即可,FastDeploy 会在后处理阶段自行处理 NMS;
- 如果用于原生 TensorRT 后端(非 Paddle Inference 后端),不要添加
--trt参数; - 导出时不要添加
fuse_normalize=True参数,避免归一化算子被融合进模型,导致 FastDeploy 读取infer_cfg.yml预处理信息时产生不一致。
4. 部署环境准备
在部署前需确认软硬件环境,并下载对应平台的FastDeploy 预编译部署库:
- 预编译库下载与安装请参考 FastDeploy 官方安装文档(区分 CPU 版与 GPU 版,GPU 版额外包含 TensorRT 相关依赖);
- 本文示例要求FastDeploy 版本 ≥ 1.0.4;
- 部署模型可从第 2 节的预导出列表下载,或按第 3 节自行导出。
5. Python 部署示例
Python 示例代码位于 deploy/fastdeploy/cpu-gpu/python,核心脚本为 infer.py(目标检测)与pptinypose_infer.py(关键点检测)。
5.1 目标检测:CPU / GPU / Paddle-TensorRT
以 Linux 为例,完整执行流程如下:
# 下载部署示例代码 git clone https://github.com/PaddlePaddle/PaddleDetection.git cd PaddleDetection/deploy/fastdeploy/cpu-gpu/python # 注意:如果当前分支找不到下面的fastdeploy测试代码,请切换到develop分支 # git checkout develop # 下载PPYOLOE模型文件和测试图片 wget https://bj.bcebos.com/paddlehub/fastdeploy/ppyoloe_crn_l_300e_coco.tgz wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg tar xvf ppyoloe_crn_l_300e_coco.tgz # 运行部署示例 # CPU推理 python infer.py --model_dir ppyoloe_crn_l_300e_coco --image_file 000000014439.jpg --device cpu # GPU推理 python infer.py --model_dir ppyoloe_crn_l_300e_coco --image_file 000000014439.jpg --device gpu # GPU上Paddle-TensorRT推理(注意:TensorRT推理第一次运行,有序列化模型的操作,有一定耗时,需要耐心等待) python infer.py --model_dir ppyoloe_crn_l_300e_coco --image_file 000000014439.jpg --device gpu --use_trt True运行完成后会在当前目录生成可视化结果visualized_result.jpg,检测框置信度阈值默认为 0.5。
5.2 部署示例选项说明
| 参数 | 含义 | 默认值 |
|---|---|---|
| --model_dir | 指定模型文件夹所在的路径 | None |
| --image_file | 指定测试图片所在的路径 | None |
| --device | 指定即将运行的硬件类型,支持的值为[cpu, gpu],当设置为 cpu 时,可运行在 x86 cpu/arm cpu 等 cpu 上 | cpu |
| --use_trt | 是否使用 trt,该项只在 device 为 gpu 时有效 | False |
5.3 源码解析:infer.py 的 Runtime 配置
infer.py 中的build_option函数展示了三种推理模式如何映射到底层fd.RuntimeOption:
def build_option(args): option = fd.RuntimeOption() if args.device.lower() == "gpu": option.use_gpu() if args.use_trt: option.use_paddle_infer_backend() # If use original Tensorrt, not Paddle-TensorRT, # please try `option.use_trt_backend()` option.paddle_infer_option.enable_trt = True option.paddle_infer_option.collect_trt_shape = True option.trt_option.set_shape("image", [1, 3, 640, 640], [1, 3, 640, 640], [1, 3, 640, 640]) option.trt_option.set_shape("scale_factor", [1, 2], [1, 2], [1, 2]) return option几点底层细节:
- 默认走 Paddle Inference 后端:不设置任何选项时在 CPU 上推理;
use_gpu()后切换为 GPU 上的 Paddle Inference; use_trt=True默认启用的是 Paddle-TensorRT(即 Paddle Inference 内部的 TensorRT 加速);若想使用原生 TensorRT 后端,改用option.use_trt_backend();- 动态 shape 设置:
set_shape的签名是(输入名, 最小shape, 最优shape, 最大shape)。PP-YOLOE 需要为image([1,3,640,640])与scale_factor([1,2])设置 shape,这与模型导出时infer_cfg.yml记录的输入信息一致; - 模型加载时按
model.pdmodel、model.pdiparams、infer_cfg.yml三个文件拼接路径(见 infer.py),随后一行fd.vision.detection.PPYOLOE(model_file, params_file, config_file, runtime_option=runtime_option)即可完成初始化与model.predict(im)推理。
5.4 关键点检测示例
PP-TinyPose 单模型独立部署使用pptinypose_infer.py:
# 下载PP-TinyPose模型文件和测试图片 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/hrnet_demo.jpg # CPU推理 python pptinypose_infer.py --model_dir PP_TinyPose_256x192_infer --image_file hrnet_demo.jpg --device cpu # GPU推理 python pptinypose_infer.py --model_dir PP_TinyPose_256x192_infer --image_file hrnet_demo.jpg --device gpu # GPU上Paddle-TensorRT推理 python pptinypose_infer.py --model_dir PP_TinyPose_256x192_infer --image_file hrnet_demo.jpg --device gpu --use_trt True5.5 多人关键点检测(Pipeline 串联)
多人关键点检测需要"先检测、后关键点"的串联流程,示例位于 deploy/fastdeploy/cpu-gpu/python/det_keypoint_unite:
cd PaddleDetection/deploy/fastdeploy/cpu-gpu/python/det_keypoint_unite # 下载模型与测试图片 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推理 python det_keypoint_unite_infer.py --tinypose_model_dir PP_TinyPose_256x192_infer --det_model_dir PP_PicoDet_V2_S_Pedestrian_320x320_infer --image_file 000000018491.jpg --device cpu # GPU推理 python det_keypoint_unite_infer.py --tinypose_model_dir PP_TinyPose_256x192_infer --det_model_dir PP_PicoDet_V2_S_Pedestrian_320x320_infer --image_file 000000018491.jpg --device gpu # GPU上Paddle-TensorRT推理 python det_keypoint_unite_infer.py --tinypose_model_dir PP_TinyPose_256x192_infer --det_model_dir PP_PicoDet_V2_S_Pedestrian_320x320_infer --image_file 000000018491.jpg --device gpu --use_trt TruePipeline 参数说明:
| 参数 | 含义 | 默认值 |
|---|---|---|
| --tinypose_model_dir | 指定关键点模型文件夹所在的路径 | None |
| --det_model_dir | 指定目标检测模型文件夹所在的路径 | None |
| --image_file | 指定测试图片所在的路径 | None |
| --device | 指定即将运行的硬件类型,支持的值为[cpu, gpu] | cpu |
| --use_trt | 是否使用 trt,该项只在 device 为 gpu 时有效 | False |
从源码 det_keypoint_unite_infer.py 可以看到串联的关键实现:两个模型各自用fd.RuntimeOption()独立配置(PicoDet 输入为 320×320,PP-TinyPose 输入为 256×192,TRT shape 需分别设置),然后通过fd.pipeline.PPTinyPose(det_model, tinypose_model)组合成 Pipeline,并通过pipeline.detection_model_score_threshold = 0.5控制检测置信度阈值,最终用fd.vision.vis_keypoint_detection以conf_threshold=0.2可视化关键点。
5.6 Python 接口总览
所有检测/分割模型共用同一构造函数签名:
fastdeploy.vision.detection.PPYOLOE(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.PicoDet(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.PaddleYOLOX(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.YOLOv3(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.PPYOLO(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.FasterRCNN(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.MaskRCNN(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.SSD(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.PaddleYOLOv5(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.PaddleYOLOv6(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.PaddleYOLOv7(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.RTMDet(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.CascadeRCNN(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.PSSDet(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.RetinaNet(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.PPYOLOESOD(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.FCOS(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.TTFNet(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.TOOD(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE) fastdeploy.vision.detection.GFL(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE)关键点检测模型接口:
fd.vision.keypointdetection.PPTinyPose(model_file, params_file, config_file, runtime_option=None, model_format=ModelFormat.PADDLE)其中model_file、params_file为导出的 Paddle 部署模型文件,config_file为 PaddleDetection 同时导出的部署配置infer_cfg.yml。
6. C++ 部署示例
C++ 示例代码位于 deploy/fastdeploy/cpu-gpu/cpp,适用于对性能敏感或需要嵌入现有 C++ 服务框架的场景。
6.1 编译与运行
# 下载FastDeploy预编译库,用户可在上文提到的FastDeploy预编译库中自行选择合适的版本使用 wget https://bj.bcebos.com/fastdeploy/release/cpp/fastdeploy-linux-x64-gpu-x.x.x.tgz tar xvf fastdeploy-linux-x64-gpu-x.x.x.tgz # 下载部署示例代码 git clone https://github.com/PaddlePaddle/PaddleDetection.git cd PaddleDetection/deploy/fastdeploy/cpu-gpu/cpp # 注意:如果当前分支找不到下面的fastdeploy测试代码,请切换到develop分支 # git checkout develop # 编译部署示例 mkdir build && cd build mv ../fastdeploy-linux-x64-gpu-x.x.x . cmake .. -DFASTDEPLOY_INSTALL_DIR=${PWD}/fastdeploy-linux-x64-gpu-x.x.x make -j # 下载PPYOLOE模型文件和测试图片 wget https://bj.bcebos.com/paddlehub/fastdeploy/ppyoloe_crn_l_300e_coco.tgz wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg tar xvf ppyoloe_crn_l_300e_coco.tgz # 运行部署示例 # CPU推理 ./infer_demo ./ppyoloe_crn_l_300e_coco 000000014439.jpg 0 # GPU推理 ./infer_demo ./ppyoloe_crn_l_300e_coco 000000014439.jpg 1 # GPU上Paddle-TensorRT推理(注意:TensorRT推理第一次运行,有序列化模型的操作,有一定耗时,需要耐心等待) ./infer_demo ./ppyoloe_crn_l_300e_coco 000000014439.jpg 2运行参数run_option为整数:0表示 CPU 推理,1表示 GPU 推理,2表示 GPU + TensorRT。以上命令适用于 Linux/MacOS;Windows 下 SDK 的使用方式请参考 FastDeploy 官方 FAQ(如何在 Windows 中使用 FastDeploy C++ SDK)。
编译配置由 deploy/fastdeploy/cpu-gpu/cpp/CMakeLists.txt 完成:通过-DFASTDEPLOY_INSTALL_DIR指定预编译库路径,include(${FASTDEPLOY_INSTALL_DIR}/FastDeploy.cmake)引入 SDK 配置,并分别编译出infer_demo(目标检测)与infer_tinypose_demo(关键点检测)两个可执行文件。
6.2 源码解析:infer.cc 的三种推理模式
infer.cc 中三个函数分别对应三种模式,核心差异仅在RuntimeOption配置:
// CPU: 默认 RuntimeOption + UseCpu() auto option = fastdeploy::RuntimeOption(); option.UseCpu(); // GPU: UseGpu() auto option = fastdeploy::RuntimeOption(); option.UseGpu(); // GPU + Paddle-TensorRT auto option = fastdeploy::RuntimeOption(); option.UseGpu(); option.UsePaddleInferBackend(); // If use original Tensorrt, not Paddle-TensorRT, // please try `option.UseTrtBackend()` option.paddle_infer_option.enable_trt = true; option.paddle_infer_option.collect_trt_shape = true; option.trt_option.SetShape("image", {1, 3, 640, 640}, {1, 3, 640, 640}, {1, 3, 640, 640}); option.trt_option.SetShape("scale_factor", {1, 2}, {1, 2}, {1, 2});与 Python 版完全对应:C++ 侧同样通过UsePaddleInferBackend()+enable_trt走 Paddle-TensorRT,若要原生 TensorRT 后端则改用UseTrtBackend()。统一的推理流程为:拼接三个模型文件路径 → 构造模型对象 → 检查model.Initialized()→model.Predict(im, &res)→fastdeploy::vision::VisDetection(im, res, 0.5)可视化保存为vis_result.jpg。
6.3 C++ 接口总览
fastdeploy::vision::detection::PicoDet(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::SOLOv2(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::PPYOLOE(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::PPYOLO(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::YOLOv3(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::PaddleYOLOX(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::FasterRCNN(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::MaskRCNN(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::SSD(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::PaddleYOLOv5(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::PaddleYOLOv6(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::PaddleYOLOv7(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::PaddleYOLOv8(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::CascadeRCNN(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::PSSDet(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::RetinaNet(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::PPYOLOESOD(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::FCOS(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::TOOD(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); fastdeploy::vision::detection::GFL(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE);关键点检测与多人 Pipeline 接口:
fastdeploy::vision::keypointdetection::PPTinyPose(const string& model_file, const string& params_file, const string& config_file, const RuntimeOption& runtime_option = RuntimeOption(), const ModelFormat& model_format = ModelFormat::PADDLE); // 多人关键点检测串联(见 det_keypoint_unite 示例) fastdeploy::pipeline::PPTinyPose( fastdeploy::vision::detection::PicoDet* det_model, fastdeploy::vision::keypointdetection::PPTinyPose* pptinypose_model)C++ 侧的多人串联示例位于 deploy/fastdeploy/cpu-gpu/cpp/det_keypoint_unite,运行命令格式为./infer_demo <det_model_dir> <tinypose_model_dir> <image_file> <0|1|2>。
7. 常见问题与更多指南
- 如何切换模型推理后端引擎:FastDeploy 支持在 Paddle Inference、ONNX Runtime、TensorRT 等后端间切换,需根据硬件与模型特点选择(如第 2 节表格中标注"暂不支持 TensorRT、ORT"的模型应避免使用相应后端);
- Intel GPU(独立/集成显卡)的使用:Intel GPU 部署有独立的硬件适配教程,涉及 opencl/oneAPI 环境配置;
- 编译 CPU 部署库 / GPU 部署库 / Jetson 部署库:如需从源码定制部署库,可分别参考 FastDeploy 官方对应的编译文档;
- 更多仓库内资源:
- FastDeploy 部署 PaddleDetection 模型概览
- 模型导出完整指南
- Python 部署示例
- C++ 部署示例
8. 小结
基于 FastDeploy 的 CPU/GPU 部署方案,核心可以概括为三条主线:统一的模型接口(20 余个模型系列共用一套构造函数与 predict 流程)、统一的运行时配置(RuntimeOption一参切换 CPU/GPU/Paddle-TensorRT)、统一的模型产物(model.pdmodel+model.pdiparams+infer_cfg.yml三件套)。掌握 PP-YOLOE 一个示例,即可将 PaddleDetection 的绝大多数检测、分割与关键点模型快速部署到目标硬件,这也是该方案在工程落地中的最大价值所在。
- 人工智能
- 深度学习
- 计算机视觉
【免费下载链接】PaddleDetection
Object Detection toolkit based on PaddlePaddle. It supports object detection, instance segmentation, multiple object tracking and real-time multi-person keypoint detection.
相关推荐
PaddleDetection 服务化部署:基于 FastDeploy Serving 的完整实操指南
PaddleDetection 服务化部署:基于 FastDeploy Serving 的完整实操指南 本文以 PP YOLOE 模型( ppyoloe_crn
人工智能深度学习计算机视觉PaddleDetection 基于 FastDeploy 的 CPU/GPU Python 部署指南:PP-YOLOE 目标检测与 PP-TinyPose 关键点检测实战
PaddleDetection 基于 FastDeploy 的 CPU/GPU Python 部署指南:PP YOLOE 目标检测与 PP TinyPose 关
人工智能深度学习计算机视觉PaddleDetection 基于 RKNPU2 的 C++ 端侧部署实战:以 PPYOLOE 为例(FastDeploy)
PaddleDetection 基于 RKNPU2 的 C++ 端侧部署实战:以 PPYOLOE 为例(FastDeploy) PaddleDetection
人工智能深度学习计算机视觉
创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考