PaddleOCR #PP-OCR常见异常扫雷

4 篇文章 0 订阅
4 篇文章 0 订阅

异常一:ModuleNotFoundError: No module named ‘tools.infer’

实验案例: PaddleOCR #使用PaddleOCR进行光学字符识别(PP-OCR文本检测识别)
参考代码: 图片文本检测实验时,运行代码出现异常:ModuleNotFoundError: No module named ‘tools.infer’

# Importing required libraries.
import cv2
import os
import numpy as np
import sys
import re
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.image as img
import time
import numpy
 
# Importing functions and methods for OCR
from tools.infer.predict_rec import *
import tools.infer.utility as utility
from ppocr.postprocess import build_post_process
from ppocr.utils.logging import get_logger
from ppocr.utils.utility import get_image_file_list, check_and_read_gif

异常信息:

    import tools.infer.utility as utility
ModuleNotFoundError: No module named 'tools.infer'

异常原因: 这是由于 python 本来有个 tools,和 paddleocr 内部的 tools 冲突导致。可能是 paddleocr 版本问题,也可能是 python 环境问题。
解决方法:
方法1:找到 paddleocr 文件把所有导入 tools.infer 包的地方的前面加上 paddleocr. 即为 paddleocr.tools.infer
方法2:把 paddleocr/tools 下面的 infer 文件夹移动到 python 本身的 tools 里面

试过方法1,未能成功。
但按下面的方式,将当前目录添加到 python 的模块搜索路径中,可解决脚本方式出现这个异常:

# Importing required libraries.
import cv2
import os
import numpy as np
import sys
import re
import pandas as pd
import matplotlib.pyplot as plt
import matplotlib.image as img
import time
import numpy

# 获取当前脚本文件的绝对路径所在的目录路径,并将其赋值给变量 __dir__。
__dir__ = os.path.dirname(os.path.abspath(__file__))
# 将当前脚本文件的绝对路径所在的目录路径添加到Python的模块搜索路径中。
sys.path.append(__dir__)
# 将当前脚本文件的上一级目录路径添加到Python的模块搜索路径中。os.path.join(__dir__, '..') 用于获取上一级目录的路径,os.path.abspath() 用于获取绝对路径。
sys.path.insert(0, os.path.abspath(os.path.join(__dir__, '..')))

import importlib
tools = importlib.import_module('.', 'tools')
ppocr = importlib.import_module('.', 'ppocr')
 
# Importing functions and methods for OCR
from tools.infer.predict_rec import *
import tools.infer.utility as utility
from ppocr.postprocess import build_post_process
from ppocr.utils.logging import get_logger
from ppocr.utils.utility import get_image_file_list, check_and_read_gif

方法2亲测可行:
1)CMD 通过命令确认本地 python 的 tools 包位置
ocr-03-01
2)把 paddleocr/tools 下面的 infer 文件夹移动到 python 本身的 tools 文件夹中
ocr-03-02
注:场景2,CMD 方式的异常场景的原因可能各有不同,主要是因为本地安装的 paddleocr 版本各异。但主要原因可归为版本不兼容,可根据异常提示逐步补全依赖目录或文件解决,但比较繁琐。

 

异常二:ImportError: cannot import name ‘check_and_read_gif’ from ‘ppocr.utils.utility’

实验案例: PaddleOCR #使用PaddleOCR进行光学字符识别(PP-OCR文本检测识别)

Traceback (most recent call last):
  File "D:\Tp_Mylocal\20_Install\python-3.9.13\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\Tp_Mylocal\20_Install\python-3.9.13\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\Tp_Mylocal\20_Install\python-3.9.13\Scripts\paddleocr.exe\__main__.py", line 4, in <module>
  File "D:\Tp_Mylocal\20_Install\python-3.9.13\lib\site-packages\paddleocr\__init__.py", line 14, in <module>
    from .paddleocr import *
  File "D:\Tp_Mylocal\20_Install\python-3.9.13\lib\site-packages\paddleocr\paddleocr.py", line 37, in <module>
    from tools.infer import predict_system
  File "D:\Tp_Mylocal\20_Install\python-3.9.13\lib\site-packages\tools\infer\predict_system.py", line 32, in <module>
    import tools.infer.predict_rec as predict_rec
  File "D:\Tp_Mylocal\20_Install\python-3.9.13\lib\site-packages\tools\infer\predict_rec.py", line 33, in <module>
    from ppocr.utils.utility import get_image_file_list, check_and_read_gif
