我训练模型并保存它,现在我试图加载,但无法做到。我在前一篇文章中也看到过,但是一些参考链接不起作用,或者我尝试了一些东西,仍然无法解决这个问题。
代码片段:
#load model
with tf.io.gfile.GFile(args.model, "rb") as f:
graph_def = tf.compat.v1.GraphDef()
graph_def.ParseFromString(f.read())
# with tf.Graph().as_default() as graph:
generated_image_1, generated_image_2, generated_image_3, = tf.graph_util.import_graph_def(
graph_def,
input_map={'input_image' : input_tensor, 'short_edge_1' : short_edge_1, 'short_edge_2' : short_edge_2, 'short_edge_3' : short_edge_3},
return_elements=['style_subnet/conv-block/resize_conv_1/output:0', 'enhance_subnet/resize_conv_1/output:0', 'refine_subnet/resize_conv_1/output:0'],
producer_op_list=None
)误差
Traceback (most recent call last):
File "stylize.py", line 97, in <module>
main()
File "stylize.py", line 57, in main
graph_def.ParseFromString(f.read())
google.protobuf.message.DecodeError: Error parsing message with type 'tensorflow.GraphDef'注意:如果需要更多有关这方面的信息,一定要在这里添加。让我知道
https://stackoverflow.com/questions/71439124
复制相似问题