Tensorboard histograms to matplotlib

后端 未结 4 2128
野性不改
野性不改 2021-02-10 00:48

I would like to \"dump\" the tensorboard histograms and plot them via matplotlib. I would have more scientific paper appealing plots.

I managed to hack the way through t

4条回答
  •  耶瑟儿~
    2021-02-10 01:25

    In order to plot a tensorboard histogram with matplotlib I am doing the following:

    event_acc = EventAccumulator(path, size_guidance={
        'histograms': STEP_COUNT,
    })
    event_acc.Reload()
    tags = event_acc.Tags()
    result = {}
    for hist in tags['histograms']:
        histograms = event_acc.Histograms(hist)
        result[hist] = np.array([np.repeat(np.array(h.histogram_value.bucket_limit), np.array(h.histogram_value.bucket).astype(np.int)) for h in histograms])
    return result
    

    h.histogram_value.bucket_limit gives me the value and h.histogram_value.bucket the count of this value. So when i repeat the values accordingly (np.repeat(...)), I get a huge array of expected size. This array can now be plotted with the default matplotlib logic.

提交回复
热议问题