cnn_captcha icon indicating copy to clipboard operation
cnn_captcha copied to clipboard

如何把训练出来的model转化为通用pb文件供其他语言使用呢,求指点

Open mooooooonkey opened this issue 5 years ago • 2 comments

需要把训练出来的文件供java使用,发现demo中使用的时pb文件,网上查到需要把目前训练出来的model文件freeze成pb文件,但是不知道怎么做,求指点。 目前想法是把train_model.py中

计算准确率

    correct_pred = tf.equal(max_idx_p, max_idx_l)

改为 correct_pred = tf.equal(max_idx_p, max_idx_l,'predict/add') 然后使用

this freeze_graph.py is https://github.com/formath/tensorflow-predictor-cpp/blob/master/python/freeze_graph.py

python ../../python/freeze_graph.py
--checkpoint_dir='./checkpoint'
--output_node_names='predict/add'
--output_dir='./model' 生成pb文件 请问这样可行吗,我生成的pb没办法正确识别,请问问题在哪呢

mooooooonkey avatar Aug 07 '20 08:08 mooooooonkey

掐指一算,可能是Reshape_1

Tanson avatar Nov 14 '20 19:11 Tanson

同问

woshihoujinxin avatar Jan 10 '21 02:01 woshihoujinxin