How to use PaddleOCR #9444
Unanswered
Alancnning
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
When i try below program in Jupyter notebook, it show AttributeError. What caused below error happend ?
Both paddlepaddle and paddleocr installed successful.
---------------------code start--------------------------------
from paddleocr import PaddleOCR,draw_ocr
Paddleocr supports Chinese, English, French, German, Korean and Japanese.
You can set the parameter
lang
asch
,en
,fr
,german
,korean
,japan
to switch the language model in order.
ocr = PaddleOCR(use_angle_cls=True, lang='en') # need to run only once to download and load model into memory
img_path = 'C:/Capture1.PNG'
result = ocr.ocr(img_path, cls=True)
for idx in range(len(result)):
res = result[idx]
for line in res:
print(line)
---------------------code end----------------------
Error messages------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 from paddleocr import PaddleOCR,draw_ocr
2 # Paddleocr supports Chinese, English, French, German, Korean and Japanese.
3 # You can set the parameter
lang
asch
,en
,fr
,german
,korean
,japan
4 # to switch the language model in order.
5 ocr = PaddleOCR(use_angle_cls=True, lang='en') # need to run only once to download and load model into memory
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\paddleocr_init_.py:14
1 # Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
(...)
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
---> 14 from .paddleocr import *
16 version = paddleocr.VERSION
17 all = [
18 'PaddleOCR', 'PPStructure', 'draw_ocr', 'draw_structure_result',
19 'save_structure_res', 'download_with_progressbar', 'sorted_layout_boxes',
20 'convert_info_docx', 'to_excel'
21 ]
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\paddleocr\paddleocr.py:25
21 import paddle
23 sys.path.append(os.path.join(dir, ''))
---> 25 import cv2
26 import logging
27 import numpy as np
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\cv2_init_.py:181
176 if DEBUG: print("Extra Python code for", submodule, "is loaded")
178 if DEBUG: print('OpenCV loader: DONE')
--> 181 bootstrap()
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\cv2_init_.py:175, in bootstrap()
172 if DEBUG: print('OpenCV loader: binary extension... OK')
174 for submodule in __collect_extra_submodules(DEBUG):
--> 175 if __load_extra_py_code_for_module("cv2", submodule, DEBUG):
176 if DEBUG: print("Extra Python code for", submodule, "is loaded")
178 if DEBUG: print('OpenCV loader: DONE')
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\cv2_init_.py:28, in __load_extra_py_code_for_module(base, name, enable_debug_print)
26 native_module = sys.modules.pop(module_name, None)
27 try:
---> 28 py_module = importlib.import_module(module_name)
29 except ImportError as err:
30 if enable_debug_print:
File ~\AppData\Local\Programs\Python\Python310\lib\importlib_init_.py:126, in import_module(name, package)
124 break
125 level += 1
--> 126 return _bootstrap._gcd_import(name[level:], package, level)
File ~\AppData\Local\Programs\Python\Python310\lib\site-packages\cv2\gapi_init_.py:290
285 return cls
287 return kernel_with_params
--> 290 cv.gapi.wip.GStreamerPipeline = cv.gapi_wip_gst_GStreamerPipeline
AttributeError: partially initialized module 'cv2' has no attribute 'gapi_wip_gst_GStreamerPipeline' (most likely due to a circular import)
Beta Was this translation helpful? Give feedback.
All reactions