ImportError: cannot import name 'check_and_read_gif' from 'ppocr.utils.utility' (D:\Tp_Mylocal\20_Install\python-3.9.13\lib\site-packages\paddleocr\ppocr\utils\utility.py)

亦或者:

Traceback (most recent call last):
  File "D:\Tp_Mylocal\20_Install\python-3.9.13\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "D:\Tp_Mylocal\20_Install\python-3.9.13\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "D:\Tp_Mylocal\20_Install\python-3.9.13\Scripts\paddleocr.exe\__main__.py", line 4, in <module>
  File "D:\Tp_Mylocal\20_Install\python-3.9.13\lib\site-packages\paddleocr\__init__.py", line 14, in <module>
    from .paddleocr import *
  File "D:\Tp_Mylocal\20_Install\python-3.9.13\lib\site-packages\paddleocr\paddleocr.py", line 41, in <module>
    from ppocr.utils.utility import check_and_read, get_image_file_list
ImportError: cannot import name 'check_and_read' from 'ppocr.utils.utility' (D:\Tp_Mylocal\20_Install\python-3.9.13\lib\site-packages\ppocr\utils\utility.py)

异常原因: 此问题八成是你安装的 PaddleOCR 版本不兼容产生的问题,比如可能你通过下面的命令成功安装了 paddleocr、paddlepaddle

pip install paddlepaddle paddleocr

Successfully installed paddleocr-2.6.1.3 paddlepaddle-2.4.2

但通过 CMD 运行时,总是有异常说 xxx 包找不到,或者 xxx 方法引入不到。根本原因就是你执行的路径下的异常文件代码中(比如上述 path\python-3.x.xx\lib\site-packages\paddleocr\paddleocr.py)确实没有这些需要的目录或文件
ocr-03-02
解决方案:
方案1: 重新安装版本
1)使用 CMD 命令 pip uninstall paddlepaddle paddleocr 卸载 paddleocr
2)安装指定版本的 paddlepaddle

pip install paddlepaddle==2.4.2 -i https://pypi.tuna.tsinghua.edu.cn/simple

3)安装指定版本的 paddleocr

pip install paddleocr==2.5.0.3

注:如果你本地下载过 opencv、paddleocr 的源码,可通过 paddleocr.py 代码查看你应该需要安装的 paddleocr 版本号:
ocr-03-04
方案2: 补全依赖目录或文件
根据异常提示,将缺省的文件或方法从源码中拷贝到 CMD 执行环境中,逐步补全依赖目录或文件解决,但比较繁琐。
比如在 paddleocr-2.6.1.3 版本中 paddleocr.py 代码的依赖是

from ppocr.utils.utility import check_and_read, get_image_file_list

但在 ppocr.utils.utility 这个对象中提供的函数却是 check_and_read_gif,自然是会执行异常。

通过方案1或方案2操作后,可通过 paddleocr --help 校验环境是否OK。

 

异常三:Please use PaddlePaddle with GPU version

实验案例: PaddleOCR #使用PaddleOCR进行光学字符识别(PP-OCR文本检测识别)

D:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR>python ./tools/infer/predict_det.py --image_dir="./doc/imgs/00018069.jpg" --det_model_dir="./inference/ch_PP-OCRv3_rec_infer/"
E0608 16:27:13.135995 15300 analysis_config.cc:110] Please use PaddlePaddle with GPU version.

异常原因: 实验机器不支持GPU模式。
解决方案:
确保你已安装了 CPU 版本的 PaddlePaddle。
通过将 --use_gpu 参数设置为 False,您告诉 PaddleOCR 在 CPU 上运行,不使用 GPU,如:

paddleocr --image_dir ./doc/imgs/japan_2.jpg --use_angle_cls true --use_gpu false

 

异常四:ModuleNotFoundError: No module named ‘ppocr’

实验案例: PaddleOCR #使用PaddleOCR进行光学字符识别(PP-OCR文本检测识别)

    from ppocr.utils.logging import get_logger
ModuleNotFoundError: No module named 'ppocr'

异常信息:

    ppocr = importlib.import_module('.', 'ppocr')
  File "D:\Tp_Mylocal\20_Install\python-3.9.13\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 984, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'ppocr'

