Search code examples
tensorflowtensorboard

How to parse the tensorflow events file?


I would like to know how to extract the same performance results from the events file of the output of a model as does Tensorboard : specifically the Precision, Recall, and Loss numbers are most of interest. Here is a subset of them displayed on Tensorboard given the model checkpoint directory:

enter image description here

I'm not sure if there self-documenting information or other metadata available for these models. This one in particular is the Faster RNN Inception: but are these outputs tied to a particular model or are they generic in format?


Solution

  • Found the approach in the tensorboard package:

      from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
      event_acc = EventAccumulator(evtf)
      event_acc.Reload()
    

    One of the entries is:

      scal_losses = event_acc.Scalars('Loss/total_loss')
    

    From that list we can extract such attributes as Step [number] and Value (of the loss):

     losses = sorted([[sevt.step, sevt.value] for sevt in scal_losses])