利用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)
本文介绍了一种利用TensorFlow的PB文件导入graph,并在TensorBoard中进行可视化的详细步骤。通过FastGFile读取PB文件,使用GraphDef解析模型结构,再通过Session和summary.FileWriter将graph写入指定目录,最终在TensorBoard中展示模型结构。
6120

被折叠的 条评论
为什么被折叠?



