Workflow🔗
An MLP classifier is trained using labeled feature vectors or labeled images and can subsequently be used to classify unknown samples. For two- or three-dimensional feature spaces, feature-space visualization helps to evaluate the selected features and the separation between classes.
The following section introduces the general workflow for MLP classification.
General workflow🔗
Most MLP classification tasks follow the same workflow:
- Create the classifier.
- Add training samples.
- Train the classifier.
- Visualize the feature space (optional).
- Classify unknown samples.
- Evaluate the result.
Have a look at the HDevelop example classify_metal_parts.hdev for an application.
Create the classifier🔗
This step prepares the classifier and defines the feature dimension, the number of hidden units, and the number of classes.
The classifier is created with
Add training samples🔗
Training samples can either be provided directly as feature vectors together with their class labels or be extracted from labeled images, depending on the selected workflow.
Typical features include:
- area,
- compactness,
- invariant moments,
- convexity.
Training samples can be added with
add_sample_class_mlpfor feature vectors.add_samples_image_class_mlpfor labeled images.
Train the classifier🔗
After all samples have been added, the network weights are optimized using the training data.
Training is performed with
Further information on parameter optimization can be found in the Optimization chapter.
Classify unknown samples🔗
Unknown objects are represented by feature vectors and assigned to the most likely class.
Classification is performed with
Besides the predicted class, the operator also returns confidence values for the classification.
Visualize the feature space🔗
For low-dimensional feature spaces, visualization can help to evaluate the selected features and to understand the separation between classes.
Note that you can also conveniently visualize the feature space using the HDevelop procedure visualize_2d_feature_space.
visualize_2d_feature_space (...)
Further information on feature-space visualization can be found in the Optimization chapter.
Evaluate the result🔗
After training and classification, the classifier performance should be evaluated using representative test data that was not used during training.
The classifier can be evaluated with
Evaluating the classifier helps to assess the selected features, compare different parameter settings, and estimate the expected classification performance on previously unseen data.
Further recommendations on classifier evaluation and parameter optimization can be found in the Optimization chapter.