Created
June 21, 2020 11:54
-
-
Save mehdidc/a506bcf390a8cffc195bb13f87e5e535 to your computer and use it in GitHub Desktop.
tensorboard_to_csv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Credits to https://stackoverflow.com/questions/49697634/tensorboard-export-csv-file-from-command-line | |
from collections import defaultdict | |
import argparse | |
import numpy as np | |
import tensorflow as tf | |
from clize import run | |
import pandas as pd | |
def save_tag_to_csv(fn): | |
sess = tf.InteractiveSession() | |
wall_step_values = [] | |
rows = defaultdict(list) | |
with sess.as_default(): | |
for e in tf.train.summary_iterator(fn): | |
for v in e.summary.value: | |
rows[v.tag].append({"time": e.wall_time, "step": e.step, "value": v.simple_value}) | |
for k, r in rows.items(): | |
try: | |
pd.DataFrame(r).to_csv(k+".csv", index=False) | |
except Exception: | |
continue | |
run(save_tag_to_csv) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment