Tensorboard histograms to matplotlib

后端 未结 4 1990
野性不改
野性不改 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:18

    A good solution is the one from @khuesmann, but this only allows you to retrieve the accumulated histogram, not the histogram per step -- which is the one actually being showed in tensorboard.

    If you want the distribution and so far, what I have understood is that Tensorboard usually compresses the histogram to decrease the memory used to store the data -- imagine storing a 2D histogram over 4 million steps, the memory can increase fast quickly. These compress histograms are accessible by doing this:

    from tensorboard.backend.event_processing.event_accumulator import EventAccumulator
    
    n2n = EventAccumulator(PATH)
    n2n.Reload()
    
    # Check the tags under histograms and choose the one you want
    n2n.Tags()
    
    # This will give you the list used by tensorboard 
    # of the compress histograms by timestep and wall time
    n2n.CompressedHistograms(HISTOGRAM_TAG)
    

    The only problem is that it compresses the histogram to five percentiles (in Basic points they are 0, 668, 1587, 3085, 5000, 6915, 8413, 9332, 10000) which corresponds to (-Inf, -1.5, -1, -0.5, 0, 0.5, 1, 1.5, Inf) in standard deviations. Check the code here.

    I haven't read much, but it wouldn't be hard to reconstruct the temporal histograms that tensorboard shows. If I find a way to do it, I will post it here.

提交回复
热议问题