dataeval.metrics.stats.labelstats¶
- dataeval.metrics.stats.labelstats(labels)¶
Calculates statistics for data labels.
This function computes counting metrics (e.g., total per class, total per image) on the labels.
- Parameters:¶
- labels : ArrayLike, shape - [label] | [[label]] or (N,M) | (N,)¶
Lists or NumPy array of labels. A set of lists where each list contains all labels per image - (e.g. [[label1, label2], [label2], [label1, label3]] or [label1, label2, label1, label3]). If a numpy array, N is the number of images, M is the number of labels per image.
- Returns:¶
A dictionary-like object containing the computed counting metrics for the labels.
- Return type:¶
Examples
Calculating the statistics on labels for a set of data
>>> stats = labelstats(labels) >>> stats.label_counts_per_class {'chicken': 12, 'cow': 5, 'horse': 4, 'pig': 7, 'sheep': 4} >>> stats.label_counts_per_image [3, 3, 5, 3, 2, 5, 5, 2, 2, 2] >>> stats.image_counts_per_label {'chicken': 8, 'cow': 4, 'horse': 4, 'pig': 7, 'sheep': 4} >>> (stats.image_count, stats.class_count, stats.label_count) (10, 5, 32)