Main Content

evaluateInstanceSegmentation

Evaluate instance segmentation data set against ground truth

    Description

    metrics = evaluateInstanceSegmentation(dsResults,dsTruth) calculates various metrics to evaluate the quality of the instance segmentation results, dsResults, against the ground truth segmentation, dsTruth.

    metrics = evaluateInstanceSegmentation(dsResults,dsTruth,threshold) also specifies an overlap threshold for the intersection over union (IoU) metric, or Jaccard Index. When the IoU of the predicted object mask in dsResults and the ground truth object mask in dsTruth is equal to or greater than the overlap threshold, the prediction is considered a true positive.

    metrics = evaluateInstanceSegmentation(___,Verbose=verbose) also specifies whether to display evaluation progress information in the command window.

    Input Arguments

    collapse all

    Predicted instance segmentation, specified as a datastore. The data must be set up so that calling the datastore with the read function returns a cell array with at least three elements. The table describes the format of the three required elements.

    maskslabelsscores

    Predicted binary masks, specified as a logical array of size H-by-W-by-M. Each mask is the segmentation of one instance in the image.

    Predicted object labels, specified as an M-by-1 categorical vector.

    Predicted scores, specified as an M-by-1 numeric vector.

    The order of the elements does not matter. When the datastore returns a cell array with more than three elements, the evaluateInstanceSegmentation function assumes that the first element with logical data contains the instance masks, the first element with categorical data contains the label data, and the first element with numeric data contains the scores.

    You can get predicted instance segmentations by using the segmentObjects function.

    Ground truth instance segmentation, specified as a datastore. The data must be set up so that calling the datastore with the read function returns a cell array with at least two elements. The table describes the format of the two required elements.

    maskslabels

    Ground truth binary masks, specified as a logical array of size H-by-W-by-M. Each mask is the segmentation of one instance in the image.

    Ground truth object labels, specified as an M-by-1 categorical vector.

    The order of the elements does not matter. When the datastore returns a cell array with more than two elements, the evaluateInstanceSegmentation function assumes that the first element with logical data contains the instance masks, and the first element with categorical data contains the label data.

    Overlap threshold for a predicted object mask to be considered a true positive, specified as a numeric scalar or numeric vector. When you specify a numeric vector, the evaluateInstanceSegmentation function calculates metrics for each threshold.

    Display evaluation progress information in the command window, specified as a numeric or logical 1 (true) or 0 (false). The displayed information includes a progress bar, elapsed time, estimated time remaining, and data set metrics.

    Data Types: logical

    Output Arguments

    collapse all

    Instance segmentation metrics, returned as an instanceSegmentationMetrics object. The OverlapThreshold property of the object is set as the value of the threshold argument.

    Version History

    Introduced in R2022b