Main Content


Evaluate instance segmentation across object mask size ranges

Since R2023b


areaMetrics = metricsByArea(metrics,objectAreaRanges) evaluates the instance segmentation metrics detection performance for the object size range or ranges, specified as bounding box areas, objectAreaRanges. The function evaluates the specified bounding box size range within the existing instance segmentation metrics.

areaMetrics = metricsByArea(metrics,objectAreaRanges,ClassNames) also specifies the names of the classes for which to evaluate area-based metrics.

Input Arguments

collapse all

Instance segmentation metrics, specified as an instanceSegmentationMetrics object.

Area of rectangular bounding boxes which are axis-aligned and surround the object mask, specified as one of the following:

  • An M-by-2 numeric matrix, with each row specifying the upper (exclusive) and lower (inclusive) limits of an box area range in evaluation. For example, if the input is [x1 x2; x3 x4]. The evaluated bounding box area ranges are x1≤ area <x2 and x3≤ area <x4.

  • A vector with M+1 elements, specifying the edge values of M contiguous area ranges. Each range is inclusive in the lower limit, and exclusive in the upper limit. For example, if the input is [x1 x2 x3], the area ranges evaluated are x1≤ area <x2 and x2≤ area <x3.

Names of the classes for which to evaluate area-based metrics. If multiple classes are specified, the function computes averaged metrics across the classes. By default, all classes will be considered and the returned metrics will be the average of all classes.

Output Arguments

collapse all

Metrics by area, returned as a table with M rows. Each row contains metrics using objects within an area range (for a total of M area ranges). The first two columns are specified by the table variables:

  • AreaRange: The upper and lower limits of each area range.

  • NumObjects: The number of objects falling within each area range.

The remaining columns are the same as in the DataSetMetrics table. If ClassNames is specified with a single class, the remaining columns are the same as in the ClassMetrics table.

Version History

Introduced in R2023b