From 08c8da535214b633393d7c880801b1005c0135df Mon Sep 17 00:00:00 2001 From: yunyaoXYY <109218879+yunyaoXYY@users.noreply.github.com> Date: Mon, 13 Mar 2023 14:03:59 +0800 Subject: [PATCH] [FastDeploy] Improve fastdeploy code and readme (#9379) * Fix padding value in rec model, and box sort in det model * Add FastDeploy support to deploy PaddleOCR models. * Improve readme * improve readme * improve readme * improve code --- deploy/fastdeploy/cpu-gpu/cpp/infer.cc | 6 +++--- deploy/fastdeploy/cpu-gpu/csharp/README.md | 2 +- deploy/fastdeploy/cpu-gpu/python/infer.py | 18 +++++++++--------- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/deploy/fastdeploy/cpu-gpu/cpp/infer.cc b/deploy/fastdeploy/cpu-gpu/cpp/infer.cc index 6906a017..1464edac 100644 --- a/deploy/fastdeploy/cpu-gpu/cpp/infer.cc +++ b/deploy/fastdeploy/cpu-gpu/cpp/infer.cc @@ -152,9 +152,9 @@ int main(int argc, char *argv[]) { option.UsePaddleBackend(); // Paddle Inference } else if (flag == 5) { option.UseGpu(); - option.UseTrtBackend(); - option.EnablePaddleTrtCollectShape(); - option.EnablePaddleToTrt(); // Paddle-TensorRT + option.UsePaddleInferBackend(); + option.paddle_infer_option.collect_trt_shape = true; + option.paddle_infer_option.enable_trt = true; // Paddle-TensorRT } else if (flag == 6) { option.UseGpu(); option.UseOrtBackend(); // ONNX Runtime diff --git a/deploy/fastdeploy/cpu-gpu/csharp/README.md b/deploy/fastdeploy/cpu-gpu/csharp/README.md index 335c774a..551db8e6 100755 --- a/deploy/fastdeploy/cpu-gpu/csharp/README.md +++ b/deploy/fastdeploy/cpu-gpu/csharp/README.md @@ -70,7 +70,7 @@ infer_demo ./ch_PP-OCRv3_det_infer ./ch_ppocr_mobile_v3.0_cls_infer ./ch_PP-OCRv ## 5. PP-OCRv3 C# API接口简介 下面提供了PP-OCRv3的C# API简介 -- 如果用户想要更换部署后端或进行其他定制化操作, 请查看[C# Runtime API](https://github.com/PaddlePaddle/FastDeploy/blob/develop/csharp/fastdeploy/runtime_option.cs). +- 如果用户想要更换部署后端或进行其他定制化操作, 请查看[C# Runtime API](https://baidu-paddle.github.io/fastdeploy-api/csharp/html/classfastdeploy_1_1RuntimeOption.html). - 更多 PP-OCR C# API 请查看 [C# PP-OCR API](https://github.com/PaddlePaddle/FastDeploy/blob/develop/csharp/fastdeploy/vision/ocr/model.cs) ### 模型 diff --git a/deploy/fastdeploy/cpu-gpu/python/infer.py b/deploy/fastdeploy/cpu-gpu/python/infer.py index cb5d21c4..23f940c8 100755 --- a/deploy/fastdeploy/cpu-gpu/python/infer.py +++ b/deploy/fastdeploy/cpu-gpu/python/infer.py @@ -105,17 +105,17 @@ def build_option(args): elif args.backend.lower() == "pptrt": assert args.device.lower( ) == "gpu", "Paddle-TensorRT backend require inference on device GPU." - det_option.use_trt_backend() - det_option.enable_paddle_trt_collect_shape() - det_option.enable_paddle_to_trt() + det_option.use_paddle_infer_backend() + det_option.paddle_infer_option.collect_trt_shape = True + det_option.paddle_infer_option.enable_trt = True - cls_option.use_trt_backend() - cls_option.enable_paddle_trt_collect_shape() - cls_option.enable_paddle_to_trt() + cls_option.use_paddle_infer_backend() + cls_option.paddle_infer_option.collect_trt_shape = True + cls_option.paddle_infer_option.enable_trt = True - rec_option.use_trt_backend() - rec_option.enable_paddle_trt_collect_shape() - rec_option.enable_paddle_to_trt() + rec_option.use_paddle_infer_backend() + rec_option.paddle_infer_option.collect_trt_shape = True + rec_option.paddle_infer_option.enable_trt = True # If use TRT backend, the dynamic shape will be set as follow. # We recommend that users set the length and height of the detection model to a multiple of 32. -- GitLab