使用paddleocr推理出错
🔎 Search before asking
- [x] I have searched the PaddleOCR Docs and found no similar bug report.
- [x] I have searched the PaddleOCR Issues and found no similar bug report.
- [x] I have searched the PaddleOCR Discussions and found no similar bug report.
🐛 Bug (问题描述)
使用最新版paddleocr推理出现错误: 安装paddlepaddle_gpu-2.5.2.post117-cp38-cp38-linux_x86_64出现以下错误:
安装paddlepaddle_gpu-2.6.1.post117-cp38-cp38-linux_x86_64出现以下错误:
如果将这两个报错屏蔽掉:报错
🏃♂️ Environment (运行环境)
OS linux
python 3.8.20
paddleOCR 3.0.1
paddle paddlepaddle_gpu-2.6.1.post117
CUDA 12.8
🌰 Minimal Reproducible Example (最小可复现问题的Demo)
使用推理代码为:
# -*- coding: utf-8 -*-
from paddleocr import PaddleOCR
# 初始化 PaddleOCR 实例
ocr = PaddleOCR(
# ocr_version='PP-OCRv4',
use_doc_orientation_classify=False,
use_doc_unwarping=False,
use_textline_orientation=False)
# 对示例图像执行 OCR 推理
result = ocr.predict(
input="A.png")
# 可视化结果并保存 json 结果
for res in result:
res.print()
res.save_to_img("output")
res.save_to_json("output")
PaddleOCR 3.0要求使用Paddle 3.0以上框架
PaddleOCR 3.0要求使用Paddle 3.0以上框架
好的,谢谢。我重新安装了PaddleOCR 2.10.0,paddle 2.6.1.post117,python 3.8,检测模型为PP-OCRv4,但是推理不出结果。
检测图片:
使用官方图片,检测效果如下:
检测效果不好,是不是这个版本本来效果就差呢
推理代码如下:
from paddleocr import PaddleOCR,draw_ocr
ocr = PaddleOCR(version='PP-OCRv4',lang='en') # need to run only once to download and load model into memory
img_path = './test_ocr/nist_demo.png'
result = ocr.ocr(img_path, cls=False)
print("res",result)
for idx in range(len(result)):
res = result[idx]
for line in res:
print(line)
# draw result
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='./doc/fonts/simfang.ttf')
im_show = Image.fromarray(im_show)
im_show.save('result.jpg')
看起来是算法效果的问题,可以先尝试一下调整参数进行效果调优~
paddleocr 3.0, paddlepaddle 3.0-gpu 预测没有输出,但是 cpu 版本是正常的,这怎么办。
paddleocr 3.0, paddlepaddle 3.0-gpu 预测没有输出,但是 cpu 版本是正常的,这怎么办。
这种情况请检查一下安装的paddle-gpu版本与本机的CUDA版本是否对应
The issue has no response for a long time and will be closed. You can reopen or new another issue if are still confused.
From Bot