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) |
This comment has been minimized.
This comment has been minimized.
thanks! it was helpful |
This comment has been minimized.
This comment has been minimized.
I have tried this code but this error message shown in Jupyter, any suggestion? DecodeError Traceback (most recent call last) DecodeError: Error parsing message |
This comment has been minimized.
This comment has been minimized.
Perfect! This was super helpful |
This comment has been minimized.
This comment has been minimized.
While adding my frozen.pb file to it, it gives me an error and if run it through another code which is: import tensorflow as tf from tensorflow.core.protobuf import saved_model_pb2 with tf.Session() as sess:
LOGDIR='YOUR_LOG_LOCATION' and gave me error: google.protobuf.message.DecodeError: Error parsing message any solution for this..?? i converted to .pb file from checkpoint file using tensorflow frozen_python file. |
This comment has been minimized.
This comment has been minimized.
use tf.gfile.GFile instead of "gfile.FastGFile" and add |
This comment has been minimized.
This comment has been minimized.
@jubjamie @ Santosh7vasa I run the code and it saved a file like this "events.out.tfevents.1574405033.DESKTOP-TOJGNRH". Now How can I load to tensorboard and view the graph |
This comment has been minimized.
Thank you very much for this gist, it was just what i needed.
I had a problem that the file was not writen to disk, adding these lines at the end of the file fixed the problem :
Also it was necessary for me to change LOGDIR to
LOGDIR='logs/tests/1/'
(removed the first '\')hope this help for anybody who have this problem as well.