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
44.22k stars 7.82k forks source link

导出识别模型时都是 KeyError: 'predict' #29

Closed BackT0TheFuture closed 4 years ago

BackT0TheFuture commented 4 years ago

paddlepaddle-gpu 1.7.2.post107 PaddleOCR 3b40c32

python tools/export_model.py -c configs/rec/rec_r34_vd_tps_bilstm_attn.yml -o Global.checkpoints="./output/rec/rec_r34_vd_tps_bilstm_attn/best_accuracy" Global.save_inference_dir="./inference/rec/rec_r34_vd_tps_bilstm_attn"

python tools/export_model.py -c configs/rec/rec_mv3_tps_bilstm_attn.yml -o Global.checkpoints="./output/rec/rec_mv3_tps_bilstm_attn/best_accuracy" Global.save_inference_dir="./inference/rec/rec_mv3_tps_bilstm_attn"

Traceback (most recent call last):
  File "tools/export_model.py", line 94, in <module>
    main()
  File "tools/export_model.py", line 68, in main
    config, eval_program, startup_prog)
  File "PaddleOCR\tools\program.py", line 193, in build_export
    image, outputs = model(mode='export')
  File "PaddleOCR\ppocr\modeling\architectures\rec_model.py", line 112
, in __call__
    predict = predicts['predict']
KeyError: 'predict'
dyning commented 4 years ago

感谢关注和试用,目前还在紧急修复和更新相关文档中。今天会同步进展。

dyning commented 4 years ago

推理文档已经更新, https://github.com/PaddlePaddle/PaddleOCR/blob/develop/doc/inference.md

里面介绍详细介绍了超轻量中文识别模型推理和基于CTC损失的识别模型推理。而基于Attention损失的识别模型推理还在调试中。对于中文文本识别,建议优先选择基于CTC损失的识别模型,实践中也发现基于Attention损失的效果不如基于CTC损失的识别模型。

LDOUBLEV commented 4 years ago

attention模型转inference model 问题已修复