PaddlePaddle / models

Officially maintained, supported by PaddlePaddle, including CV, NLP, Speech, Rec, TS, big models and so on.
Apache License 2.0
6.9k stars 2.91k forks source link

使用save_inference_model()保存crnnctc的__model__文件 #1496

Closed ghost closed 5 years ago

ghost commented 5 years ago
  1. 在models/fluid/PaddleCV/ocr_recognition, 我想使用train.py的def test()里添加以下下面的代码来保存crnn_ctc的model文件

fluid.io.save_inference_model(args.save_model_dir,["image","label"],test_seq_error,exe,main_program=inference_program)

但运行有错误 ValueError: 'target_vars' should be a list of Variable. 也尝试了 fluid.io.save_inference_model(args.save_model_dir,["image","label"],[test_seq_error[0]],exe,main_program=inference_program),还是一样的错误,请问怎么存啊?

  1. 如果可以,能否提供crnn_ctc的model可以参考下,如果是有accuracy layer就更好了,没有的话我也可以自己存。 谢谢
luotao1 commented 5 years ago

Maybe you can find the intel internal help https://github.com/PaddlePaddle/Paddle/issues/14342#issuecomment-438538424

ghost commented 5 years ago

We solved it by fluid.io.save_inference_model(args.save_model_dir, ["pixel","label"], fetch_vars, exe, main_program=inference_program) . fetch_vars is declared earlier in train.py, fetch_vars = [sum_cost] + error_evaluator.metrics