Created
March 9, 2020 23:44
-
-
Save Nixes/1755536c3c658fbc40e485c0f7402b9c to your computer and use it in GitHub Desktop.
convert tensorflow model to tensorboard logs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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