Skip to content

Instantly share code, notes, and snippets.

@t27
Created March 25, 2019 05:18
Show Gist options
  • Save t27/50746442a179f02d8dc345d3f0331362 to your computer and use it in GitHub Desktop.
Save t27/50746442a179f02d8dc345d3f0331362 to your computer and use it in GitHub Desktop.
Parse the tensorboard files generated during evaluation for the TensorFlow object detection API
from tensorboard.backend.event_processing import event_accumulator
import json
eval_log_file_path = "path/to/events.out.tfevents.1555555555.0.0.0.0"
def modelEvalPathParser(path_to_eval_log):
ea = event_accumulator.EventAccumulator(path_to_eval_log)
ea.Reload()
jsonresult = {}
csvresult = "classname,ap\n"
step=""
for tag in ea.Tags()['scalars']:
label = tag.replace('PASCAL/Precision/[email protected]','mAP')
label = label.replace('PASCAL/PerformanceByCategory/[email protected]/',"")
scalars = ea.Scalars(tag)[0]
jsonresult[label] = scalars[2]
step = scalars[1]
csvresult+=f'{label},{scalars[2]}\n'
return jsonresult,csvresult,step
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment