Exemple #1
0
 def read_distros(self, prefix, *args):
     if prefix[-1] != '/': prefix += '/'
     for arg in args:
         assert isinstance(arg, str),\
           "Scalar names must be strings, found: {}".format(arg)
     subdirs = list(self.ret_checkpoints().keys())
     data = collections.OrderedDict()
     for subdir in subdirs:
         evts_path = os.path.join(self.directory, subdir,
                                  self.evts_stem + '*')
         evts_file = glob.glob(evts_path)
         if not evts_file: continue
         assert len(
             evts_file) == 1, "Multiple events file found: {}".format(
                 evts_file)
         evts_file = evts_file[0]
         print("Reading: {}".format(evts_file))
         EvtAcc = EventAccumulator(evts_file,
                                   size_guidance={'histograms': 0})
         EvtAcc.Reload()
         data.update({subdir: collections.OrderedDict()})
         for arg in args:
             data[subdir].update({arg: collections.OrderedDict()})
             wall_time, global_step, histogram = zip(
                 *EvtAcc.Histograms(prefix + arg))
             distros = [hist[5:] for hist in histogram]
             scalar_dict = collections.OrderedDict()
             data[subdir][arg].update({'wall_time': wall_time})
             data[subdir][arg].update({'global_step': global_step})
             data[subdir][arg].update({'histogram': histogram})
             data[subdir][arg].update({'distros': distros})
     return data
Exemple #2
0
def plot_cs_histograms(path_to_events, ax=None):
    event_acc = EventAccumulator(path_to_events,
                                 size_guidance={
                                     'histograms': 10,
                                 })
    event_acc.Reload()
    tags = event_acc.Tags()
    result = {}
    for hist in tags['histograms']:
        histograms = event_acc.Histograms(hist)
        to_plot = np.array([
            np.repeat(np.array(h.histogram_value.bucket_limit),
                      np.array(h.histogram_value.bucket).astype(np.int))
            for h in histograms
        ])
    df = pd.DataFrame(to_plot.T)
    ax = joypy.joyplot(df,
                       overlap=2,
                       colormap=cm.OrRd_r,
                       linecolor='w',
                       linewidth=.5,
                       ax=ax)
    return result
Exemple #3
0
import tensorflow as tf
from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
import pickle

ea = EventAccumulator('/arekhi.scratch.DL/tmp/tensorboard/mobilenet_v1/')
ea.Reload()
avail_hist = ea.Tags()['histograms']
hist_list = []
for hist_name in avail_hist:
    hist_data = ea.Histograms(hist_name)
    bucket_lims = hist_data[0][2][5]
    bucket_vals = hist_data[0][2][6]
    hist_list.append([hist_name, bucket_lims, bucket_vals])

pickle.dump(hist_list,
            open('/arekhi.scratch.DL/tmp/mobilenet_v1_hist_list.p', 'wb'))