异常原因: ModuleNotFoundError: No module named ‘ppocr’ 错误表明您缺少了名为 ‘ppocr’ 的模块。这可能是由于以下原因之一导致的:

  1. 缺少依赖库: ‘ppocr’ 模块可能依赖其他库或模块。请确保您已经安装了所有必需的依赖库。您可以通过运行 pip install -r requirements.txt 命令安装项目所需的依赖库。
  2. 缺少 ‘ppocr’ 模块: 请确保 ‘ppocr’ 模块已经正确地安装在您的环境中。您可以使用 pip list 命令查看已安装的模块列表,确认 ‘ppocr’ 模块是否存在。
  3. 模块路径问题: 如果 ‘ppocr’ 模块不在默认的模块搜索路径中,您需要将其路径添加到 Python 搜索路径中。可以通过在脚本中添加以下代码来添加模块路径:
import sys
# 请确保将 /path/to/ppocr 替换为实际 'ppocr' 模块所在的路径
sys.path.append('/path/to/ppocr')

注意,请确保将 /path/to/ppocr 替换为实际 ‘ppocr’ 模块所在的路径。如果还是不行,可参考下面的解决方案:
解决方案:

# 获取当前脚本文件的绝对路径所在的目录路径,并将其赋值给变量 __dir__。
__dir__ = os.path.dirname(os.path.abspath(__file__))
# 将当前脚本文件的绝对路径所在的目录路径添加到Python的模块搜索路径中。
sys.path.append(__dir__)
# 将当前脚本文件的上一级目录路径添加到Python的模块搜索路径中。os.path.join(__dir__, '..') 用于获取上一级目录的路径,os.path.abspath() 用于获取绝对路径。
sys.path.insert(0, os.path.abspath(os.path.join(__dir__, '..')))

注:与异常一类似。

 

异常五:UnicodeEncodeError: ‘gbk’ codec can’t encode character ‘\xae’ in position 2: illegal multibyte sequence

实验案例: PaddleOCR #使用PaddleOCR进行光学字符识别 - OCR模型对比
异常现象: 在使用 PaddlePaddle-OCRv2 (PP-OCRv2) 进行实验时,出现异常:

[2023/06/09 19:06:19] ppocr INFO: Predicts of ../COCO-text/COCO_test\1087034.jpg:('皖S', 0.4052684009075165)
[2023/06/09 19:06:19] ppocr INFO: Predicts of ../COCO-text/COCO_test\1087141.jpg:('S AVe', 0.7147024273872375)
[2023/06/09 19:06:19] ppocr INFO: Predicts of ../COCO-text/COCO_test\1087170.jpg:('®', 0.054067403078079224)
Traceback (most recent call last):
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\applications\pp_ocr_v2.py", line 156, in <module>
    rec(utility.parse_args(), out_path, input_org, rec_model_dir, show = False)
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\applications\pp_ocr_v2.py", line 106, in rec
    f.write(str(rec_res[ino]))
UnicodeEncodeError: 'gbk' codec can't encode character '\xae' in position 2: illegal multibyte sequence

异常原因: 这个错误是由于在写入文件时遇到了无法编码的字符导致的。根据错误信息,似乎是在将结果写入文件时遇到了特殊字符 ‘\xae’,导致无法使用 ‘gbk’ 编码进行写入。

解决方案: 尝试修改文件编码方式,将其设置为支持特殊字符的编码方式,例如 encoding='utf-8' 。比如,如果这里现在是写文件遇到特殊字符异常,那么就在读文件时将特殊字符进行 UTF-8 读取。

for ino in range(len(img_list)):
    logger.info("Predicts of {}:{}".format(valid_image_file_list[ino], rec_res[ino]))
    if save:
        cv2.imwrite(os.path.join(out_path, valid_image_file_list[ino].split('/')[-1].split('.')[0] + '_rec' + '.jpg'), img_list[ino])
        with open(os.path.join(out_path, valid_image_file_list[ino].split('/')[-1].split('.')[0] + '.txt'), 'w', encoding='utf-8') as f:
            f.write(str(rec_res[ino]))

 

异常六:ValueError: not find model file path ./inference/rec_r50_vd_srn_train/inference.pdmodel

实验案例: PaddleOCR #使用PaddleOCR进行光学字符识别 - OCR模型对比

