Scenario: Classifying images

The goal of this example is to train a model to classify images of birds into groups based on their physiological similarities. Once the model is trained with a known dataset, users can upload new data sets to auto classify the birds into their respective categories. We will prepare the data, create a data set, train the model, and test the model.

  1. Prepare the data.

    Data preparation consists of gathering two types of data, training data and test data. Training data is used to teach the neural network features of the object so that it can build the classification model. Test data is used to validate the accuracy of the trained model. Our data will include pictures of different types of birds.

    Notes:
    • Different images should be used for training data and test data.
    • Images must be in one of these formats:
      • JPEG
      • PNG
  2. Create a data set. Log in to the PowerAI Vision user interface, click Data Sets in the title bar, click Create new data set and name the data set Birds.
  3. Populate the data set.
    1. In the left pane, expand Categories, click Add category. Add the "Acridotheres" category and click Add, then click OK.
    2. Upload images of Acridotheres by dragging the images onto the Drag files here area.
    3. In the left pane, click "Uncategorized". The newly uploaded files are shown.
    4. Click the Select box to select the images you just uploaded, then click Assign category and choose "Acridotheres".
    5. Repeat the above steps for the other categories.
    Note: To train a model for classification, the data set must meet these requirements:
    • There must be at least two categories.
    • Each category must have at least five images.
  4. From the Data set page, click Train. In the Train data set window, choose Image classification and keep the default values for all other settings, then click Train.
  5. After training is complete, click Deploy model.
    Important: Each deployed model uses one GPU.
  6. Test the trained model. On the Deployed models page, open the model you just deployed. Scroll down to the Test Images area and input a test image.

    The test result displays the uploaded picture and test result heat map, and gives the classification and the confidence of the classification. Multiple classes are returned with the decreasing levels of confidence for the different classes. The returned heat map is for the highest confidence classification and can help you determine whether the model has correctly learned the features of this classification. The red area of the heat map corresponds to the highest relevance areas of the picture.

    If you are not satisfied with the result, use the information in this topic to refine the model: Refining a model. Otherwise, the model is ready to be used in production.