MNIST Dense neural network

Easy
1 hours
January 11, 2023
Youssef MENJOUR

This example aim to explain how to design, train and integrate in LabVIEW environment a 1D DNN model using MNIST dataset.

Front panel overview

In this section we will present the front panel.

The user interface is composed of 4 tab (train, test, incorrectly classified data and confusion matrix). To run the example we just have to action the “load data” button. The example will load dataset and start the training.

During the training, you can test the model for prediction and see the evolution of it as he is updated with latest training weight.

Train tab

Train tab display all informations needed to follow the training proces.

 

Incorrectly classified image tab

This tab display to the user the incorrectly classied test set images by the model during the training. By the time the model will gain more accuraty and less and less images will be incorrectly classified.

 

Test tab

Test tab able user to test the model by drawing a number and see the prediction model.

Confusion matrix tab

This tab shows the user the model’s confusion matrix to help understand the strengths and weaknesses of the model.

Diagram global overview

This section show how the model and HAIBAL functionalities are integrated inside a LabVIEW architecture design.

The architecture is a queue message handler simplified. It’s composed of 4 parallels loops. 1 is managing user event (producer) and 3 managing different processes (consumer). One thread is for the design and training model, one thread for test and prediction and one is a specific thread according MNIST dataset managing drawing image interface.

Model design

One image is sized 28*28 = 784 pixels. As we use dense neural network we will input each pixel (input 1D tensor shape 784).
The model is a dense neural network composed of one input layer (784) with 4 dense layers.

The latest activation is softmax with an outputs of 10 for the classification.

We use a crossentropy loss for this example.

Model train

The model train process is “classic”, we repeat a sequence of Forward – Loss – Backward to process to the train of the model.

Model testΒ 

As all loop run in parallels, the prediction loop combined with the draw loop (user drawing interface managed by this process) make possible to test the model during the training.

Testing model consist to forward and display data forwarded process from updatetd model with data draw by the user.

How to acces to this example ?

The MNIST DNN example is available in the LabVIEW find example session. Use the Keyword DNN and launch it.

The LabVIEWΒ  dense neural network using MNIST dataset is now available with the HAIBAL deep learning toolkit.

Need help from the community

Join the GRAIPHIC community as part of a vibrant Ecosystem. This is your place to
network, ask questions, and collaborate on code with users all over the world.

Need access to the official instruction manual ?

Visit the HAIBAL knowledge base as the documentation from which you can
start from scratch and learn the advanced features

Index