[2023/06/12 15:32:34] ppocr INFO: 开始 ...
yes
Traceback (most recent call last):
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\applications\pp_ocr_srn.py", line 156, in <module>
    rec(utility.parse_args(), out_path, input_org, rec_model_dir, rec_image_shape = '1, 64, 256', rec_char_type = 'en', rec_algorithm = 'SRN', show = False)
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\applications\pp_ocr_srn.py", line 68, in rec
    text_recognizer = TextRecognizer(args)
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\tools\infer\predict_rec.py", line 74, in __init__
    utility.create_predictor(args, 'rec', logger)
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\tools\infer\utility.py", line 174, in create_predictor
    raise ValueError("not find model file path {}".format(
ValueError: not find model file path ./inference/rec_r50_vd_srn_train/inference.pdmodel

异常原因: 该错误提示表明代码无法在指定路径 ./inference/rec_r50_vd_srn_train/inference.pdmodel 中找到所需的模型文件。
解决方案:
1)检查模型文件路径是否正确:确保模型文件 inference.pdmodel 存在于指定的路径 ./inference/rec_r50_vd_srn_train/ 下,并且路径名称的大小写与实际文件系统匹配。如果文件在这个目录下,那么就是相对路径不全导致找不到文件。
2)重新生成模型文件放于当前目前下。

 

异常七:TypeError: ‘<’ not supported between instances of ‘tuple’ and ‘float’

实验案例: PaddleOCR #使用PaddleOCR进行光学字符识别 - OCR模型对比
异常原因: OCR 图片识别结果的数据结构与源码需要解析取值的数据结构不兼容
解决方案: 移除 OCR 图片识别结果的外部一维

# 图片识别
result = ocr.ocr(img_path)
print("OCR 图片识别结果:", result)

# 通过使用 result = result[0] 移除外部的一维来解决 paddleocr\tools\infer\utility.py 文件中 draw_ocr 函数的 TypeError: '<' not supported between instances of 'tuple' and 'float'
result = result[0]
# print("移除一维后图片识别结果:", result)

# 保存可视化OCR检测识别结果
save_ocr(img_path, out_path, result, font)

注:异常现象的处理方式与异常八相反

 

异常八:TypeError: ‘float’ object is not subscriptable

实验案例: PaddleOCR #使用PaddleOCR进行光学字符识别 - OCR模型对比
异常原因: OCR 图片识别结果的数据结构与源码需要解析取值的数据结构不兼容

Traceback (most recent call last):
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\applications\ocr_img_apply.py", line 55, in <module>
    ocr_img(img_path)
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\applications\ocr_img_util.py", line 49, in ocr_img
    save_ocr(img_path, out_path, result, font)
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\applications\ocr_img_util.py", line 65, in save_ocr
    txts = [line[1][0] for line in result]
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\applications\ocr_img_util.py", line 65, in <listcomp>
    txts = [line[1][0] for line in result]
TypeError: 'float' object is not subscriptable

异常原因: OCR 图片识别结果的数据结构与源码需要解析取值的数据结构不兼容
解决方案: 直接使用 OCR 源码检测识别的结果进行可视化保存

def ocr_img(img_path):
  print("OCR 图片识别地址:", img_path)

  # 图片识别
  result = ocr.ocr(img_path)
  print("OCR 图片识别结果:", result)

  # 通过使用 result = result[0] 移除外部的一维来解决 paddleocr\tools\infer\utility.py 文件中 draw_ocr 函数的 TypeError: '<' not supported between instances of 'tuple' and 'float'
  # result = result[0]
  # print("移除一维后图片识别结果:", result)

  # 保存可视化OCR检测识别结果
  save_ocr(img_path, out_path, result, font)

注:异常现象的处理方式与异常六相反

 

异常九:AttributeError: module ‘numpy’ has no attribute ‘int’.

实验案例: PaddleOCR #使用PaddleOCR进行光学字符识别(PP-OCR文本检测识别)

