相关文章推荐
小胡子的眼镜  ·  深入浅出 | 谈谈MNN ...·  2 年前    · 
爱旅游的打火机  ·  Audio-Tactile ...·  2 年前    · 
会搭讪的蚂蚁  ·  C语言和C++有什么区别·  2 年前    · 

google.protobuf.message.decodeerror error parsing message with type 'tensorflow.graphdef'

报错原因

使用以下代码,加载图模型的时候会报错

#保存图模型
    tf.train.write_graph(sess.graph_def, graph_dir, 'graph.pbtxt',as_text=True)
    #加载图模型
    with tf.gfile.FastGFile("modle_graph/graph.pbtxt","rb") as f:
        graph_def = tf.GraphDef()
        graph_def.ParseFromString(f.read())
tf.train.write_graph(sess.graph_def, graph_dir, 'graph.pbtxt',as_text=False)
  •