Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parsing `summary_str` byte string evaluated on tensorflow summary object

Tags:

tensorflow

Currently tensorflow's tensorboard is not compatible with python3. Therefore and generally, I am looking for a way to print out the summary readouts once in 100 epochs.

Is there a function to parse the summary_str byte string produced in the following lines into a dictionary of floats?

summary_op = tf.merge_all_summaries()
summary_str = sess.run(summary_op, feed_dict=feed_dict)
like image 816
Dima Lituiev Avatar asked Jan 02 '16 17:01

Dima Lituiev


1 Answers

You can get a textual representation of summary_str by parsing it into a tf.Summary protocol buffer as follows:

summary_proto = tf.Summary()
summary_proto.ParseFromString(summary_str)
print(summary_proto)

You can then convert it into a dictionary mapping string tags to floats:

summaries = {}
for val in summary_proto.value:
    # Assuming all summaries are scalars.
    summaries[val.tag] = val.simple_value
like image 194
mrry Avatar answered Sep 19 '22 22:09

mrry