FastDeploy(python)

安装环境

sudo apt install build-essential

sudo pip3 install setuptools

Jetson部署库编译

pip3 install fastdeploy-gpu-python -f https://www.paddlepaddle.org.cn/whl/fastdeploy.html

pip3 install fastdeploy-python -f https://www.paddlepaddle.org.cn/whl/fastdeploy.html



git clone https://github.com/PaddlePaddle/FastDeploy.git
cd FastDeploy/python
export BUILD_ON_JETSON=ON
export ENABLE_VISION=ON
export ENABLE_PADDLE_BACKEND=ON
#export PADDLEINFERENCE_DIRECTORY=/Download/paddle_inference_jetson
python3 setup.py build
python3 setup.py bdist_wheel
cd dist
pip3 install fastdeploy_gpu_python-0.0.0-cp38-cp38-linux_aarch64.whl

视觉模型测试

一、classification

1、paddleclas

执行命令:

cd  ~/FastDeploy/examples/vision/classification/paddleclas/python
wget https://bj.bcebos.com/paddlehub/fastdeploy/ResNet50_vd_infer.tgz
tar -xvf ResNet50_vd_infer.tgz
wget https://gitee.com/paddlepaddle/PaddleClas/raw/release/2.4/deploy/images/ImageNet/ILSVRC2012_val_00000010.jpeg
# CPU推理
python3 infer.py --model ResNet50_vd_infer --image ILSVRC2012_val_00000010.jpeg --device cpu --topk 1
# GPU推理
python3 infer.py --model ResNet50_vd_infer --image ILSVRC2012_val_00000010.jpeg --device gpu --topk 1

2、resnet

cd  ~/FastDeploy/examples/vision/classification/resnet/python

wget https://bj.bcebos.com/paddlehub/fastdeploy/resnet50.onnx

wget https://gitee.com/paddlepaddle/PaddleClas/raw/release/2.4/deploy/images/ImageNet/ILSVRC2012_val_00000010.jpeg

# CPU推理
python3 infer.py --model resnet50.onnx --image ILSVRC2012_val_00000010.jpeg --device cpu --topk 1
# GPU推理
python3 infer.py --model resnet50.onnx --image ILSVRC2012_val_00000010.jpeg --device gpu --topk 1

3、yolov5cls

cd ~/FastDeploy/examples/vision/classification/yolov5cls/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/yolov5n-cls.onnx
wget https://gitee.com/paddlepaddle/PaddleClas/raw/release/2.4/deploy/images/ImageNet/ILSVRC2012_val_00000010.jpeg
# CPU推理
python3 infer.py --model yolov5n-cls.onnx --image ILSVRC2012_val_00000010.jpeg --device cpu --topk 1
# GPU推理
python3 infer.py --model yolov5n-cls.onnx --image ILSVRC2012_val_00000010.jpeg --device gpu --topk 1

二、detection

1、fastestdet

cd ~/FastDeploy/examples/vision/detection/fastestdet/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/FastestDet.onnx
wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg
# CPU推理
python3 infer.py --model FastestDet.onnx --image 000000014439.jpg --device cpu
# GPU推理
python3 infer.py --model FastestDet.onnx --image 000000014439.jpg --device gpu

visualized_result

2、nanodet_plus

cd ~/FastDeploy/examples/vision/detection/nanodet_plus/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/nanodet-plus-m_320.onnx
wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg
# CPU 推理
python3 infer.py --model nanodet-plus-m_320.onnx --image 000000014439.jpg --device cpu
# GPU 推理
python3 infer.py --model nanodet-plus-m_320.onnx --image 000000014439.jpg --device gpu

visualized_result

3、paddledetection

cd ~/FastDeploy/examples/vision/detection/paddledetection/python/
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推理
python3 infer_ppyoloe.py --model_dir ppyoloe_crn_l_300e_coco --image 000000014439.jpg --device cpu
# GPU推理
python3 infer_ppyoloe.py --model_dir ppyoloe_crn_l_300e_coco --image 000000014439.jpg --device gpu

visualized_result

4、rkyolo(无法下载图片)

5、scaledyolov4

cd ~/FastDeploy/examples/vision/detection/scaledyolov4/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/scaled_yolov4-p5.onnx
wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg
# CPU推理
python3 infer.py --model scaled_yolov4-p5.onnx --image 000000014439.jpg --device cpu
# GPU推理
python3 infer.py --model scaled_yolov4-p5.onnx --image 000000014439.jpg --device gpu
# GPU上使用TensorRT推理
python3 infer.py --model scaled_yolov4-p5.onnx --image 000000014439.jpg --device gpu --use_trt True
visualized_result

