等文章搭建好paddleOCR后
无论是命令行:
>python tools/infer/predict_system.py --image_dir="C:\Users\PC\Desktop\test1.png" --det_model_dir="D:/PaddleOCR-2.6/inference/ch_ppocr_mobile_v2.0_det_infer" --rec_model_dir="D:/PaddleOCR-2.6/inference/ch_ppocr_mobile_v2.0_rec_infer" --cls_model_dir="D:/PaddleOCR-2.6/inference/ch_ppocr_mobile_v2.0_cls_infer" --use_angle_cls=True --use_space_char=False --use_gpu=True
还是代码里
from paddleocr import PaddleOCR
ocr = PaddleOCR(use_angle_cls=True, lang="ch", det_model_dir="D:/PaddleOCR-2.6/inference/ch_ppocr_mobile_v2.0_det_infer", rec_model_dir="D:/PaddleOCR-2.6/inference/ch_ppocr_mobile_v2.0_rec_infer",
cls_model_dir="D:/PaddleOCR-2.6/inference/ch_ppocr_mobile_v2.0_cls_infer")
img_path = 'C:/Users/PC/Desktop/test1.png'
result = ocr.ocr(img_path, cls=False)
for line in result:
print(line)
都能运行成功,显示:
[2025/06/12 16:22:39] ppocr DEBUG: dt_boxes num : 3, elapse : 1.6964607238769531
[2025/06/12 16:22:39] ppocr DEBUG: cls num : 3, elapse : 0.028058290481567383
[2025/06/12 16:22:40] ppocr DEBUG: rec_res num : 3, elapse : 0.23061299324035645
[2025/06/12 16:22:40] ppocr DEBUG: 0 Predict time of C:\Users\PC\Desktop\test1.png: 1.955s
[2025/06/12 16:22:40] ppocr DEBUG: The visualized image saved in ./inference_results\test1.png
[2025/06/12 16:22:40] ppocr INFO: The predict total time is 1.959130048751831
可是没有识别结果,result文件里也显示test1.png []
尝试过修改cls=False 还是不能解决问题
请问大家怎么解决这个问题呀