# Open the AI Black Box¶

The Zetane Viewer offers a unique approach to help you understand in machine learning and artificial neural networks. The community Zetane viewer gives you the opportunity to:

Easily open the AI Black box

Visualize and understand all the model’s components

Inspect the model’s architecture and internal tensors

Study the tensor values distribution

Gain insight about the model’s performance

Discover your next model optimization without guesswork

Using the free Zetane Viewer, you can open and visually inspect curated models from the Zetane Gallery. Each model comes with a selected input that is used to perform inference. On the buttons of the internal nodes of the computational graph of the model, you can access the all the intermediate tensors.

ONNX is an open standard for machine learning interoperability and there are many models in the ONNX Model Zoo. With the Zetane Viewer, you can open ONNX models (files with .onnx extension) to inspect the model architecture, weights and biases.

To visualize and inspect your own Keras, Pytorch or Onnx runtime models and data the Zetane way, you need the Zetane Viewer to the professional version by installing install the Zetane Engine (30-day free trial).

Note

We are in the process of registering as a verified software publisher. In the meantime, you need to manually accept to run the Zetane Viewer on your local machine.

# Controls¶

Zetane produces lively interactive environments. Here are the essential controls and navigation:

Action |
Mouse |
Trackpad gestures |
---|---|---|

Pan up/down: |
Scroll |
Scroll |

Pan sideways: |
Shift+Scroll |
Scroll horizontally |

Zoom: |
Ctrl+Scroll or Alt+Scroll |
Pinch-to-zoom |

Rotate: |
Middle drag |
Alt+Left drag |

Select: |
Left-click |
Left-click |

The camera can be reset at any time using `Ctrl+R`

. See Navigation for more available options.

# Loading Models¶

ZTN files are available to all to open and inspect with the Zetane Viewer. To load a Zetane Viewer model (`.ztn`

file extension), click on the icon

To load an ONNX model (`.onnx`

file extension), click on the icon

Note

`.ztnx`

file extension can only be loaded with the Zetane Engine. Such files are usually produced on remote machines and contain other types of data such as images, numpy, text, graphs, metrics or meshes.

# Model Architecture¶

When a model is displayed in the Zetane engine, any components of the model can be accessed in a few clicks.

At the highest level, we have the model architecture which is composed of interconnected nodes and tensors. Each node represents an operator of the computational graph. Usually, an input tensor is passed to the model and as it goes through the nodes it will be transformed into intermediate tensors until we reach the output tensor of the model. In the Zetane engine, the data flows from left to right.

# Nodes¶

Each node represents an operator or transformation to be applied to tensors. Attached to each node are buttons that allow to access the tensors of the model. On the left of the node are input tensors and on the right are the output tensors. Usually the lower left button is the present input tensor to the node while the other left buttons are constants or other tensors (such as initializers, weights and biases) needed for the applying the operator to the input. After applying the operator to the input, the output tensor is accessible from the left button. On the node itself is also a button that allows to display the feature maps (3 dimensional output tensor) directly next to the node.

# Tensors¶

Each tensor of the model can be accessed through a single click which will open a right panel containing all general information, statistics and the actual values of the tensor.
Notice that the weights (filters) tensor of this Conv node has the shape `(32,6,5,5)`

. This tensor is projected in a 3D space to create 6 rows of 32 filters of size 5X5. The way the tensor is written follows the default tensor visualization parameters.

Statistics about the tensor values and its distribution is given in the histogram in the top panel. You can also see the tensor name and shape. The tensor and its values is represented in the middle panel and the bottom section contains tensor visualization parameters and a refresh button which allow the user to refresh the tensor. This is useful when the input or the weights are changing in real-time.

# Styles of tensor visualization¶

N-dimensional tensor projected in the 3D space:

N-dimensional tensor projected in the 2D space:

Tensor values and color representations of each value based on the gradient shown on the x-axis of the distribution histogram:

Tensor values:

Feature maps view when the tensor has shape of dimension 3:

# ONNX Synthetic Input¶

After loading an `.onnx`

, the internal weights and biases tensor can be accessed and viewed in the tensor side panel.
After pressing the input and output tensor buttons, because the model did not
receive an input, no tensor will be displayed.

By pressing the above toolbar icon, a synthetic input will be created to match the size and shape of the input tensor. Then, the input is passed to the model which will generate all the internal tensors. To observe the generated model synthetic input, click on the rightmost tensor button of the model graph (usually contains the word input).