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

English | 简体中文

PaddleSeg Python部署示例

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

部署环境准备

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

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

#下载部署示例代码
git clone https://github.com/PaddlePaddle/FastDeploy.git
cd FastDeploy/examples/vision/segmentation/paddleseg/cpu-gpu/python

# 下载Unet模型文件和测试图片
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推理
python infer.py --model PP_LiteSeg_B_STDC2_cityscapes_without_argmax_infer --image cityscapes_demo.png --device cpu
# GPU推理
python infer.py --model PP_LiteSeg_B_STDC2_cityscapes_without_argmax_infer --image cityscapes_demo.png --device gpu
# GPU上使用Paddle-TensorRT推理 注意Paddle-TensorRT推理第一次运行有序列化模型的操作有一定耗时需要耐心等待
python infer.py --model PP_LiteSeg_B_STDC2_cityscapes_without_argmax_infer --image cityscapes_demo.png --device gpu --use_trt True

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

快速链接

常见问题