Files
FastDeploy/examples/vision/segmentation/paddleseg/cpu-gpu/cpp/README.md
2023-02-08 16:33:12 +00:00

3.0 KiB
Raw Blame History

English | 简体中文

PaddleSeg C++部署示例

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

部署环境准备

在部署前,需确认软硬件环境,同时下载预编译部署库,参考文档FastDeploy预编译库安装

注意 如你部署的为PP-MattingPP-HumanMatting以及ModNet请参考Matting模型部署

以Linux上推理为例在本目录执行如下命令即可完成编译测试支持此模型需保证FastDeploy版本1.0.0以上(x.x.x>=1.0.0)

#下载部署示例代码
cd path/to/paddleseg/cpp-gpu/cpp

mkdir build
cd build
# 下载FastDeploy预编译库用户可在上文提到的`FastDeploy预编译库`中自行选择合适的版本使用
wget https://bj.bcebos.com/fastdeploy/release/cpp/fastdeploy-linux-x64-x.x.x.tgz
tar xvf fastdeploy-linux-x64-x.x.x.tgz
cmake .. -DFASTDEPLOY_INSTALL_DIR=${PWD}/fastdeploy-linux-x64-x.x.x
make -j

# 下载PP-LiteSeg模型文件和测试图片
wget https://bj.bcebos.com/paddlehub/fastdeploy/PP_LiteSeg_B_STDC2_cityscapes_without_argmax_infer.tgz
tar -xvf PP_LiteSeg_B_STDC2_cityscapes_without_argmax_infer.tgz
wget https://paddleseg.bj.bcebos.com/dygraph/demo/cityscapes_demo.png


# CPU推理
./infer_demo PP_LiteSeg_B_STDC2_cityscapes_without_argmax_infer cityscapes_demo.png 0
# GPU推理
./infer_demo PP_LiteSeg_B_STDC2_cityscapes_without_argmax_infer cityscapes_demo.png 1
# GPU上Paddle-TensorRT推理
./infer_demo PP_LiteSeg_B_STDC2_cityscapes_without_argmax_infer cityscapes_demo.png 2

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

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

快速链接

常见问题