如何使用ckpt文件在tensorboard中可视化图形?

时间:2017-11-09 00:32:49

标签: tensorflow tensorboard

我有这样的ckpt文件,这就是我所拥有的:

enter image description here

我想知道如何使用这些文件在张量板中显示图表。 如果我有pb文件,我不需要运行图形,我只需要导入图形。我所要做的就是使用代码:

import os
import tensorflow as tf

inception_graph_def_file = os.path.join('./', 'tensorflow_inception_graph.pb')
with tf.Session() as sess:
    with tf.gfile.FastGFile(inception_graph_def_file, 'rb') as f:
        graph_def = tf.GraphDef()
        graph_def.ParseFromString(f.read())
        tf.import_graph_def(graph_def, name='')
    writer = tf.summary.FileWriter('./', sess.graph)
    writer.close()

那么,有没有想过使用像pb文件这样的ckpt文件?

1 个答案:

答案 0 :(得分:3)

不,我不这么认为,否则他们会在那里存放。据我所知.ckpt.meta文件只包含权重,只有权重我们不能在张量板中绘制图形,它需要一些由graph_pb2.GraphDef()函数提供的结构。

我想你应该看到这个 import_pb_tensorbord

您可以通过提供必要的参数来运行它。