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
42.57k stars 7.67k forks source link

"超轻量中文检测模型推理"对图片比例有要求? #2153

Closed ChungTak closed 3 years ago

ChungTak commented 3 years ago

基于Python预测引擎推理 -> 1.超轻量中文检测模型推理教程

按着这个教程步骤,推理检测ccpd车牌图片,提示检测不到图片文件"raise Exception("not found any img file in {}".format(img_file))" 测试过很多张都不行,路径里确实是有图片,但确报错找不到。 我看了一下ccpd的汽车图片比例大部分是 720x 1160,自己网上找了张1920x1080的图片就检测到了~

请问推理对图片比例或者比例/分辨率有要求吗?一定要16:9?是不是有参数可以设置,我运行的命令就是教程上的 python3 tools/infer/predict_det.py --image_dir="./imgs/0031.jpg" --det_model_dir="./ch_ppocr_mobile_v2.0_det_infer/"

检测不到的图片样张,来自ccpd数据集: 0031

littletomatodonkey commented 3 years ago

这是图片路径有问题:./imgs/0031.jpg 这个文件路径是对的吗

ChungTak commented 3 years ago

这是图片路径有问题:./imgs/0031.jpg 这个文件路径是对的吗

图片路径是对的~~~我 cat ./imgs/0031.jpg 都能打印图片信息。直接把这个文件换成16:9的图片,图片名字不变``就能推理出来,ccpd的图片就不行

littletomatodonkey commented 3 years ago

会打出什么报错信息吗?或者你把原图打包发上来?

ChungTak commented 3 years ago

出错日志:

python3.7 PaddleOCR/tools/infer/predict_det.py --image_dir="./imgs/0031.jpg" --det_model_dir="./inference/ch_ppocr_mobile_v2.0_det_infer/"  --use_gpu=False

Traceback (most recent call last):
  File "PaddleOCR/tools/infer/predict_det.py", line 199, in <module>
    image_file_list = get_image_file_list(args.image_dir)
  File "/home/vlinker/workspace/ocr/ccpd/PaddleOCR/ppocr/utils/utility.py", line 63, in get_image_file_list
    raise Exception("not found any img file in {}".format(img_file))
Exception: not found any img file in ./imgs/0031.jpg

原图 imgs.tar.gz

clive1158 commented 3 years ago

是检查后缀的第三方库imghdr的问题,有些格式的图片,检查不到后缀名。 可以在ppocr/utils/utility.py中修改一下源码

simplew2011 commented 3 years ago

https://github.com/PaddlePaddle/PaddleOCR/issues/2086