-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the Tensorflow Network Visualiser wiki!
First you will need a Visualisation Config you can create one with:
visconfig = network_visualiser.VisualisationConfig(1920, 1080)
Then create your input layer and model seperately:
# Input shape
input_layer = tf.keras.layers.Input(shape=(28*28, ))
# Create model
model = tf.keras.Sequential([
input_layer,
tf.keras.layers.Dense(16),
tf.keras.layers.Dense(16),
tf.keras.layers.Dense(10),
])
You can save the state of a network whilst training with:
frames = []
# Train Loop
# Train
frames.append(network_visualiser.calculate_frame(model, samples_seen))
Once you have recorded all the frames you wish to render, you can put them together into a gif:
# Normalise
frames = network_visualiser.normalise_frames(frames)
# Draw gif
network_visualiser.render_to_gif(input_layer, model, frames, visconfig, "example_dense.gif")
Or png:
# Normalise
frames = network_visualiser.normalise_frames(frames)
# Draw gif
network_visualiser.render_to_png(input_layer, model, frames[0], visconfig, "example_dense.png")
The visualisation config often shortened to visconfig is used to specify how output images look.
You can create a new visconfig with:
visconfig = network_visualiser.VisualisationConfig(1920, 1080)
Border Buffer
This determines how big the border will be around the network, this space is just useful for padding. Though the "Samples Seen" text also appears in this area.
set_border_buffer(border_buffer)
Layer Buffer
This sets a the size of a small buffer between layers.
set_layer_buffer(layer_buffer)
Draw Weights
Weights for dense layers can be enabled/disabled by this feature.
enable_draw_weights()
disable_draw_weights()
Weight Thickness
Determines how thick the lines are for weights.
set_weight_thickness(thickness)
Minimum Weight Brightness
Prevents weights from being overly dark. Since they don't have a border this feature is useful if they aren't easily visible.
set_minimum_weight_brightness(brightness)
Max Neurons for Normal Draw
Compacts large numbers of neurons for a layer into only a couple and a number showing how many there are in the layer. Setting this to a value of 0 completely disables the feature.
set_max_neurons_for_normal_draw(n)
Neuron Gap
Padding between neurons. 1 means they will be packed without any gaps and 0.5 means the gap is the size of the neuron.
set_neuron_gap(gap_size)
RGB Colour
Enables extra colours in rendering of frames. Makes it easier to distinguish changes in network.
enable_rgb_colour()
disable_rgb_colour()