visualstats#
- dataeval.metrics.stats.visualstats(images: Iterable[ArrayLike], bboxes: Iterable[ArrayLike] | None = None, per_channel: bool = False) VisualStatsOutput#
Calculates visual statistics for each image
This function computes various visual metrics (e.g., brightness, darkness, contrast, sharpness) 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 on
- Returns:
A dictionary-like object containing the computed visual statistics for each image. The keys correspond to the names of the statistics (e.g., ‘brightness’, ‘sharpness’), and the values are lists of results for each image or numpy arrays when the results are multi-dimensional.
- Return type:
See also
dimensionstats,pixelstats,OutliersNote
zeros and missing are presented as a percentage of total pixel counts
Examples
Calculating the statistics on the images, whose shape is (C, H, W)
>>> results = visualstats(images) >>> print(results.brightness) [0.0737 0.607 0.0713 0.1046 0.138 0.1713 0.2046 0.2379 0.2712 0.3047 0.338 0.3713 0.4045 0.438 0.4712 0.5044 0.538 0.5713 0.6045 0.638 0.6714 0.7046 0.738 0.7715 0.8047 0.838 0.871 0.905 0.938 0.971 ] >>> print(results.contrast) [2.041 1.332 1.293 1.279 1.272 1.268 1.265 1.263 1.261 1.26 1.259 1.258 1.258 1.257 1.257 1.256 1.256 1.255 1.255 1.255 1.255 1.254 1.254 1.254 1.254 1.254 1.254 1.253 1.253 1.253]