6、yolor

cd ~/FastDeploy/examples/vision/detection/yolor/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/yolor-p6-paper-541-640-640.onnx
wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg
# CPU推理
python3 infer.py --model yolor-p6-paper-541-640-640.onnx --image 000000014439.jpg --device cpu
# GPU推理
python3 infer.py --model yolor-p6-paper-541-640-640.onnx --image 000000014439.jpg --device gpu
# GPU上使用TensorRT推理
python3 infer.py --model yolor-p6-paper-541-640-640.onnx --image 000000014439.jpg --device gpu --use_trt True

visualized_result

7、yolov5

cd ~/FastDeploy/examples/vision/detection/yolov5/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/yolov5s_infer.tar
tar -xf yolov5s_infer.tar
wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg
# CPU推理
python3 infer.py --model yolov5s_infer --image 000000014439.jpg --device cpu
# GPU推理 (报错)
python3 infer.py --model yolov5s_infer --image 000000014439.jpg --device gpu
# GPU上使用TensorRT推理
python3 infer.py --model yolov5s_infer --image 000000014439.jpg --device gpu --use_trt True

visualized_result

8、yolov5lite

cd ~/FastDeploy/examples/vision/detection/yolov5lite/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/v5Lite-g-sim-640.onnx
wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg
# CPU推理
python3 infer.py --model v5Lite-g-sim-640.onnx --image 000000014439.jpg --device cpu
# GPU推理
python3 infer.py --model v5Lite-g-sim-640.onnx --image 000000014439.jpg --device gpu
# GPU上使用TensorRT推理
python3 infer.py --model v5Lite-g-sim-640.onnx --image 000000014439.jpg --device gpu --use_trt True
visualized_result

9、yolov5seg

cd ~/FastDeploy/examples/vision/detection/yolov5seg/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/yolov5s-seg.onnx
wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg
# CPU推理
python3 infer.py --model yolov5s-seg.onnx --image 000000014439.jpg --device cpu
# GPU推理
python3 infer.py --model yolov5s-seg.onnx --image 000000014439.jpg --device gpu
# GPU上使用TensorRT推理
python3 infer.py --model yolov5s-seg.onnx --image 000000014439.jpg --device gpu --use_trt True

visualized_result

10、yolov6

cd ~/FastDeploy/examples/vision/detection/yolov6/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/yolov6s_infer.tar
tar -xf yolov6s_infer.tar
wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg
# CPU推理
python3 infer_paddle_model.py --model yolov6s_infer --image 000000014439.jpg  --device cpu
# GPU推理(报错)
python3 infer_paddle_model.py --model yolov6s_infer --image 000000014439.jpg  --device gpu

visualized_result

11、yolov7

cd ~/FastDeploy/examples/vision/detection/yolov7/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/yolov7_infer.tar
tar -xf yolov7_infer.tar
wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg
# CPU
python3 infer_paddle_model.py --model yolov7_infer --image 000000014439.jpg --device cpu
# GPU (报错)
python3 infer_paddle_model.py --model yolov7_infer --image 000000014439.jpg --device gpu
visualized_result

12、yolov7end2end_ort

cd ~/FastDeploy/examples/vision/detection/yolov7end2end_ort/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/yolov7-end2end-ort-nms.onnx
wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg
# CPU推理
python3 infer.py --model yolov7-end2end-ort-nms.onnx --image 000000014439.jpg --device cpu
# GPU推理
python3 infer.py --model yolov7-end2end-ort-nms.onnx --image 000000014439.jpg --device gpu
# TensorRT + GPU推理 (暂不支持 会回退到 ORT + GPU)
python3 infer.py --model yolov7-end2end-ort-nms.onnx --image 000000014439.jpg --device gpu --use_trt True

visualized_result

13、yolov7end2end_trt(无法下载图片)

cd ~/FastDeploy/examples/vision/detection/yolov7end2end_trt/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/yolov7-end2end-trt-nms.onnx
wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg
# TensorRT GPU推理
python3 infer.py --model yolov7-end2end-trt-nms.onnx --image 000000014439.jpg --device gpu --use_trt True

14、yolov8(无法下载图片)

cd ~/FastDeploy/examples/vision/detection/yolov8/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/yolov8.onnx
wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg
# CPU inference
python3 infer.py --model yolov8.onnx --image 000000014439.jpg --device cpu
# GPU inference
python3 infer.py --model yolov8.onnx --image 000000014439.jpg --device gpu
# TensorRT inference on GPU 
python3 infer.py --model yolov8.onnx --image 000000014439.jpg --device gpu --use_trt True

