Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.7.5报错:NameError: name 'predict_system' is not defined #12077

Closed
weifang74 opened this issue May 8, 2024 · 2 comments
Closed

2.7.5报错:NameError: name 'predict_system' is not defined #12077

weifang74 opened this issue May 8, 2024 · 2 comments
Assignees

Comments

@weifang74
Copy link

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

  • 系统环境/System Environment: wsl 5.15.153.1-microsoft-standard-WSL2 Upload PaddleOCR code  #1 SMP Fri Mar 29 23:14:13 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
  • 版本号/Version:Paddle:2.6.1 PaddleOCR:2.7.5 问题相关组件/Related components:
  • 运行指令/Command Code:
    from paddleocr import PaddleOCR, draw_ocr

Paddleocr目前支持的多语言语种可以通过修改lang参数进行切换

例如ch, en, fr, german, korean, japan

ocr = PaddleOCR(use_angle_cls=True, lang="ch") # need to run only once to download and load model into memory
img_path = './wang/1.jpg'
result = ocr.ocr(img_path, cls=True)
for idx in range(len(result)):
res = result[idx]
for line in res:
print(line)

显示结果

from PIL import Image
result = result[0]
image = Image.open(img_path).convert('RGB')
boxes = [line[0] for line in result]
txts = [line[1][0] for line in result]
scores = [line[1][1] for line in result]
im_show = draw_ocr(image, boxes, txts, scores, font_path='./fonts/simfang.ttf')
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')

  • 完整报错/Complete Error Message:
    Traceback (most recent call last):
    File "/home/lxh/dev/paddle-ocr/ocr.py", line 1, in
    from paddleocr import PaddleOCR, draw_ocr
    File "/home/lxh/anaconda3/envs/autogen/lib/python3.11/site-packages/paddleocr-2.7.5-py3.11.egg/paddleocr/init.py", line 14, in
    from .paddleocr import *
    File "/home/lxh/anaconda3/envs/autogen/lib/python3.11/site-packages/paddleocr-2.7.5-py3.11.egg/paddleocr/paddleocr.py", line 575, in
    class PaddleOCR(predict_system.TextSystem):
    ^^^^^^^^^^^^^^
    NameError: name 'predict_system' is not defined
@GreatV
Copy link
Collaborator

GreatV commented May 8, 2024

Duplicate of #12057

@GreatV GreatV marked this as a duplicate of #12057 May 8, 2024
@GreatV
Copy link
Collaborator

GreatV commented May 8, 2024

该问题已在main分支修复

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants