paddle ocr 安装部署与使用教程

1.安装Python 3.9
直接执行python-3.9.0-amd64 文件。

2.安装PaddlePaddle v2.0
2.1.安装步骤

python -m pip install --upgrade pip
python -m pip install paddlepaddle==2.0.0b0 -i https://mirror.baidu.com/pypi/simple

2.2.遇到问题
2.2.1.Traceback (most recent call last):
在这里插入图片描述
解决方案:管理员打开cmd 执行

2.2.2. Could not find a version that satisfies the requirement paddlepaddle==2.0.0b0 (from versions: 2.1.0, 2.1.1, 2.1.2)

在这里插入图片描述
解决方案:修改命令为
python -m pip install paddlepaddle==2.1.0 -i https://mirror.baidu.com/pypi/simple
3.克隆PaddleOCR repo代码
git clone https://gitee.com/paddlepaddle/PaddleOCR

4.安装第三方库
cd PaddleOCR python -m pip install -r requirements.txt

4.1.遇到问题
4.1.1.Running setup.py install for scikit-image … error

在这里插入图片描述
解决方案:
1.pip install cython 最新版本0.29,所需版本0.23
2.下载本地whl scikit_image-0.18.2-cp39-cp39-win_amd64 并安装
3.修改 requirement.txt
在这里插入图片描述

4.继续下一步安装

4.1.2. Running setup.py install for python-Levenshtein … error
在这里插入图片描述

解决方案:安装本地的whl,python_Levenshtein-0.12.2-cp39-cp39-win_amd64.whl
whl 下载地址 https://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy ,选择对应python 版本
5.使用
教程:https://www.bookstack.cn/read/PaddleOCR/README.md

5.1.服务化部署
5.1.1.安装 paddlehub
pip install paddlehub --upgrade -i https://pypi.tuna.tsinghua.edu.cn/simple

5.1.2.安装检测识别串联服务模块
hub install deploy/hubserving/ocr_system/
5.1.3.启动 ocr_system 服务
这里配置参数使用配置文件,首先修改"D:\itsvse\PaddleOCR-release-2.0\deploy\hubserving\ocr_system\config.json"配置,如下:
{
“modules_info”: {
“ocr_system”: {
“init_args”: {
“version”: “1.0.0”,
“use_gpu”: false
},
“predict_args”: {
}
}
},
“port”: 8866,
“use_multiprocess”: true,
“workers”: 2
}

使用如下命令启动服务:
hub serving start -c “D:\itsvse\PaddleOCR-release-2.0\deploy\hubserving\ocr_system\config.json”

5.2.Java 调用服务
在这里插入图片描述
测试代码文件下载地址
* https://ai.baidu.com/file/658A35ABAB2D404FBF903F64D47C1F72
* https://ai.baidu.com/file/C8D81F3301E24D2892968F09AE1AD6E2
* https://ai.baidu.com/file/544D677F5D4E4F17B4122FBD60DB82B3
* https://ai.baidu.com/file/470B3ACCA3FE43788B5A963BF0B625F3

5.2.1.调用代码

在这里插入图片描述

5.2.2.返回内容
在这里插入图片描述

5.3.遇到问题
5.3.1.ValueError: numpy.ndarray size changed, may indicate binary incompatibility. Expected 88 from C header, got 80 from PyObject
在这里插入图片描述

解决方案:升级numpy pip3 install --upgrade numpy

5.3.2.ValueError: not find model file path ./inference/ch_ppocr_mobile_v2.0_det_infer//inference.pdmodel
在这里插入图片描述

解决方案:
下载模型 ,模型下载地址
https://gitee.com/paddlepaddle/PaddleOCR/blob/v2.1.1/doc/doc_ch/models_list.md
修改参数文件,
在这里插入图片描述

改为自己的路径

5.3.3.Server returned HTTP response code: 400 for URL: http://127.0.0.1:8868/predict/ocr_system

在这里插入图片描述

解决方案:参数不对,修改参数

猜你喜欢

转载自blog.csdn.net/mp295345033/article/details/119763072