tensorflow - tensorflow 中.pb和.pbtxt之间的区别?

标签 tensorflow machine-learning deep-learning ascii protocol-buffers

在 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/

    相关文章:

    python - 如何在 Tensorflow 中实现堆叠式 RNN?

    python - 如何在 Tensorflow 中为张量切片赋值?

    python - 如何实现L1逻辑回归?

    python - 理解 keras 日志输出时出现问题

    neural-network - 用于 Caffe 的 LSTM 模块

    python - 对随机值张量的计算(例如 tf.greater 和 tf.cond)未按预期工作

    python - Tensorflow 中多元正态分布的 CDF

    machine-learning - 为什么在处理深度学习时 GPU 比 CPU 更重要?

    tensorflow - 在一对一样本上训练 Keras 模型并绘制验证曲线

    machine-learning - 如何构建数百万个个性化模型