他的回复:
Checkpoint转换成Savedmodel训练过程中使用tf.train.Saver()保存的模型格式为checkpoint格式,同样需要转换成Savedmodel才可进行在线推理,可以saver.restore()方法将checkpoint加载成tf session,再用上述方法转换成saved_model即可,示例如下所示:import tensorflow as tf # variable define ... saver = tf.train.Saver() with tf.Session() as sess: # Initialize v1 since the saver will not. saver.restore(sess, "./lr_model/model.ckpt") tensor_info_x = tf.saved_model.utils.build_tensor_info(x) tensor_info_y = tf.saved_model.utils.build_tensor_info(y) tf.saved_model.simple_save( sess, "./savedmodel/", inputs={"image": tensor_info_x}, outputs={"scores": tensor_info_y} )