Basic Image Recognition

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 handwritten digits representing the numbers 0 through 9.

PerceptiLabs includes sample data for trying out this basic image recognition use case. The data consists of:

  • the classic MNIST dataset of containing 28x28-pixel normalized grayscale images (in .png format) depicting handwritten digits.

  • a data.csv file that maps the image names to the classifications (i.e., digits 0 through 9). The first column of this .csv file contains the image paths relative to this .csv file and the second column contains the labels. Below is a partial example of what this CSV data looks like:

Image_paths,Labels
images/0.png,7
images/1.png,2
images/2.png,1
images/3.png,0
images/4.png,4
images/5.png,1

Note: this tutorial requires PerceptiLabs 0.12.

Create a new Model

Follow the steps below to create a new model using PerceptiLabs' Data Wizard:

1. Click Create on the Model Hub screen to display the New Model popup:

2. Click Load data on the New Model popup:

3. Select data.csv and click Confirm. This file maps the image files stored in the images sub directory to their corresponding digit classifications (0 through 9):

4. Set the Image_paths column to input (1) and its datatype to image (2), and then set the Labels column to target (3) and its type to be categorical (4) (i.e., classifications). and click Next (5):

5. (Optional) Give the model a descriptive name in the Name field and/or modify the other training settings:

6. Click Run model to start training the model or Customize to see the model in the Modeling Tool.

7. Save the model by selecting File > Save or File > Save As. 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 directory everytime you save the model.

The final model in the Modeling Tool will look as follows:

The components of the model are as follows:

  1. Input: represents the input data provided to the model. This component is auto-generated by PerceptiLabs and cannot be modified.

  2. Convolution: performs a convolution to downsample the image.

  3. Dense (first): connects to the previous component in a dense manner to process and downscale the data.

  4. Dense (second): connects to the previous component in a dense manner to process the data and set the target dimension to be the same as the targeted data.

  5. Target: represents the targeted data provided to the model, in this case, the normalized probability of which digit the image represents. This component is auto-generated by PerceptiLabs and cannot be modified.

Export the Trained Model

Now that the model is fully trained, you can export it as a TensorFlow model to use for inference. See Exporting for more information.

Last updated