pixelstats#
- dataeval.metrics.stats.pixelstats(images: Iterable[_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]], bboxes: Iterable[_SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]] | None = None, per_channel: bool = False) PixelStatsOutput#
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
- 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,OutliersNotes
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(images) >>> print(results.mean) [0.04828 0.562 0.06726 0.09937 0.1315 0.1636 0.1957 0.2278 0.26 0.292 0.3242 0.3562 0.3884 0.4204 0.4526 0.4846 0.5166 0.549 0.581 0.6133 0.6455 0.6772 0.7095 0.7417 0.774 0.8057 0.838 0.87 0.9023 0.934 ] >>> print(results.entropy) [3.238 3.303 0.8125 1.028 0.8223 1.046 0.8247 1.041 0.8203 1.012 0.812 0.9883 0.795 0.9243 0.9243 0.795 0.9907 0.8125 1.028 0.8223 1.046 0.8247 1.041 0.8203 1.012 0.812 0.9883 0.795 0.9243 0.9243]