How to Easily Install Netron on Linux?

How To Install Netron

If you’re working with a Deep Learning model and find it too complex to understand, try Netron to visualize your neural network. Netron is an open-source visualizer for neural networks, deep learning, and machine learning models. Today, we’ll explore Netron and learn how to install it on Linux.

Netron is an open-source visualizer for neural networks, deep learning, and machine learning models. It’s available on Windows, Mac, and Linux and supports various framework formats like ONNX, TensorFlow Lite, Core ML, Keras, and more. You can install Netron on Linux using AppImage or the Snap package manager. It’s also available as a web app, providing flexibility and ease of access for visualizing complex neural network structures.

Netron: Redefining Visualization

Before I tell you about Netron, let me first form the basis by telling you about neural networks. A neural network is a subset of machine learning and is a method of artificial intelligence that teaches computers to process data in a way that is inspired by the human brain.

We have layers in the neural network, which are comprised of nodes where the computation happens, loosely patterned on neurons (remember your biology classes).

Now, let’s take an example if you are building a movie recommender system then there must be some features, like Actors, IMDB rating, and Director (for now let’s take three only).

You put those features as input, meanwhile, you also assign them weight based on their significance. When the features along with weight are put in the Node as input then it will do its magic(the code you wrote, cause it’s magical) and you will get a movie name as output.

Node Example
Example of a Node

Of course, there is an activation function but I don’t want to get too deep into the technical stuff.

This was a very simple example that I took, you will have multiple features, that when fed to Node will give output that will be fed to the nodes of the next layer and the process continue. So if you classify the structure on the basis of layers then we have an Input layer, an Ouptut layer, and any layer in between is usually called a Hidden Layer.

Of course, when you build your deep learning model, which might comprise a complex neural network, you might get confused and struggle to understand how the network maps out.

For those times to get a better understanding of the network and how the model works it is imperative that you visualize the network graphically.

In these times this software is there to help you, written in Javascript and developed by Lutz Roeder( you should check his GitHub, it’s an impressive profile), it is quite popular among data scientists and it is available in multiple operating systems like Windows, Mac, and Linux.

In addition to its ability to visualization, it also supports multiple framework formats like –

  • ONNX (Open Neural Network Exchange)
  • TensorFlow Lite
  • Core ML
  • Keras
  • Caffe (Convolutional Architecture for Fast Feature Embedding)
  • Darknet
  • MXNet
  • PaddlePaddle
  • CNN (Convolutional Neural Network)
  • MNN (Mesh Neural Network)
  • TensorFlow.js

Also, it provides experimental support for PyTorch, TorchScript, TensorFlow, OpenVINO, RKNN, MediaPipe, ML.NET, and scikit-learn. The good thing about having such a vast amount of framework support is that it will help you visualize your model regardless of the framework you use.

Python is quite popular in the machine learning world, so you might want to use it for your data science endeavors.

Check this tutorial on Python to brush up your skills and if you make a deep learning model then give Netron a try.

Guide to Install Netron on Linux

Before you try to install this software, I just want to inform you that it’s also available on the web, so if you are in a hurry then you can try that. For reference, you can see try the Netron web app.

Netron Web App
Netron Web App

Using AppImage to Install Netron on Linux

The easiest way to install this software is to use AppImage. AppImage comprises all the libraries bundled inside, so all you have to do is go to the GitHub page and download the AppImage.

Once you have downloaded the AppImage, you can right-click on the AppImage file and make it executable. Of course, you can use our trusted chmod command but it’s your choice.

Netron AppImage
Netron AppImage

In the above image, you can see a lot of assets, download the AppImage file, when I checked last the latest version is 7.1.1 so you can download from here.

Using Snap to Install Netron on Linux

If AppImage is not your thing, then you can use the Snap package manager, it is quite easy to install the software using Snap. If you don’t have Snap installed in your system then you check this tutorial on Snap to learn how to install this package manager.

Once you have Snap installed in your system, then run the below command to install the software.

sudo snap install netron

This will install Netron on your system. Regardless of the approach you took you should have this visualizer for neural networks installed in your system. For reference check the image below.

Netron Desktop
Netron Desktop

For demonstration purposes, I have downloaded the ONNX file of SqueezeNet (it’s available on the GitHub page of Netron) and opened it in Netron. Check the image below to see Netron in action.

Netron In Action
Netron In Action

Summary

In this article, we learned about Netron, an open-source visualizer for neural networks. It is quite famous among data scientists and professionals who work with deep learning models. We learned how to install it using AppImage and also using Snap package manager. For demonstration purposes, we also saw SqueezNet deep learning model neural network graph.

References: