Skip to content

Instantly share code, notes, and snippets.

@jubjamie
Created March 31, 2017 10:01
Show Gist options
  • Save jubjamie/2eec49ca1e4f58c5310d72918d991ef6 to your computer and use it in GitHub Desktop.
Save jubjamie/2eec49ca1e4f58c5310d72918d991ef6 to your computer and use it in GitHub Desktop.
Load .pb into Tensorboard
import tensorflow as tf
from tensorflow.python.platform import gfile
with tf.Session() as sess:
model_filename ='PATH_TO_PB.pb'
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='/logs/tests/1/'
train_writer = tf.summary.FileWriter(LOGDIR)
train_writer.add_graph(sess.graph)
@AfifaIshtiaq
Copy link

I couldn't se any graph
import tensorflow as tf
from tensorflow.python.platform import gfile
with tf.compat.v1.Session() as sess:
model_filename ='inception_v1_inference.pb'
with tf.io.gfile.GFile(model_filename, 'rb') as f:
graph_def = tf.compat.v1.GraphDef()
graph_def.ParseFromString(f.read())
g_in = tf.import_graph_def(graph_def)
LOGDIR='logs/tests/1/'
train_writer = tf.compat.v1.summary.FileWriter(LOGDIR)
train_writer.add_graph(sess.graph)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment