利用pb文件得到graph并在tensorboard中查看的方法:
import tensorflow as tf
from tensorflow.python.platform import gfile
with tf.Session() as sess:
model_filename = 'MODEL_PATH'
with gfile.FastGFile(model_filename, 'rb') as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())
g_in = tf.import_graph_def(graph_def)
LOGDIR='LOG_PATH'
train_writer = tf.summary.FileWriter(LOGDIR)
train_writer.add_graph(sess.graph)