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

训练模型和inference模型预测结果相差比较大 #270

Closed
Simon-liusheng opened this issue Jun 29, 2020 · 4 comments
Closed

训练模型和inference模型预测结果相差比较大 #270

Simon-liusheng opened this issue Jun 29, 2020 · 4 comments

Comments

@Simon-liusheng
Copy link

训练的识别模型crnn+mv3+ctc,数据集是一些车牌的数据集,训练的文字dict也已经配置好,转换inference模型是,config文件是训练时候的config,执行预测时候,训练的best accuracy模型,预测结果全部正确,转换inference模型后,预测结果是英文部分是正确的,但是车牌前面的省份大部分有错误。测试了windows和百度aistudio平台,结果都是有错误。

  1. 训练好的模型预测代码
    python3 tools/infer_rec.py -c configs/rec/rec_icdar15_train.yml -o Global.checkpoints=output/rec_CRNN/best_accuracy Global.infer_img=test_img

2.inference模型预测代码
‘python3 tools/infer/predict_rec.py --image_dir="test_img" --rec_model_dir="inference/rec_crnn" --rec_image_shape="3, 32, 100" --rec_char_type="ch" --rec_char_dict_path="ppocr/utils/plate_dict.txt"’
3.测试图片和配置文件,结果截图如下
inference预测
训练预测

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
plate_dict.txt

@Simon-liusheng
Copy link
Author

请求大佬这个是啥原因,难道还要用转换后的模型继续训练吗?

@tink2123
Copy link
Collaborator

识别模型使用 predict_rec.py 时,默认在 rec_char_type= "ch" 模式下根据图片长宽比resize,你指定的shape可能没有生效,可以试着注释掉这两行,看下结果会不会一致:

if self.character_type == "ch":
imgW = int(32 * max_wh_ratio)

这个issue与您的问题类似,可以参考一下 #214

@Simon-liusheng
Copy link
Author

@tink2123 非常感谢,试了一下,问题已经解决。

@tink2123
Copy link
Collaborator

不客气~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants