dimensionstats#

dataeval.metrics.stats.dimensionstats(images: Iterable[ArrayLike], bboxes: Iterable[ArrayLike] | None = None) DimensionStatsOutput#

Calculates dimension statistics for each image

This function computes various dimensional metrics (e.g., width, height, channels) on the images or individual bounding boxes for each image.

Parameters:
  • images (Iterable[ArrayLike]) – Images to perform calculations on

  • bboxes (Iterable[ArrayLike] or None) – Bounding boxes in xyxy format for each image to perform calculations on

Returns:

A dictionary-like object containing the computed dimension statistics for each image or bounding box. The keys correspond to the names of the statistics (e.g., ‘width’, ‘height’), and the values are lists of results for each image or :term:NumPy` arrays when the results are multi-dimensional.

Return type:

DimensionStatsOutput

See also

pixelstats, visualstats, Outliers

Examples

Calculating the dimension statistics on the images, whose shape is (C, H, W)

>>> results = dimensionstats(images)
>>> print(results.aspect_ratio)
[0.75  0.75  0.75  0.75  0.75  0.75  1.333 0.75  0.75  1.   ]
>>> print(results.channels)
[1 1 1 1 1 1 3 1 1 3]