15、yolox

cd ~/FastDeploy/examples/vision/detection/yolox/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/yolox_s.onnx
wget https://gitee.com/paddlepaddle/PaddleDetection/raw/release/2.4/demo/000000014439.jpg
# CPU inference
python3 infer.py --model yolox_s.onnx --image 000000014439.jpg --device cpu
# GPU inference
python3 infer.py --model yolox_s.onnx --image 000000014439.jpg --device gpu
# TensorRT inference on GPU (TensorRT in SDK. No need Separate installation)
python3 infer.py --model yolox_s.onnx --image 000000014439.jpg --device gpu --use_trt True

visualized_result

三、facealign
1、face_landmark_1000
cd ~/FastDeploy/examples/vision/facealign/face_landmark_1000/python
wget https://bj.bcebos.com/paddlehub/fastdeploy/FaceLandmark1000.onnx
wget https://bj.bcebos.com/paddlehub/fastdeploy/facealign_input.png
# CPU推理
python3 infer.py --model FaceLandmark1000.onnx --image facealign_input.png --device cpu
# GPU推理
python3 infer.py --model FaceLandmark1000.onnx --image facealign_input.png --device gpu
# TRT推理
python3 infer.py --model FaceLandmark1000.onnx --image facealign_input.png --device gpu --backend trt
visualized_result
2、pfld
cd ~/FastDeploy/examples/vision/facealign/pfld/python
wget https://bj.bcebos.com/paddlehub/fastdeploy/pfld-106-lite.onnx
wget https://bj.bcebos.com/paddlehub/fastdeploy/facealign_input.png
# CPU推理
python3 infer.py --model pfld-106-lite.onnx --image facealign_input.png --device cpu
# GPU推理
python3 infer.py --model pfld-106-lite.onnx --image facealign_input.png --device gpu
# TRT推理
python3 infer.py --model pfld-106-lite.onnx --image facealign_input.png --device gpu --backend trt
visualized_result
3、pipnet
cd ~/FastDeploy/examples/vision/facealign/pipnet/python
wget https://bj.bcebos.com/paddlehub/fastdeploy/pipnet_resnet18_10x19x32x256_aflw.onnx
wget https://bj.bcebos.com/paddlehub/fastdeploy/facealign_input.png
# CPU inference
python3 infer.py --model pipnet_resnet18_10x19x32x256_aflw.onnx --image facealign_input.png --device cpu
# GPU inference
python3 infer.py --model pipnet_resnet18_10x19x32x256_aflw.onnx --image facealign_input.png --device gpu
# TRT inference
python3 infer.py --model pipnet_resnet18_10x19x32x256_aflw.onnx --image facealign_input.png --device gpu --backend trt
visualized_result
四、facedet
1、blazeface(报错)
cd ~/FastDeploy/examples/vision/facedet/blazeface/python/
wget https://raw.githubusercontent.com/DefTruth/lite.ai.toolkit/main/examples/lite/resources/test_lite_face_detector_3.jpg
wget https://bj.bcebos.com/paddlehub/fastdeploy/blazeface-1000e.tgz
# CPU Inference
python3 infer.py --model blazeface-1000e/ --image test_lite_face_detector_3.jpg --device cpu
# GPU Inference
python3 infer.py --model blazeface-1000e/ --image test_lite_face_detector_3.jpg --device gpu
2、centerface(报错)
cd ~/FastDeploy/examples/vision/facedet/centerface/python
wget https://raw.githubusercontent.com/DefTruth/lite.ai.toolkit/main/examples/lite/resources/test_lite_face_detector_3.jpg
wget https://bj.bcebos.com/paddlehub/fastdeploy/CenterFace.onnx
#使用CenterFace.onnx模型
# CPU推理
python3 infer.py --model CenterFace.onnx --image test_lite_face_detector_3.jpg --device cpu
# GPU推理
python3 infer.py --model CenterFace.onnx --image test_lite_face_detector_3.jpg --device gpu
# GPU上使用TensorRT推理
python3 infer.py --model CenterFace.onnx --image test_lite_face_detector_3.jpg --device gpu --use_trt True
3、retinaface(报错)
cd ~/FastDeploy/examples/vision/facedet/retinaface/python/
#下载retinaface模型文件和测试图片
wget https://bj.bcebos.com/paddlehub/fastdeploy/Pytorch_RetinaFace_mobile0.25-640-640.onnx
wget https://raw.githubusercontent.com/DefTruth/lite.ai.toolkit/main/examples/lite/resources/test_lite_face_detector_3.jpg
# CPU推理
python3 infer.py --model Pytorch_RetinaFace_mobile0.25-640-640.onnx --image test_lite_face_detector_3.jpg --device cpu
# GPU推理
python3 infer.py --model Pytorch_RetinaFace_mobile0.25-640-640.onnx --image test_lite_face_detector_3.jpg --device gpu
# GPU上使用TensorRT推理
python3 infer.py --model Pytorch_RetinaFace_mobile0.25-640-640.onnx --image test_lite_face_detector_3.jpg --device gpu --use_trt True
4、scrfd(报错)
cd ~/FastDeploy/examples/vision/facedet/scrfd/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/scrfd_500m_bnkps_shape640x640.onnx
wget https://raw.githubusercontent.com/DefTruth/lite.ai.toolkit/main/examples/lite/resources/test_lite_face_detector_3.jpg
# CPU推理
python3 infer.py --model scrfd_500m_bnkps_shape640x640.onnx --image test_lite_face_detector_3.jpg --device cpu
# GPU推理
python3 infer.py --model scrfd_500m_bnkps_shape640x640.onnx --image test_lite_face_detector_3.jpg --device gpu
# GPU上使用TensorRT推理
python3 infer.py --model scrfd_500m_bnkps_shape640x640.onnx --image test_lite_face_detector_3.jpg --device gpu --use_trt True
5、ultraface(报错)
cd ~/FastDeploy/examples/vision/facedet/ultraface/python/
#下载ultraface模型文件和测试图片
wget https://bj.bcebos.com/paddlehub/fastdeploy/version-RFB-320.onnx
wget https://raw.githubusercontent.com/DefTruth/lite.ai.toolkit/main/examples/lite/resources/test_lite_face_detector_3.jpg
# CPU推理
python3 infer.py --model version-RFB-320.onnx --image test_lite_face_detector_3.jpg --device cpu
# GPU推理
python3 infer.py --model version-RFB-320.onnx --image test_lite_face_detector_3.jpg --device gpu
# GPU上使用TensorRT推理
python3 infer.py --model version-RFB-320.onnx --image test_lite_face_detector_3.jpg --device gpu --use_trt True
6、yolov5face(报错)
cd ~/FastDeploy/examples/vision/facedet/yolov5face/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/yolov5s-face.onnx
wget https://raw.githubusercontent.com/DefTruth/lite.ai.toolkit/main/examples/lite/resources/test_lite_face_detector_3.jpg
# CPU推理
python3 infer.py --model yolov5s-face.onnx --image test_lite_face_detector_3.jpg --device cpu
# GPU推理
python3 infer.py --model yolov5s-face.onnx --image test_lite_face_detector_3.jpg --device gpu
# GPU上使用TensorRT推理
python3 infer.py --model yolov5s-face.onnx --image test_lite_face_detector_3.jpg --device gpu --use_trt True
7、yolov7face(报错)
cd ~/FastDeploy/examples/vision/facedet/yolov7face/python/
wget https://raw.githubusercontent.com/DefTruth/lite.ai.toolkit/main/examples/lite/resources/test_lite_face_detector_3.jpg
wget https://bj.bcebos.com/paddlehub/fastdeploy/yolov7-lite-e.onnx
#使用yolov7-tiny-face.onnx模型
# CPU推理
python3 infer.py --model yolov7-tiny-face.onnx --image test_lite_face_detector_3.jpg --device cpu
# GPU推理
python3 infer.py --model yolov7-tiny-face.onnx --image test_lite_face_detector_3.jpg --device gpu
# GPU上使用TensorRT推理
python3 infer.py --model yolov7-tiny-face.onnx --image test_lite_face_detector_3.jpg --device gpu --use_trt True
#使用yolov7-lite-e.onnx模型# CPU推理
python3 infer.py --model yolov7-lite-e.onnx --image test_lite_face_detector_3.jpg --device cpu
# GPU推理
python3 infer.py --model yolov7-lite-e.onnx --image test_lite_face_detector_3.jpg --device gpu
# GPU上使用TensorRT推理
python3 infer.py --model yolov7-lite-e.onnx --image test_lite_face_detector_3.jpg --device gpu --use_trt True
五、faceid

