Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nixes/1755536c3c658fbc40e485c0f7402b9c to your computer and use it in GitHub Desktop.
Save Nixes/1755536c3c658fbc40e485c0f7402b9c to your computer and use it in GitHub Desktop.
convert tensorflow model to tensorboard logs
# last tested with tensorflow 2.1.0
import tensorflow as tf
LOG_DIR = 'logs' # The path where you want to save tensorboard events
tf.compat.v1.disable_eager_execution()
with tf.compat.v1.Session() as sess:
model_filename = 'frozen_inference_graph.pb' # your model path
with tf.compat.v1.gfile.FastGFile(model_filename, 'rb') as f:
graph_def = tf.compat.v1.GraphDef()
graph_def.ParseFromString(f.read())
g_in = tf.import_graph_def(graph_def)
train_writer = tf.compat.v1.summary.FileWriter(LOG_DIR)
train_writer.add_graph(sess.graph)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment