Collapse
CollapsingX
  • - or -

Procedure for using the CNNClassIndex step


The following procedure provides a basic methodology for using the CNNClassIndex step to classify images with a pretrained CNN.

  1. Import a pretrained CNN.

  2. Optionally, modify general classification settings.

  3. Run the project to the CNNClassIndex step to ensure your project works as you expect (for example, you can view your results).

Import a pretrained CNN

After adding a CNNClassIndex step, click on the Import button in the Configuration pane, and select the .mclass file to import (for example, C:\Program Files\Matrox Imaging\Images\Classification\Pasta\MatroxNet_PastaEx.mclass).

An .mclass file is a MIL pretrained CNN context that is built, trained (using the provided training images), and saved by Matrox. You must import such a file to use the CNNClassIndex step. The images (or the specified ROI) that you are classifying with this step must have the same width, height, and number of color bands as the images with which the imported CNN was trained.

Note that, depending on your agreement with Matrox, the pretrained CNN might expire. Once you import an .mclass file, the Configuration pane will either display the expiry date, or indicate that there is no expiry date. For more information about acquiring a pretrained CNN for your classification requirements, contact customer support.

Modify general classification settings

Optionally, after importing a pretrained CNN, you can choose to adjust the CNNClassIndex step's general settings from the Configuration pane.

  1. Set the Timeout property to specify the maximum time for the classification process.

  2. Rename the classes to something more meaningful (for example, you can change 'Class1' to 'Fusilli'). Right-click on the name to change it.

  3. Click on the Replace Thumbnail... button to modify the images that visually represent the classes.

    The thumbnail images serve as a visual aid to help you recognize the classes. They do not affect the classification process or results.

  4. Click on the Define a region () toolbar button in the Project toolbar to define the region, in the image, in which to perform the classification. You can specify the entire image or a rectangle as the search region. The images (or the specified ROI) must have the same width, height, and number of color bands as the images with which the imported CNN was trained.

View your results

The result that you will generally be most interested in is the class to which the image belongs. This is referred to as the best class.

Each class is given a score. This score is a measure, in percentage, of how well that class represents the image. The class with the highest score is the best class. The following example shows an image and its class results. The best class is highlighted. Results also include each class' name, index, thumbnail image, and the time it took to establish the best class.