• ARM端部署PP-OCR_V3


    ARM端部署PP-OCR_V3(系统环境)

    PaddleOCR 的 Jetson 部署-官方文档

    一、预准备

    1. 下载对应的whl:下载安装Linux预测库 根据系统(win和linux),语言(C++,C,Python),语言版本,CUDA版本,Jetson版本,硬件系统(nano,NX,TX,AGX)等等,一定要选对了

    2. 升级 pip
      如果您到 pip 默认源的网络连接较差,临时使用本镜像站来升级 pip:

      python3.7 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip

      python3.7 -m pip install --upgrade pip

    3. 换源
      python3.7 -m pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

    二、安装PaddlePaddle

    python3.7 -m pip install -U paddlepaddle_gpu-2.3.2-cp37-cp37m-linux_aarch64.whl


    >解决警告:
    >```
    >WARNING: The scripts pip, pip3 and pip3.6 are installed in '/home/agx2/.local/bin' which is not on PATH.
     >Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
    > ```
    >解决方法:
    >```
    >sudo gedit ~/.bashrc
    >export PATH=/home/agx2/.local/bin:$PATH #最后一行添加
    >source ~/.bashrc
    >```
    ---
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12

    三、下载PaddleOCR代码并安装依赖

    首先 clone PaddleOCR 代码:

    git clone https://github.com/PaddlePaddle/PaddleOCR

    然后,安装依赖:

    cd PaddleOCR

    python3.7 -m pip install -r requirements.txt

    python -m pip install paddleocr


    报错 :

    note: This error originates from a subprocess, and is likely not a problem with pip.
    error: subprocess-exited-with-error
    × pip subprocess to install build dependencies did not run successfully.
    │ exit code: 1
    ╰─> See above for output.
    note: This error originates from a subprocess, and is likely not a problem with pip.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

    解决:

    1. sudo python3.7 -m pip install opencv-contrib-python
    2. 注释掉requirements.txt中的: #opencv-contrib-python==4.4.0.46
    3. 继续执行python3.7 -m pip install -r requirements.txt

    四、执行预测

    从文档模型库中获取PPOCR模型,下面以PP-OCRv3模型为例,介绍在PPOCR模型在jetson上的使用方式:

    下载并解压PP-OCRv3模型:

    • wget https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_det_infer.tar
    • wget https://paddleocr.bj.bcebos.com/PP-OCRv3/chinese/ch_PP-OCRv3_rec_infer.tar
    • tar xf ch_PP-OCRv3_det_infer.tar
    • tar xf ch_PP-OCRv3_rec_infer.tar

    执行文本检测预测:

    • cd PaddleOCR
    • python3.7 tools/infer/predict_det.py --det_model_dir=./ch_PP-OCRv3_det_infer --image_dir=./doc/imgs/french_0.jpg --use_gpu=True

    报错:

    OSError: Could not find lib geos_c or load any of its variants ['libgeos_c.so.1', 'libgeos_c.so'].
    
    • 1

    解决:

    • sudo apt-get install libgeos-dev

    • 再次执行
      python3.7 tools/infer/predict_det.py --det_model_dir=./ch_PP-OCRv3_det_infer --image_dir=./doc/imgs/french_0.jpg --use_gpu=True

    • 结果在./inference_results


    conda 环境的使用

    conda环境的设置没有太大的变化,

    1. 需要在arm端安装miniconda
    2. 创建conda中的python环境,按照paddlepaddle的情况去配置
    3. conda环境中的python要安装这几个包:pip install rospkg catkin_tools
    4. 执行的节点代码开头的#! /usr/bin/env python3.7改为#! /home/gsh/anaconda3/envs/pplabel/bin/python
    5. 按照系统环境以上过程进行即可

    • 报错,缺少libgeos_c.os
    • 解决:conda install geopandas
  • 相关阅读:
    mindspore::dataset::GetAffineTransform的输出与cv2的输出不同
    Leetcode刷题详解——打家劫舍 II
    Jupyter使用技巧
    基于java+SpringBoot+HTML+Mysql在线学习答疑平台(类似百度知道)
    python+vue+django城市公交车辆调度运营管理系统flask-pycharm毕业设计项目lw
    Linux Shell 实现密码掩码输入
    [暑假]什么叫做原型?原型链?原型对象? [待补充]
    来自华为的暴击?传高通裁员赔偿N+7 | 百能云芯
    Java基础—Document类型的变化
    ubuntu/Linux连接redis教程
  • 原文地址:https://blog.csdn.net/crazty/article/details/126484626