1、adaface(报错)

cd ~/FastDeploy/examples/vision/faceid/adaface/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/rknpu2/face_demo.zip
unzip face_demo.zip
wget https://bj.bcebos.com/paddlehub/fastdeploy/mobilefacenet_adaface.tgz
tar zxvf mobilefacenet_adaface.tgz -C ./
# CPU推理
python3 infer.py --model mobilefacenet_adaface/mobilefacenet_adaface.pdmodel --params_file mobilefacenet_adaface/mobilefacenet_adaface.pdiparams --face face_0.jpg --face_positive face_1.jpg --face_negative face_2.jpg --device cpu
# GPU推理
python3 infer.py --model mobilefacenet_adaface/mobilefacenet_adaface.pdmodel --params_file mobilefacenet_adaface/mobilefacenet_adaface.pdiparams --face face_0.jpg --face_positive face_1.jpg --face_negative face_2.jpg --device gpu
# GPU上使用TensorRT推理
python3 infer.py --model mobilefacenet_adaface/mobilefacenet_adaface.pdmodel --params_file mobilefacenet_adaface/mobilefacenet_adaface.pdiparams --face face_0.jpg --face_positive face_1.jpg --face_negative face_2.jpg --device gpu --use_trt True

2、insightface

cd ~/FastDeploy/examples/vision/faceid/insightface/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/ms1mv3_arcface_r100.onnx
wget https://bj.bcebos.com/paddlehub/fastdeploy/rknpu2/face_demo.zip
unzip face_demo.zip
# CPU推理
python3 infer_arcface.py --model ms1mv3_arcface_r100.onnx --face face_0.jpg --face_positive face_1.jpg --face_negative face_2.jpg --device cpu
# GPU推理
python3 infer_arcface.py --model ms1mv3_arcface_r100.onnx --face face_0.jpg --face_positive face_1.jpg --face_negative face_2.jpg --device gpu
# GPU上使用TensorRT推理
python3 infer_arcface.py --model ms1mv3_arcface_r100.onnx --face face_0.jpg --face_positive face_1.jpg --face_negative face_2.jpg --device gpu --use_trt True

