I've run several training sessions with different graphs in TensorFlow. The summaries I set up show interesting results in the training and validation. Now, I'd like to take the data I've saved in the summary logs and perform some statistical analysis and in general plot and look at the summary data in different ways. Is there any existing way to easily access this data?
More specifically, is there any built in way to read a TFEvent record back into Python?
If there is no simple way to do this, TensorFlow states that all its file formats are protobuf files. From my understanding of protobufs (which is limited), I think I'd be able to extract this data if I have the TFEvent protocol specification. Is there an easy way to get ahold of this? Thank you much.
Following works as of tensorflow version
2.0.0-beta1
:the code for
my_summary_iterator
is copied fromtensorflow.python.summary.summary_iterator.py
- there was no way to import it at runtime.You can simply use:
or if you want to filter a specific subset of events of the graph:
If you want to create something more custom you can dig into the
to understand how to parse the event files.
Here is a complete example for obtaining values from a scalar. You can see the message specification for the Event protobuf message here
I've been using this. It assumes that you only want to see tags you've logged more than once whose values are floats and returns the results as a
pd.DataFrame
. Just callmetrics_df = parse_events_file(path)
.You can use the script serialize_tensorboard, which will take in a logdir and write out all the data in json format.
You can also use an EventAccumulator for a convenient Python API (this is the same API that TensorBoard uses).
To read a TFEvent you can get a Python iterator that yields Event protocol buffers.
more info: summary_iterator