dataeval.metrics.stats.dimensionstats

dataeval.metrics.stats.dimensionstats(dataset, *, per_box=False)

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:
dataset : Dataset

Dataset to perform calculations on.

per_box : bool, default False

If True, perform calculations on each bounding box.

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

imagestats, Outliers

Examples

Calculate the dimension statistics of a dataset of 8 images, whose shape is (C, H, W).

>>> results = dimensionstats(dataset)
>>> print(results.aspect_ratio)
[1.    1.    1.333 1.    0.667 1.    1.    1.   ]
>>> print(results.channels)
[3 3 1 3 1 3 3 3]