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

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

Description

@juanpamm

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions