dataeval.metrics.stats.imagestats

dataeval.metrics.stats.imagestats(dataset: dataeval.typing.Dataset[dataeval.typing.ArrayLike] | dataeval.typing.Dataset[tuple[dataeval.typing.ArrayLike, Any, Any]], *, per_box: bool = False, per_channel: True) dataeval.outputs.ChannelStatsOutput
dataeval.metrics.stats.imagestats(dataset: dataeval.typing.Dataset[dataeval.typing.ArrayLike] | dataeval.typing.Dataset[tuple[dataeval.typing.ArrayLike, Any, Any]], *, per_box: bool = False, per_channel: False = False) dataeval.outputs.ImageStatsOutput

Calculates various statistics for each image.

This function computes dimension, pixel and visual metrics on the images or individual bounding boxes for each image. If performing calculations per channel dimension stats are excluded.

Parameters:
dataset : Dataset

Dataset to perform calculations on.

per_box : bool, default False

If True, perform calculations on each bounding box.

per_channel : bool, default False

If True, perform calculations on each channel.

Returns:

Output class containing the outputs of various stats functions

Return type:

ImageStatsOutput or ChannelStatsOutput

Examples

Calculate dimension, pixel and visual statistics for a dataset containing 8 images.

>>> stats = imagestats(dataset)
>>> print(stats.aspect_ratio)
[1.    1.    1.333 1.    0.667 1.    1.    1.   ]
>>> print(stats.sharpness)
[20.23 20.23 23.33 20.23 77.06 20.23 20.23 20.23]

Calculate the pixel and visual stats for a dataset containing 6 3-channel images and 2 1-channel images for a total of 20 channels.

>>> ch_stats = imagestats(dataset, per_channel=True)
>>> print(ch_stats.brightness)
[0.027 0.152 0.277 0.127 0.135 0.142 0.259 0.377 0.385 0.392 0.508 0.626
 0.634 0.642 0.751 0.759 0.767 0.876 0.884 0.892]