dataeval.metrics.stats.pixelstats#

dataeval.metrics.stats.pixelstats(images, bboxes=None, per_channel=False)#

Calculates pixel statistics for each image

This function computes various statistical metrics (e.g., mean, standard deviation, entropy) on the images as a whole.

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

  • per_channel (bool)

Returns:

A dictionary-like object containing the computed statistics for each image. The keys correspond to the names of the statistics (e.g., ‘mean’, ‘std’), and the values are lists of results for each image or NumPy arrays when the results are multi-dimensional.

Return type:

PixelStatsOutput

See also

dimensionstats, visualstats, Outliers

Note

  • All metrics are scaled based on the perceived bit depth (which is derived from the largest pixel value) to allow for better comparison between images stored in different formats and different resolutions.

Examples

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

>>> results = pixelstats(stats_images)
>>> print(results.mean)
[0.2903 0.2108 0.397  0.596  0.743 ]
>>> print(results.entropy)
[4.99  2.371 1.179 2.406 0.668]