该模型为resnet v1_50。调用模型时,输入节点为fifo_queue_Dequeue,输出节点为resnet_v1_50 / SpatialSqueeze
将ckpt转换为pb的代码如下:
slim = tf.contrib.slim
tf.logging.set_verbosity(tf.logging.INFO)
config = tf.ConfigProto(allow_soft_placement=True)
config.gpu_options.allow_growth = True
restore_saver = tf.train.import_meta_graph(r'E:\条烟
\traindir\0108/model.ckpt-108460.meta',clear_devices=True)
with tf.Session(graph=tf.get_default_graph(),config = config) as sess:
sess.run(tf.global_variables_initializer())
restore_saver.restore(sess, r'E:\条烟\traindir\0108/model.ckpt-
108460')
output_graph_def = tf.graph_util.convert_variables_to_constants(
sess, sess.graph.as_graph_def(),output_node_names=
["resnet_v1_50/SpatialSqueeze"])
tf.train.write_graph(output_graph_def, '', r"D:\3.pb", as_text=False)
tf.train.write_graph(output_graph_def, '',
r"D:\0108\ckpt_to_pb.pbtxt", as_text=True)