運行下面的程序,將graph信心保存在log目錄:
#!/usr/bin/env python
# -*- coding:utf-8 -*-
import tensorflow as tf
from tensorflow.python.platform import gfile
model = 'model.pb' #請將這裏的pb文件路徑改爲自己的
graph = tf.get_default_graph()
graph_def = graph.as_graph_def()
graph_def.ParseFromString(gfile.FastGFile(model, 'rb').read())
tf.import_graph_def(graph_def, name='graph')
summaryWriter = tf.summary.FileWriter('log/', graph)
運行:tensorboard --logdir log
W0413 10:41:21.149763 Reloader tf_logging.py:120] Found more than one graph event per run, or there was a metagraph containing a graph_def, as well as one or more graph events. Overwriting the graph with the newest event.
W0413 10:41:21.149763 140061330405120 tf_logging.py:120] Found more than one graph event per run, or there was a metagraph containing a graph_def, as well as one or more graph events. Overwriting the graph with the newest event.
TensorBoard 1.11.0 at http://192.18710.10:6006 (主機ip地址和端口號)
在谷歌或火狐瀏覽器中,將以上地址輸入,即可。