Metrics#
Anomalib provides a comprehensive set of metrics for evaluating anomaly detection model performance. All metrics extend TorchMetrics’ functionality with Anomalib-specific features.
Available Metrics#
Area Under Curve Metrics#
Area Under the Receiver Operating Characteristic curve. Measures the model’s ability to distinguish between normal and anomalous samples.
Area Under the Precision-Recall curve. Particularly useful for imbalanced datasets.
Area Under the Per-Region Overlap curve. Evaluates pixel-level anomaly localization performance.
Area Under the Per-Image Missed Overlap curve. Advanced metric for evaluating localization quality.
F1 Score Metrics#
Standard F1 score for binary classification. Harmonic mean of precision and recall.
Maximum F1 score across all possible thresholds. Useful for finding optimal operating points.
Threshold Metrics#
Automatically determines the optimal threshold by maximizing F1 score.
Uses a manually specified threshold for classification.
Other Metrics#
Per-Region Overlap score for evaluating pixel-level localization.
Per-Image Missed Overlap for assessing localization errors.
Presorted Good with n% bad samples missed. Measures false negative rate at specific operating points.
Presorted Bad with n% good samples misclassified. Measures false positive rate at specific operating points.
Normalizes anomaly scores to [0, 1] range using min-max scaling.
Analyzes and tracks the distribution of anomaly scores for model diagnostics.
Utility Classes#
Base class for all Anomalib metrics. Extends TorchMetrics with field-based updates.
Orchestrates multiple metrics for comprehensive model evaluation.
Computes precision-recall curves for binary classification tasks.