Метод PaddleOCR Predict() выдает NotImplementedErrorPython

Программы на Python
Ответить
Anonymous
 Метод PaddleOCR Predict() выдает NotImplementedError

Сообщение Anonymous »

Я пытаюсь использовать PaddleOCR:

Код: Выделить всё

from paddleocr import PaddleOCR
from PIL import Image

# Initialize the OCR engine
ocr = PaddleOCR(use_textline_orientation=False, lang='es')

# Run OCR on an image path
img_path = '../datos/casa_ley/febrero_2026/04022026_pagina_01.png'
result = ocr.predict(img_path)

# Print the results
for res in result:
res.print()
res.save_to_img("output")
res.save_to_json("output")
...но я получаю NotImplementedError при вызове метода Predict():

Код: Выделить всё

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[15], line 10
8 # Run OCR on an image path (can be a local file or a web URL)
9 img_path = '../datos/casa_ley/febrero_2026/04022026_pagina_01.jpg'
---> 10 result = ocr.predict(img_path)
12 # Print the results
13 for res in result:

File c:\Users\angel.merino\Documents\GitHub\sina\.venv\Lib\site-packages\paddleocr\_pipelines\ocr.py:213, in PaddleOCR.predict(self, input, use_doc_orientation_classify, use_doc_unwarping, use_textline_orientation, text_det_limit_side_len, text_det_limit_type, text_det_thresh, text_det_box_thresh, text_det_unclip_ratio, text_rec_score_thresh, return_word_box)
198 def predict(
199     self,
200     input,
(...)
211     return_word_box=None,
212 ):
--> 213     return list(
214         self.predict_iter(
215             input,
216             use_doc_orientation_classify=use_doc_orientation_classify,
217             use_doc_unwarping=use_doc_unwarping,
218             use_textline_orientation=use_textline_orientation,
219             text_det_limit_side_len=text_det_limit_side_len,
220             text_det_limit_type=text_det_limit_type,
221             text_det_thresh=text_det_thresh,
222             text_det_box_thresh=text_det_box_thresh,
223             text_det_unclip_ratio=text_det_unclip_ratio,
224             text_rec_score_thresh=text_rec_score_thresh,
225             return_word_box=return_word_box,
226         )
227     )

[...]

NotImplementedError: (Unimplemented) ConvertPirAttribute2RuntimeAttribute not support [pir::ArrayAttribute]
(at ..\paddle\fluid\framework\new_executor\instruction\onednn\onednn_instruction.cc:118)
Что я делаю не так?
Правильно ли использовать метод Predict() или мне следует использовать другую функцию? Я знаю, что файл ocr.ocr устарел и говорит, что нужно использовать прогноз, но у меня он не работает.

Подробнее здесь: https://stackoverflow.com/questions/798 ... entederror
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Python»