PaddlePaddle / FastDeploy

⚡️An Easy-to-use and Fast Deep Learning Model Deployment Toolkit for ☁️Cloud 📱Mobile and 📹Edge. Including Image, Video, Text and Audio 20+ main stream scenarios and 150+ SOTA models with end-to-end optimization, multi-platform and multi-framework support.
https://www.paddlepaddle.org.cn/fastdeploy
Apache License 2.0
2.93k stars 456 forks source link

RK3588上部署FastDeploy,模型推理无法推理,提示"DBDetector" object has no attribute 'preprocessor'' #2458

Closed carakiacc closed 4 months ago

carakiacc commented 4 months ago

一、前置环境:在x86环境的Ubuntu中,将paddleocr模型转换为onnx,并将onnx转换为rknn模型一切顺利。 二、问题: 在rk3588上执行ocr的rknn模型时提示:[ERROR]:fastdeploy/fastdeploy_model.cc(183)::CreateRKNPUBackend There's no valid npu backends for model: ppocr/ocr_det

  1. 推理环境:RK3588 + Ubuntu20.04

  2. FastDeploy部署: 【编译命令】通过官方指导文档安装部署FastDeploy 【系统平台】:RK3588 【硬件】: NPU 【编译语言】: Python 3.8 编译方法:

    
    git clone https://github.com/PaddlePaddle/FastDeploy.git
    cd FastDeploy

cd python export ENABLE_ORT_BACKEND=ON export ENABLE_RKNPU2_BACKEND=ON export ENABLE_VISION=ON export RKNN2_TARGET_SOC=RK3588

python3 setup.py build python3 setup.py bdist_wheel cd dist pip3 install fastdeploy_python-0.0.0-cp38-cp38-linux_aarch64.whl


执行完提示错误:不论是cpu还是npu都存在问题。
![微信图片_20240520235431](https://github.com/PaddlePaddle/FastDeploy/assets/57511184/01f8e98d-ade7-42b5-b8a1-18a7940699cb)

`/usr/local/python3/bin/python3.8 /opt/content_detecion/FastDeploy-develop/examples/vision/ocr/PP-OCR/rockchip/python/infer.py --det_model /opt/rknn_model/ch_PP-OCRv3_det_infer/ch_PP-OCRv3_det_infer_rk3588_unquantized.rknn --rec_model /opt/rknn_model/ch_PP-OCRv3_rec_infer/ch_PP-OCRv3_rec_infer_rk3588_unquantized.rknn --cls_model /opt/rknn_model/ch_ppocr_mobile_v2.0_cls_infer/ch_ppocr_mobile_v20_cls_infer_rk3588_unquantized.rknn --rec_label_file /opt/content_detecion/paddleOCR/ppocr.txt --image /opt/content_detecion/paddleOCR/12.jpg --device npu

[ERROR] fastdeploy/fastdeploy_model.cc(183)::CreateRKNPUBackend There's no valid npu backends for model: ppocr/ocr_det
[ERROR] fastdeploy/vision/ocr/ppocr/dbdetector.cc(47)::Initialize       Failed to initialize fastdeploy backend.
Traceback (most recent call last):
  File "/opt/content_detecion/FastDeploy-develop/examples/vision/ocr/PP-OCR/rockchip/python/infer.py", line 94, in <module>
    det_model = fd.vision.ocr.DBDetector(
  File "/usr/local/python3/lib/python3.8/site-packages/fastdeploy/vision/ocr/ppocr/__init__.py", line 41, in __init__
    assert self.initialized, "DBDetector initialize failed."
AssertionError: DBDetector initialize failed.`
carakiacc commented 4 months ago

上述问题由公司内网导致,在执行python setup.py build时部分包未下载全,导致rknpu后端引擎未开启成功。 需保证下面参数都是开启状态: ENABLE_ORT_BACKEND=ON
ENABLE_RKNPU2_BACKEND=ON
ENABLE_VISION=ON 1716522614483