六、generation/anemigan(报错)
cd ~/FastDeploy/examples/vision/generation/anemigan/python
wget https://bj.bcebos.com/paddlehub/fastdeploy/style_transfer_testimg.jpg
# CPU推理
python3 infer.py --model animegan_v1_hayao_60  --image style_transfer_testimg.jpg  --device cpu
# GPU推理
python3 infer.py --model animegan_v1_hayao_60 --image style_transfer_testimg.jpg  --device gpu
七、headpose
1、fsanet
cd ~/FastDeploy/examples/vision/headpose/fsanet/python
wget https://bj.bcebos.com/paddlehub/fastdeploy/fsanet-var.onnx
wget https://bj.bcebos.com/paddlehub/fastdeploy/headpose_input.png
# CPU推理
python3 infer.py --model fsanet-var.onnx --image headpose_input.png --device cpu
# GPU推理(报错)
python3 infer.py --model fsanet-var.onnx --image headpose_input.png --device gpu
# TRT推理
python3 infer.py --model fsanet-var.onnx --image headpose_input.png --device gpu --backend trt
八、keypointdetection
1、det_keypoint_unite
cd ~/FastDeploy/examples/vision/keypointdetection/det_keypoint_unite/python
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推理
python3 det_keypoint_unite_infer.py --tinypose_model_dir PP_TinyPose_256x192_infer --det_model_dir PP_PicoDet_V2_S_Pedestrian_320x320_infer --image 000000018491.jpg --device cpu
# GPU推理
python3 det_keypoint_unite_infer.py --tinypose_model_dir PP_TinyPose_256x192_infer --det_model_dir PP_PicoDet_V2_S_Pedestrian_320x320_infer --image 000000018491.jpg --device gpu
# GPU上使用TensorRT推理 (注意:TensorRT推理第一次运行,有序列化模型的操作,有一定耗时,需要耐心等待)
python3 det_keypoint_unite_infer.py --tinypose_model_dir PP_TinyPose_256x192_infer --det_model_dir PP_PicoDet_V2_S_Pedestrian_320x320_infer --image 000000018491.jpg --device gpu --use_trt True
visualized_result
2、tiny_pose
cd ~/FastDeploy/examples/vision/keypointdetection/tiny_pose/python
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推理
python3 pptinypose_infer.py --tinypose_model_dir PP_TinyPose_256x192_infer --image hrnet_demo.jpg --device cpu
# GPU推理(报错)
python3 pptinypose_infer.py --tinypose_model_dir PP_TinyPose_256x192_infer --image hrnet_demo.jpg --device gpu
# GPU上使用TensorRT推理 (注意:TensorRT推理第一次运行,有序列化模型的操作,有一定耗时,需要耐心等待)
python3 pptinypose_infer.py --tinypose_model_dir PP_TinyPose_256x192_infer --image hrnet_demo.jpg --device gpu --use_trt True
visualized_result
九、matting
1、modnet
cd ~/FastDeploy/examples/vision/matting/modnet/python/
wget https://bj.bcebos.com/paddlehub/fastdeploy/modnet_photographic_portrait_matting.onnx
wget https://bj.bcebos.com/paddlehub/fastdeploy/matting_input.jpg
wget https://bj.bcebos.com/paddlehub/fastdeploy/matting_bgr.jpg
# CPU推理
python3 infer.py --model modnet_photographic_portrait_matting.onnx --image matting_input.jpg --bg matting_bgr.jpg --device cpu
# GPU推理
python3 infer.py --model modnet_photographic_portrait_matting.onnx --image matting_input.jpg --bg matting_bgr.jpg --device gpu
# GPU上使用TensorRT推理
python3 infer.py --model modnet_photographic_portrait_matting.onnx --image matting_input.jpg --bg matting_bgr.jpg --device gpu --use_trt True
visualized_result_fgvisualized_result_replaced_bg
2、ppmatting
cd ~/FastDeploy/examples/vision/matting/ppmatting/python
wget https://bj.bcebos.com/paddlehub/fastdeploy/PP-Matting-512.tgz
tar -xvf PP-Matting-512.tgz
wget https://bj.bcebos.com/paddlehub/fastdeploy/matting_input.jpg
wget https://bj.bcebos.com/paddlehub/fastdeploy/matting_bgr.jpg
# CPU推理
python3 infer.py --model PP-Matting-512 --image matting_input.jpg --bg matting_bgr.jpg --device cpu
# GPU推理(报错)
python3 infer.py --model PP-Matting-512 --image matting_input.jpg --bg matting_bgr.jpg --device gpu
# GPU上使用TensorRT推理 (注意:TensorRT推理第一次运行,有序列化模型的操作,有一定耗时,需要耐心等待)
python3 infer.py --model PP-Matting-512 --image matting_input.jpg --bg matting_bgr.jpg --device gpu --use_trt True
visualized_result_fgvisualized_result_replaced_bg
3、rvm
cd ~/FastDeploy/examples/vision/matting/rvm/python
wget https://bj.bcebos.com/paddlehub/fastdeploy/rvm_mobilenetv3_fp32.onnx
## 为加载TRT特殊处理ONNX模型
wget https://bj.bcebos.com/paddlehub/fastdeploy/rvm_mobilenetv3_trt.onnx
wget https://bj.bcebos.com/paddlehub/fastdeploy/matting_input.jpg
wget https://bj.bcebos.com/paddlehub/fastdeploy/matting_bgr.jpg
wget https://bj.bcebos.com/paddlehub/fastdeploy/video.mp4
# CPU推理
## 图片
python3 infer.py --model rvm_mobilenetv3_fp32.onnx --image matting_input.jpg --bg matting_bgr.jpg --device cpu
## 视频
python3 infer.py --model rvm_mobilenetv3_fp32.onnx --video video.mp4 --bg matting_bgr.jpg --device cpu
# GPU推理
## 图片
python3 infer.py --model rvm_mobilenetv3_fp32.onnx --image matting_input.jpg --bg matting_bgr.jpg --device gpu
## 视频
python3 infer.py --model rvm_mobilenetv3_fp32.onnx --video video.mp4 --bg matting_bgr.jpg --device gpu
# TRT推理
## 图片
python3 infer.py --model rvm_mobilenetv3_trt.onnx --image matting_input.jpg --bg matting_bgr.jpg --device gpu --use_trt True
## 视频
python3 infer.py --model rvm_mobilenetv3_trt.onnx --video video.mp4 --bg matting_bgr.jpg --device gpu --use_trt True
visualized_result_fgvisualized_result_replaced_bg
十、ocr
1、PP-OCRv2
cd ~/FastDeploy/examples/vision/ocr/PP-OCRv2/python
wget https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_det_infer.tar
tar -xvf ch_PP-OCRv2_det_infer.tar
wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_cls_infer.tar
tar -xvf ch_ppocr_mobile_v2.0_cls_infer.tar
wget https://paddleocr.bj.bcebos.com/PP-OCRv2/chinese/ch_PP-OCRv2_rec_infer.tar
tar -xvf ch_PP-OCRv2_rec_infer.tar
wget https://gitee.com/paddlepaddle/PaddleOCR/raw/release/2.6/doc/imgs/12.jpg
wget https://gitee.com/paddlepaddle/PaddleOCR/raw/release/2.6/ppocr/utils/ppocr_keys_v1.txt
# CPU推理
python3 infer.py --det_model ch_PP-OCRv2_det_infer --cls_model ch_ppocr_mobile_v2.0_cls_infer --rec_model ch_PP-OCRv2_rec_infer --rec_label_file ppocr_keys_v1.txt --image 12.jpg --device cpu
# GPU推理(报错)
python3 infer.py --det_model ch_PP-OCRv2_det_infer --cls_model ch_ppocr_mobile_v2.0_cls_infer --rec_model ch_PP-OCRv2_rec_infer --rec_label_file ppocr_keys_v1.txt --image 12.jpg --device gpu
# GPU上使用TensorRT推理
python3 infer.py --det_model ch_PP-OCRv2_det_infer --cls_model ch_ppocr_mobile_v2.0_cls_infer --rec_model ch_PP-OCRv2_rec_infer --rec_label_file ppocr_keys_v1.txt --image 12.jpg --device gpu --backend trt
visualized_result
2、PP-OCRv3
cd ~/FastDeploy/examples/vision/ocr/PP-OCRv3/python/
wget https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_det_infer.tar
tar xvf ch_PP-OCRv3_det_infer.tar
wget https://paddleocr.bj.bcebos.com/dygraph_v2.0/ch/ch_ppocr_mobile_v2.0_cls_infer.tar
tar -xvf ch_ppocr_mobile_v2.0_cls_infer.tar
wget https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_rec_infer.tar
tar xvf ch_PP-OCRv3_rec_infer.tar
wget https://gitee.com/paddlepaddle/PaddleOCR/raw/release/2.6/doc/imgs/12.jpg
wget https://gitee.com/paddlepaddle/PaddleOCR/raw/release/2.6/ppocr/utils/ppocr_keys_v1.txt
# CPU推理
python3 infer.py --det_model ch_PP-OCRv3_det_infer --cls_model ch_ppocr_mobile_v2.0_cls_infer --rec_model ch_PP-OCRv3_rec_infer --rec_label_file ppocr_keys_v1.txt --image 12.jpg --device cpu
# GPU推理(报错)
python3 infer.py --det_model ch_PP-OCRv3_det_infer --cls_model ch_ppocr_mobile_v2.0_cls_infer --rec_model ch_PP-OCRv3_rec_infer --rec_label_file ppocr_keys_v1.txt --image 12.jpg --device gpu
# GPU上使用TensorRT推理
python3 infer.py --det_model ch_PP-OCRv3_det_infer --cls_model ch_ppocr_mobile_v2.0_cls_infer --rec_model ch_PP-OCRv3_rec_infer --rec_label_file ppocr_keys_v1.txt --image 12.jpg --device gpu --backend trt
visualized_result
十一、segmentation/paddleseg
cd ~/FastDeploy/examples/vision/segmentation/paddleseg/python
# 下载Unet模型文件和测试图片
wget https://bj.bcebos.com/paddlehub/fastdeploy/Unet_cityscapes_without_argmax_infer.tgz
tar -xvf Unet_cityscapes_without_argmax_infer.tgz
wget https://paddleseg.bj.bcebos.com/dygraph/demo/cityscapes_demo.png
# CPU推理
python3 infer.py --model Unet_cityscapes_without_argmax_infer --image cityscapes_demo.png --device cpu
# GPU推理(报错)
python3 infer.py --model Unet_cityscapes_without_argmax_infer --image cityscapes_demo.png --device gpu
# GPU上使用TensorRT推理 (注意:TensorRT推理第一次运行,有序列化模型的操作,有一定耗时,需要耐心等待)
python3 infer.py --model Unet_cityscapes_without_argmax_infer --image cityscapes_demo.png --device gpu --use_trt True
十二、sr
1、basicvsr
cd ~/FastDeploy/examples/vision/sr/basicvsr/python
wget https://bj.bcebos.com/paddlehub/fastdeploy/BasicVSR_reds_x4.tar
tar -xvf BasicVSR_reds_x4.tar
wget https://bj.bcebos.com/paddlehub/fastdeploy/vsr_src.mp4
# CPU推理
python3 infer.py --model BasicVSR_reds_x4 --video vsr_src.mp4 --frame_num 2 --device cpu
# GPU推理
python3 infer.py --model BasicVSR_reds_x4 --video vsr_src.mp4 --frame_num 2 --device gpu
# GPU上使用TensorRT推理 (注意:TensorRT推理第一次运行,有序列化模型的操作,有一定耗时,需要耐心等待)
python3 infer.py --model BasicVSR_reds_x4 --video vsr_src.mp4 --frame_num 2 --device gpu --use_trt True
2、edvr
cd ~/FastDeploy/examples/vision/sr/edvr/python
wget https://bj.bcebos.com/paddlehub/fastdeploy/EDVR_M_wo_tsa_SRx4.tar
tar -xvf EDVR_M_wo_tsa_SRx4.tar
wget https://bj.bcebos.com/paddlehub/fastdeploy/vsr_src.mp4
# CPU推理
python3 infer.py --model EDVR_M_wo_tsa_SRx4 --video vsr_src.mp4 --frame_num 5 --device cpu
# GPU推理(报错)
python3 infer.py --model EDVR_M_wo_tsa_SRx4 --video vsr_src.mp4 --frame_num 5 --device gpu
# GPU上使用TensorRT推理 (注意:TensorRT推理第一次运行,有序列化模型的操作,有一定耗时,需要耐心等待)
python3 infer.py --model EDVR_M_wo_tsa_SRx4 --video vsr_src.mp4 --frame_num 5 --device gpu --use_trt True
3、ppmsvsr
cd ~/FastDeploy/examples/vision/sr/ppmsvsr/python
wget https://bj.bcebos.com/paddlehub/fastdeploy/PP-MSVSR_reds_x4.tar
tar -xvf PP-MSVSR_reds_x4.tar
wget https://bj.bcebos.com/paddlehub/fastdeploy/vsr_src.mp4
# CPU inference
python3 infer.py --model PP-MSVSR_reds_x4 --video vsr_src.mp4 --frame_num 2 --device cpu
# GPU inference(报错)
python3 infer.py --model PP-MSVSR_reds_x4 --video vsr_src.mp4 --frame_num 2 --device gpu
# TensorRT inference on GPU Attention: It is somewhat time-consuming for the operation of model serialization when running TensorRT inference for the first time. Please be patient.
python3 infer.py --model PP-MSVSR_reds_x4 --video vsr_src.mp4 --frame_num 2 --device gpu --use_trt True
十三、tracking/pptracking(报错)
cd ~/FastDeploy/examples/vision/tracking/pptracking/python
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推理
python3 infer.py --model fairmot_hrnetv2_w18_dlafpn_30e_576x320 --video person.mp4 --device cpu
# GPU推理
python3 infer.py --model fairmot_hrnetv2_w18_dlafpn_30e_576x320 --video person.mp4  --device gpu
# GPU上使用TensorRT推理 (注意:TensorRT推理第一次运行,有序列化模型的操作,有一定耗时,需要耐心等待)
python3 infer.py --model fairmot_hrnetv2_w18_dlafpn_30e_576x320 --video person.mp4  --device gpu --use_trt True
NLP模型
一、ernie-3.0
cd  ~/FastDeploy/examples/text/ernie-3.0/python
# 下载AFQMC数据集的微调后的ERNIE 3.0模型
wget https://bj.bcebos.com/fastdeploy/models/ernie-3.0/ernie-3.0-medium-zh-afqmc.tgz
tar xvfz ernie-3.0-medium-zh-afqmc.tgz
# CPU 推理
python3 seq_cls_infer.py --device cpu --model_dir ernie-3.0-medium-zh-afqmc
# GPU 推理
python3 seq_cls_infer.py --device gpu --model_dir ernie-3.0-medium-zh-afqmc
二、uie(报错)
cd  ~/FastDeploy/examples/text/uie/python
# 下载UIE模型文件和词表,以uie-base模型为例
wget https://bj.bcebos.com/fastdeploy/models/uie/uie-base.tgz
tar -xvfz uie-base.tgz
# CPU推理
python3 infer.py --model_dir uie-base --device cpu
# GPU推理
python3 infer.py --model_dir uie-base --device gpu
# 使用OpenVINO推理
python3 infer.py --model_dir uie-base --device cpu --backend openvino --cpu_num_threads 8
语言模型
一、pp-tts
sudo apt-get install libsndfile1 wget zip
python3 -m pip install --upgrade pip
pip3 install -U fastdeploy-python -f https://www.paddlepaddle.org.cn/whl/fastdeploy.html
pip3 install -U paddlespeech paddlepaddle soundfile matplotlib
二、silero-vadcpp
cd ~/FastDeploy/examples/audio/silero-vad/cpp
# 下载 VAD 模型文件和测试音频,解压后将模型和测试音频放置在与 infer_onnx_silero_vad.cc 同级目录下
wget https://bj.bcebos.com/paddlehub/fastdeploy/silero_vad.tgz
wget https://bj.bcebos.com/paddlehub/fastdeploy/silero_vad_sample.wav
# 推理
./infer_onnx_silero_vad ../silero_vad.onnx ../silero_vad_sample.wav