Traceback (most recent call last):
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\applications\ocr_img_apply.py", line 55, in <module>
    ocr_img(img_path)
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\applications\ocr_img_util.py", line 41, in ocr_img
    result = ocr.ocr(img_path)
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\paddleocr.py", line 474, in ocr
    dt_boxes, rec_res = self.__call__(img, cls)
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\tools\infer\predict_system.py", line 69, in __call__
    dt_boxes, elapse = self.text_detector(img)
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\tools\infer\predict_det.py", line 242, in __call__
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\ppocr\postprocess\db_postprocess.py", line 188, in __call__
    boxes, scores = self.boxes_from_bitmap(pred[batch_index], mask,
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\ppocr\postprocess\db_postprocess.py", line 82, in boxes_from_bitmap
    score = self.box_score_fast(pred, points.reshape(-1, 2))
  File "d:\Ct_ iSpace\Tan\opencv\learnopencv-master\Optical-Character-Recognition-using-PaddleOCR\PaddleOCR\ppocr\postprocess\db_postprocess.py", line 140, in box_score_fast
    xmin = np.clip(np.floor(box[:, 0].min()).astype(np.int), 0, w - 1)
  File "D:\Tp_Mylocal\20_Install\python-3.9.13\lib\site-packages\numpy\__init__.py", line 305, in __getattr__
    raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'int'.
`np.int` was a deprecated alias for the builtin `int`. To avoid this error in existing code, use `int` by itself. Doing this will not modify any behavior and is safe. When replacing `np.int`, you may wish to use e.g. `np.int64` or `np.int32` to specify the precision. If you 
wish to review your current use, check the release note link for additional information.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
    https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations

异常原因:
在较旧的 NumPy 版本(1.19及更早版本)中,np.int 是合法的别名。但是从 NumPy 1.20 版本开始,np.int 被弃用并引发了警告。从 NumPy 1.21 版本开始,np.int 完全被移除,不再可用。

因此,如果你使用的是 NumPy 1.20或更高版本,将 np.int 替换为 int 是推荐的做法。对于较旧的 NumPy 版本,np.int 仍然可用,但不推荐使用,建议迁移到使用 int 类型。
ocr-03-05
解决方案:

  • 在代码中将 np.int 替换为 int。
  • 如果代码中存在其他使用了 np.int 的地方,也需要进行相应的替换。
  • 确保你正在使用最新版本的 NumPy 库。

可以使用以下命令升级到最新版本的 NumPy:

pip install --upgrade numpy

或者,升级到指定版本的 NumPy:

pip install numpy==1.21.1

ocr-03-06
注意:如果你的项目有其他依赖项依赖于较新的 NumPy 版本,降级 NumPy 可能会导致冲突。在执行降级操作之前,请确保你的项目不会受到这种影响,并仔细考虑可能的后果。

opencv源码参考文档: https://learnopencv.com/optical-character-recognition-using-paddleocr/

  • 4
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 5
    评论
PaddleOCR PP-Structurev2是一个基于PaddlePaddle深度学习框架的OCR工具,可以实现文字识别、表格识别、印章识别等功能。以下是PP-Structurev2的使用教程: 1. 安装PaddleOCR 首先需要安装PaddleOCR。可以使用以下命令进行安装: ``` pip install paddleocr ``` 2. 下载PP-Structurev2模型 PP-Structurev2依赖于特定的模型,需要下载对应的模型文件。可以从PaddleOCR的GitHub仓库中下载: ``` git clone https://github.com/PaddlePaddle/PaddleOCR.git cd PaddleOCR wget https://paddleocr.bj.bcebos.com/PP-Structure_v2/ch/ch_ppocr_server_v2.0_rec_infer.tar wget https://paddleocr.bj.bcebos.com/PP-Structure_v2/ch/ch_ppocr_mobile_v2.0_cls_infer.tar wget https://paddleocr.bj.bcebos.com/PP-Structure_v2/ch/ch_ppocr_mobile_v2.0_det_infer.tar tar xf ch_ppocr_server_v2.0_rec_infer.tar tar xf ch_ppocr_mobile_v2.0_cls_infer.tar tar xf ch_ppocr_mobile_v2.0_det_infer.tar ``` 3. 使用PP-Structurev2 使用PP-Structurev2需要先加载模型。可以使用以下代码加载模型: ``` import paddleocr ocr = paddleocr.OCR( det_model_dir='ch_ppocr_mobile_v2.0_det_infer', rec_model_dir='ch_ppocr_server_v2.0_rec_infer', cls_model_dir='ch_ppocr_mobile_v2.0_cls_infer', use_angle_cls=True, lang='ch' ) ``` 加载模型后,就可以使用PP-Structurev2进行文字识别、表格识别、印章识别等操作。以下是一些示例代码: ``` # 文字识别 result = ocr.ocr('example.jpg') for line in result: print(line) # 表格识别 result = ocr.table_ocr('example.jpg') for table in result: for row in table: print(row) # 印章识别 result = ocr.seal_ocr('example.jpg') print(result) ``` 以上就是PP-Structurev2的使用教程。需要注意的是,PP-Structurev2的模型文件比较大,下载和加载模型可能需要花费一些时间。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值