Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文本检测训练完进行单张图片预测时发现漏检内容 #10499

Closed
gg336699 opened this issue Jul 28, 2023 · 12 comments
Closed

文本检测训练完进行单张图片预测时发现漏检内容 #10499

gg336699 opened this issue Jul 28, 2023 · 12 comments
Assignees
Labels
inference this is a inference phase issue. needs investigation this issue needs investigation to either narrow down, or clarify status/close triaged this issue has been looked, and triaged.

Comments

@gg336699
Copy link

请提供下述完整信息以便快速定位问题/Please provide the following information to quickly locate the problem

  • 系统环境/System Environment:windows10/centos7
  • 版本号/Version:Paddle:2.4.2 PaddleOCR:2.6.1.3 问题相关组件/Related components:PPOCRV3-DET
  • 运行指令/Command Code:python tools/infer_det.py -c ./configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_student.yml -o Global.infer_img="./train_data/det/train/00001.jpg"
  • 完整报错/Complete Error Message:无报错,只是漏检内容

数据集由铁路集装箱号以及平板车号组成,如下图所示,上半部分为集装箱信息,下半部分为平板车号:

ea0e32f1868b53d1e9bfacd264306a7

当我使用完整数据集训练之后,各项指标如下:

  • hmean: 0.8266978922716627
  • is_float16: False, precision: 0.7673913043478261
  • recall: 0.8959390862944162,

但是当我进行单张图片推理测试时却发现,平板车信息并未预测出来,调整了thresh、box_thresh以及unclip_ratio超参数都没有正确输出,只是会输出集装箱信息,如下图:

image

当我尝试将数据集更改为只包含平板车信息并训练后,检测一切正常,可以正常输出平板车信息的检测结果,如下图:

17827cd413e0bfa19fea431346b4b06

请问有人遇到过这样的问题嘛,这是由什么原因导致的,希望可以由有一个解决方案,不胜感激!

@liuhuan-gl
Copy link

我也是这个问题

@gg336699
Copy link
Author

我也是这个问题

我的问题暂时性的解决了,其实就是单张测试的时候不会显示,但是如果直接转成模型去推理的话,就会有结果,不知道是啥原因,希望ocr工作组可以注意到!

@ToddBear ToddBear added expneeded need extra experiment to fix issue good first issue Good for newcomers labels Jul 31, 2023
@xu-peng-7
Copy link
Contributor

我也是这个问题

我的问题暂时性的解决了,其实就是单张测试的时候不会显示,但是如果直接转成模型去推理的话,就会有结果,不知道是啥原因,希望ocr工作组可以注意到!

您可以具体描述一下吗?我对这个问题有点感兴趣,单张测试是哪个命令,转成模型是指转成inference模型还是onnx模型?再推理的话指的是哪个命令。感谢

@xuxiansheng2018
Copy link

相似问题,希望有解答

@gg336699
Copy link
Author

gg336699 commented Aug 2, 2023

我也是这个问题

我的问题暂时性的解决了,其实就是单张测试的时候不会显示,但是如果直接转成模型去推理的话,就会有结果,不知道是啥原因,希望ocr工作组可以注意到!

您可以具体描述一下吗?我对这个问题有点感兴趣,单张测试是哪个命令,转成模型是指转成inference模型还是onnx模型?再推理的话指的是哪个命令。感谢

应该属于paddleocr的Bug,具体的命令是如下这条:
测试单张图像的检测效果:

python3 tools/infer_det.py -c configs/det/det_mv3_db.yml -o Global.infer_img="./doc/imgs_en/img_10.jpg" Global.pretrained_model="./output/det_db/best_accuracy"

运行上述命令后就会出现这个问题,指标高但是预测却不行。
我的做法就是忽略如上问题,直接下一步,将模型转换成pdmodel,直接进行推理,问题就不见了。
检测模型转inference 模型方式:

# 加载配置文件`det_mv3_db.yml`,从`output/det_db`目录下加载`best_accuracy`模型,inference模型保存在`./output/det_db_inference`目录下
python3 tools/export_model.py -c configs/det/det_mv3_db.yml -o Global.pretrained_model="./output/det_db/best_accuracy" Global.save_inference_dir="./output/det_db_inference/"

以上代码都是官方文档,具体配置得参照自己的。

@gg336699
Copy link
Author

gg336699 commented Aug 2, 2023

相似问题,希望有解答

如上,应该是paddle的bug,希望工作组可以闲暇时间关注一下。

@xuxiansheng2018
Copy link

xuxiansheng2018 commented Aug 4, 2023 via email

@xu-peng-7
Copy link
Contributor

最好给一个可以复现的场景,比如你的数据集,单独检测使用的是什么命令,predict_system.py 使用了什么命令。根据目前情况来看,很可能是参数设置的问题,你有检查过实际运行时两个检测模型的参数吗?

@xuxiansheng2018
Copy link

DE4995F2846D91871269ADC28749E0AC
我是在自己的数据集上进行实验的,
只测试检测阶段,python3 tools/infer_det.py
-c configs/det/ch_PP-OCRv3/ch_PP-OCRv3_det_student.yml
-o Global.pretrained_model=./output/rec_ppocr_v3_distillation/best_accuracy
Global.infer_img=./data/new_det_data/test_det/crop_img/
8500张测试图片,仅有220张未检测到框。
接着我使用CUDA_VISIBLE_DEVICES=0
python3 /data/yy/PaddleOCR/tools/infer/predict_system.py
--image_dir="./data/new_det_data/test_det/crop_img/"
--det_model_dir="./inference/ch_PP-OCRv3_det_infer/"
--rec_model_dir="./inference/rec_ppocr_v3_distillation/Teacher/"
--cls_model_dir="./inference/ch_ppocr_mobile_v2.0_cls_infer/"
--use_angle_cls=True
--use_gpu=True
--draw_img_save_dir="./inference_results/inference_results_101/"
还是在自己的数据集上进行测试,输出结果发现1700张图片的识别结果都是空,也就是识别不到字,如上图所示。至于你说的参数设置我应该没有特殊设置(初次接触并不是很了解),我是按照官网的教程在自己的数据集上面测试的,测试集图片就是我发的图片那种类型。

@jzhang533 jzhang533 added triaged this issue has been looked, and triaged. needs investigation this issue needs investigation to either narrow down, or clarify inference this is a inference phase issue. and removed good first issue Good for newcomers expneeded need extra experiment to fix issue labels Apr 10, 2024
@GreatV
Copy link
Collaborator

GreatV commented Apr 16, 2024

hi @gg336699,出问题的原图能提供一下吗?

@GreatV GreatV assigned GreatV and unassigned tink2123 and andyjiang1116 Apr 16, 2024
@UserWangZz
Copy link
Collaborator

当我尝试将数据集更改为只包含平板车信息并训练后,检测一切正常,可以正常输出平板车信息的检测结果

关于这个问题,可能的原因是predict_system中的参数配置与infer时使用的config中参数不一致导致的检测效果下降,可以尝试排查一下

@UserWangZz
Copy link
Collaborator

该issue长时间未更新,暂将此issue关闭,如有需要可重新开启。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
inference this is a inference phase issue. needs investigation this issue needs investigation to either narrow down, or clarify status/close triaged this issue has been looked, and triaged.
Projects
None yet
Development

No branches or pull requests

10 participants