Replies: 1 comment
-
您好,感觉抛出异常是环境配置有问题,可以试试官方默认代码是否会有异常 from paddleocr import PaddleOCR
ocr = PaddleOCR(
use_doc_orientation_classify=False, # 通过 use_doc_orientation_classify 参数指定不使用文档方向分类模型
use_doc_unwarping=False, # 通过 use_doc_unwarping 参数指定不使用文本图像矫正模型
use_textline_orientation=False, # 通过 use_textline_orientation 参数指定不使用文本行方向分类模型
)
result = ocr.predict("./general_ocr_002.png")
for res in result:
res.print()
res.save_to_img("output")
res.save_to_json("output") 另外,您的模型下载和实例代码并不正确,模型文件中应该有inference.yaml ,可以参考PP-OCRv5 文档 https://paddlepaddle.github.io/PaddleOCR/latest/version3.x/pipeline_usage/OCR.html#1-ocr 下载模型和修改代码 |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
1、使用环境
paddleOcr 3.0.2
python 3.12
2、模型分别是从下述地址下载的OCRv4:
wget https://paddleocr.bj.bcebos.com/PP-OCRv4/chinese/ch_PP-OCRv4_det_infer.tar
wget https://paddleocr.bj.bcebos.com/PP-OCRv4/chinese/ch_PP-OCRv4_rec_infer.tar 。
3、解压后放在如下目录中
4、在python中使用如下方法,直接导致进程退出,而且不抛出异常
try:
ocr = PaddleOCR(
det_model_dir='models/det',
rec_model_dir='models/rec',
use_angle_cls=False
)
except Exception as e:
print("初始化 PaddleOCR 失败:", e)
return None
Beta Was this translation helpful? Give feedback.
All reactions