How do you read Tensorboard files programmatically?

You can use TensorBoard’s Python classes or script to extract the data: How can I export data from TensorBoard? If you’d like to export data to visualize elsewhere (e.g. iPython Notebook), that’s possible too. You can directly depend on the underlying classes that TensorBoard uses for loading data: python/summary/event_accumulator.py (for loading data from a single … Read more

How to display custom images in TensorBoard using Keras?

So, the following solution works well for me: import tensorflow as tf def make_image(tensor): “”” Convert an numpy representation image to Image protobuf. Copied from https://github.com/lanpa/tensorboard-pytorch/ “”” from PIL import Image height, width, channel = tensor.shape image = Image.fromarray(tensor) import io output = io.BytesIO() image.save(output, format=”PNG”) image_string = output.getvalue() output.close() return tf.Summary.Image(height=height, width=width, colorspace=channel, encoded_image_string=image_string) … Read more

Simple way to visualize a TensorFlow graph in Jupyter?

Here’s a recipe I copied from one of Alex Mordvintsev deep dream notebook at some point from IPython.display import clear_output, Image, display, HTML import numpy as np def strip_consts(graph_def, max_const_size=32): “””Strip large constant values from graph_def.””” strip_def = tf.GraphDef() for n0 in graph_def.node: n = strip_def.node.add() n.MergeFrom(n0) if n.op == ‘Const’: tensor = n.attr[‘value’].tensor size … Read more