PSENet-Tensorflow icon indicating copy to clipboard operation
PSENet-Tensorflow copied to clipboard

固化模型的问题

Open Ashionnal opened this issue 5 years ago • 1 comments

你好, output_node_names = '' output_graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph.as_graph_def(), output_node_names.split(","))

固化模型的时候需要这个参数,请问这个输出节点是什么呢

Ashionnal avatar Feb 05 '20 13:02 Ashionnal

大佬你好,我写好了,不知道这样写是否正确

保存模型

        output_graph_def = tf.graph_util.convert_variables_to_constants(sess, 
                                                                                sess.graph.as_graph_def(),
                                                                                output_node_names=[var.name[:-2] for var in tf.global_variables()])

        with tf.gfile.GFile('/home/yanshuxuan/gitprojects/PSENet-Tensorflow/model.pb', "wb") as f:
            f.write(output_graph_def.SerializeToString())
        print("%d ops in the final graph." % len(output_graph_def.node))

Ashionnal avatar Feb 06 '20 06:02 Ashionnal