Tensorflow scalar Summary to human-readable text

2019-03-02 23:10发布

问题:

I want to inspect all values for a scalar in my event file. I don't want the aggregate statistics as returned by

tensorboard --inspect --event_file <summary_file> --tag <scalar_tag>

I want all information sufficient for reconstructing the scalar graph (i.e. the unsummarized ordered (x,y) pairs).

How can I do this either with tensorboard or the TF Python API?

回答1:

You could use a tf.train.summary_iterator, e.g.

my_pairs = []
for e in tf.train.summary_iterator(my_event_file_path):
    for v in e.summary.value:
        if v.tag == my_tag:
            my_pairs.append((e.step, v.simple_value))

You may find that parsing your event file is slower than you would like, depending on how much data you put in there.