Visualizing the architecture of your own model of Artificial Neural Networks

This is a very simple post I’ve prepared just to help anyone who wants to visualize their artificial neural network architecture.

In this example, I will use a neural network built using Keras (http://keras.io/) and visualizing the architecture using ANN Visualizer (https://github.com/Prodicode/ann-visualizer).

The complete solution code can be found at:

Image for post
Image for post
ANN visualizer — A great visualization python library used to work with Keras

You will need to install the following dependencies:

$ pip3 install keras
$ pip3 install ann_visualizer
$ pip install graphviz
$ pip install h5py

Now just train the template used the script:

# Create your first MLP in Keras
from keras.models import Sequential
from keras.layers import Dense
import numpy

Finally, you can view by invoking the ANN Visualizer from your saved template:

from ann_visualizer.visualize import ann_viz;
from keras.models import model_from_json
import numpy

The result is a file (.pdf) that will be saved in the project directory.

Image for post
Image for post

References:

Written by

Computer Engineer, Research Scientist in Artificial Intelligence

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store