tensorflow查看pb文件

  1. 运行下面代码:
from tensorflow.python.platform import gfile
import tensorflow as tf

model = './saved_pb/expert-graph.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)
  1. 运行完上述代码,会生成log文件夹以及log文件.然后在terminal中输入 tensorboard --logdir log 点击链接即可查看pb文件中的graph

你可能感兴趣的:(tensorflow查看pb文件)