This topic provides a tutorial showing you how to get started with PerceptiLabs. This tutorial walks you through the classic machine learning example of training a neural network to recognize 28x28 pixel images of the digits 0 through 9.
This example takes image data and labels that have been exported to .npy files as input, and after completing the tutorial, produces a fully-trained TensorFlow model that you can export to identify digits in images.
Follow the steps below to create a new Model:
1. Click on the new model button on the Model Hub screen to display the New Model popup:
2. Click Empty on the New Model popup and enter a name for the model in the Name field. A model file (model.json) will be created in this directory and will be saved every time you select File> Save.
3. Click Model Path, select a location for your model, and click Confirm. The popup closes.
4. Click Create to add the new empty model to your model.
PerceptiLabs will generate a sub directory in the model's location using the specified model name. The model will be saved to a model.json file within that model directory everytime you select File > Save.
PerceptiLabs includes sample data for trying out basic image recognition. This data is based on the classic MNIST dataset consisting of:
28x28-pixel normalized grayscale images depicting handwritten digits. We have converted these into 1x784-element flat arrays for modeling.
Label data indicating what digit each image represents.
Both sets of data are stored as NumPy (.npy) files which are located in the tutorial_data directory of your PerceptiLabs installation.
Follow the steps below to add both sets of data to your model.
Drag and drop two Local components from the Data category onto the model. These act as data sources for locally-stored data.
Select the first Local component and click on Load data in the Settings pane.
Navigate to the tutorial_data directory in your PerceptiLabs installation and select classification_mnist_input.npy.
Repeat steps 2 and 3 for the second Local component but select classification_mnist_labels.npy for its data file.
The image data loaded in the previous step needs to be converted from one-dimensional arrays of 784 elements to two-dimensional arrays of 28x28x1 elements.
Follow the steps below to reshape the data:
Drag and drop a Reshape component from the Processing category onto the model and ensure that the component's X, Y, and Z dimensions are set to 28x28x1 in the Settings pane.
Drag a connector from the first Local component's output field to the Reshape component's input field.
You're now ready to configure a deep learning component to use for training the model with the image data.
Follow the steps below to add deep learning to your model:
Drag and drop a Convolution component from the Deep Learning category onto the model.
Drag a connector from the first Reshape component's output field to the Convolution component's input field.
Drag and drop a Dense component from the Deep Learning category.
Drag a connector from the Convolution component's output field to the Dense component's input field.
Follow the steps below to configure supervised training in your model:
Click on Training in the toolbar and drag and drop a Classification component onto the model. This configures the project to use supervised learning.
Drag a connector from the Dense component's output field to the predictions field on the Classification component:
The neural network has now been configured to use supervised training.
The label data in the second Data component of your project can be converted into binary representations.
Follow the steps below to perform this conversion using One Hot encoding:
Drag and drop a OneHot component from the Processing category onto the model.
Drag a connector from the second Local component's output field to the OneHot component's input field.
Drag a connector from the OneHot component's output field to the Classification component's labels field.
The final model should look as follows:
You are now ready to run the model for training.
Now that the model is fully trained, follow the steps below to export it as a TensorFlow model: