在 tensorflow 中保存图形时
tf.train.write_graph(
graph_or_graph_def,
logdir,
name,
as_text=True
)
有这个标志:
as_text
: 如果 True
, 将图形写入 ASCII 原型(prototype)。我发现如果是
False
它将图形保存为二进制原型(prototype)。
- My question is what is the difference between those two protos?
- And why is there a difference?
- Do they have advantages over another?
最佳答案
Thanks to a comment this question can be answered (text is from here)
文本还是二进制?
实际上有两种不同的格式可以保存 ProtoBuf。
是一种人类可读的形式,很适合 调试和 编辑 ,但是当其中存储了诸如权重之类的数字数据时会变大。您可以在 graph_run_run2.pbtxt 中看到一个小例子。
文件是 小很多比它们的文本等价物,即使它们对我们来说不那么可读。在此脚本中,我们要求用户提供一个标志,指示输入文件是二进制文件还是文本文件,因此我们知道要调用的正确函数。您可以在 inception_v3 存档中找到一个大型二进制文件的示例,如 inception_v3_2016_08_28_frozen.pb。
关于tensorflow - tensorflow 中.pb和.pbtxt之间的区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51948262/