The triangleImages
data set has 100 test images with ground truth labels. Define the location of the data set.
Define the location of the test images.
Define the location of the ground truth labels.
Create an imageDatastore holding the test images.
Define the class names and their associated label IDs.
Create a pixelLabelDatastore holding the ground truth pixel labels for the test images.
Load a semantic segmentation network that has been trained on the training images of triangleImages
.
Run the network on the test images. Predicted labels are written to disk in a temporary directory and returned as a pixelLabelDatastore.
Running semantic segmentation network
-------------------------------------
* Processed 100 images.
Evaluate the prediction results against the ground truth.
Evaluating semantic segmentation results
----------------------------------------
* Selected metrics: global accuracy, class accuracy, IoU, weighted IoU, BF score.
* Processed 100 images.
* Finalizing... Done.
* Data set metrics:
GlobalAccuracy MeanAccuracy MeanIoU WeightedIoU MeanBFScore
______________ ____________ _______ ___________ ___________
0.90624 0.95085 0.61588 0.87529 0.40652
Display the properties of the semanticSegmentationMetrics
object.
metrics =
semanticSegmentationMetrics with properties:
ConfusionMatrix: [2x2 table]
NormalizedConfusionMatrix: [2x2 table]
DataSetMetrics: [1x5 table]
ClassMetrics: [2x3 table]
ImageMetrics: [100x5 table]
Display the classification accuracy, the intersection over union, and the boundary F-1 score for each class. These values are stored in the ClassMetrics
property.
ans=2×3 table
Accuracy IoU MeanBFScore
________ _______ ___________
triangle 1 0.33005 0.028664
background 0.9017 0.9017 0.78438
Display the normalized confusion matrix that is stored in the NormalizedConfusionMatrix
property.
ans=2×2 table
triangle background
________ __________
triangle 4730 0
background 9601 88069