Skip to content
This repository has been archived by the owner on Oct 18, 2020. It is now read-only.

ValueError: ANN Visualizer: Layer not supported for visualizing #30

Open
juanpamm opened this issue Jan 5, 2020 · 0 comments
Open

ValueError: ANN Visualizer: Layer not supported for visualizing #30

juanpamm opened this issue Jan 5, 2020 · 0 comments

Comments

@juanpamm
Copy link

juanpamm commented Jan 5, 2020

Hello, I am trying to plot my model but it keeps throwing the exception
ValueError: ANN Visualizer: Layer not supported for visualizing

Here is my code:

from tensorflow import keras
from ann_visualizer.visualize import ann_viz

def add_layers_to_network(model, nodes, activation_func):
    if activation_func == 'relu':
        model.add(keras.layers.Dense(nodes, activation=tf.nn.relu))
    elif activation_func == 'sigmoid':
        model.add(keras.layers.Dense(nodes, activation=tf.nn.sigmoid))
    elif activation_func == 'tanh':
        model.add(keras.layers.Dense(nodes, activation=tf.nn.tanh))
    elif activation_func == 'elu':
        model.add(keras.layers.Dense(nodes, activation=tf.nn.elu))
    elif activation_func == 'softmax':
        model.add(keras.layers.Dense(nodes, activation=tf.nn.softmax))

def build_neural_network(nlayers, nodes, act_functions, output_act_func):
    model = keras.Sequential([
       keras.layers.Flatten(input_shape=(utils.width, utils.height))
 ])

# Construction of the hidden layers
for i in range(nlayers):
    add_layers_to_network(model, nodes[i], act_functions[i])

# Construction of the output layer
add_layers_to_network(model, len(utils.class_names), output_act_func)

model.compile(optimizer='adam',
              loss='sparse_categorical_crossentropy',
              metrics=['accuracy'])

model.fit(train_images, train_labels, epochs=epochs)

ann_viz(model, title="My first neural network")

Thanks in advance.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@juanpamm and others