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
43.9k stars 7.8k forks source link

转换attention的识别模型,失败了 #117

Closed aceyw closed 4 years ago

aceyw commented 4 years ago

(1) 转换ctc的模型时候,使用的命令是, python3 tools/export_model.py -c configs/rec/rec_chinese_lite_train.yml -o Global.checkpoints=./ch_lite/rec_mv3_crnn/best_accuracy \ Global.save_inference_dir=./inference/rec_crnn/ 转换成功了,并且使用新模型进行预测也是成功的。

(2) 转换attention模型的时候,使用的是det_r50_vd_db.tar模型, python3 tools/export_model.py \ -c configs/rec/rec_r34_vd_tps_bilstm_attn.yml \ -o Global.checkpoints="../d0_pprawmodel/rec_r34_vd_tps_bilstm_attn/best_accuracy" \ Global.save_inference_dir="./acey_exports/rec_r34_vd_tps_bilstm_attn_infer_acey" \ Global.use_gpu=false \ Global.character_type=ch \ Global.character_dict_path=./ppocr/utils/ppocr_keys_v1.txt 但是转换失败了,提示错误是: Traceback (most recent call last): File "tools/export_model.py", line 93, in main() File "tools/export_model.py", line 67, in main config, eval_program, startup_prog) File "/home/aex/ycode/python_demo0/aPaddleOCR/tools/program.py", line 193, in build_export image, outputs = model(mode='export') File "/home/aex/ycode/python_demo0/aPaddleOCR/ppocr/modeling/architectures/rec_model.py", line 112, in call predict = predicts['predict'] KeyError: 'predict' 麻烦请帮忙看看,应该怎么修改呢? 谢谢 ~

dyning commented 4 years ago

基于Attention损失的识别模型推理还在调试中。对于中文文本识别,建议优先选择基于CTC损失的识别模型,实践中也发现基于Attention损失的效果不如基于CTC损失的识别模型。非常抱歉给你带来困扰。

aceyw commented 4 years ago

谢谢。想尝试做一个移动版的OCR模型。paddle-lite好像还没有支持CTC、只支持Attention,所以只能等待Attention了。

LDOUBLEV commented 4 years ago

谢谢。想尝试做一个移动版的OCR模型。paddle-lite好像还没有支持CTC、只支持Attention,所以只能等待Attention了。

我们已经在做OCR lite的工作了,预计不久会release

LDOUBLEV commented 4 years ago

已支持attention模型转换为inference model

wanghaisheng commented 3 years ago

@LDOUBLEV 文档里并没有提供模型下载链接以及转化代码

  1. 基于Attention损失的识别模型推理