PaddlePaddle / PaddleOCR

Awesome multilingual OCR toolkits based on PaddlePaddle (practical ultra lightweight OCR system, support 80+ languages recognition, provide data annotation and synthesis tools, support training and deployment among server, mobile, embedded and IoT devices)
https://paddlepaddle.github.io/PaddleOCR/
Apache License 2.0
43.7k stars 7.78k forks source link

M3 芯片电脑在进行 OCR 识别是会一直卡住不动 #14086

Closed hb-2017 closed 3 hours ago

hb-2017 commented 4 hours ago

🔎 Search before asking

🐛 Bug (问题描述)

正常使用 ocr 进行文字识别的时候,会一直卡在 result = ocr.ocr(image_resized, cls=True) 这一行不动,也没有日志

image

🏃‍♂️ Environment (运行环境)

image

(.venv3.9) mark@Mark dnfm-yolo-tutorial % pip list | grep paddle paddleocr 2.9.1 paddlepaddle 2.6.2

python 版本:3.9

🌰 Minimal Reproducible Example (最小可复现问题的Demo)

import cv2 from paddleocr import PaddleOCR

# 初始化 OCR 模型
ocr = PaddleOCR(use_angle_cls=True, lang='en', use_gpu=False)  # 使用 CPU

# 使用 OpenCV 读取图片
image_path = '/Users/mark/Downloads/ppocr_img/imgs_words/ch/word_1.jpg'
image = cv2.imread(image_path)

# 将图像从 BGR 转换为 RGB,并调整尺寸
image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
image_resized = cv2.resize(image_rgb, (640, 480))  # 调整为适合的尺寸

# 进行文字识别

result = ocr.ocr(image_resized, cls=True)

# 输出识别结果
for line in result:
    for word_info in line:
        text = word_info[1][0]
        confidence = word_info[1][1]
        print(f'Text: {text}, Confidence: {confidence}')
GreatV commented 4 hours ago

python -m pip install paddlepaddle==3.0.0b1 -i https://www.paddlepaddle.org.cn/packages/stable/cpu/