Closed weristeddy closed 6 months ago
Hello. Adaptive threshold is calculated using the following class: https://github.com/openvinotoolkit/anomalib/blob/main/src/anomalib/utils/metrics/anomaly_score_threshold.py#L15 It works by finding a threshold that optimizes the F1 score.
When it comes to image and anomaly thresholds, they are calculated separately: https://github.com/openvinotoolkit/anomalib/blob/d7e7d86411d106369e9cca53d8c148cba659493a/src/anomalib/models/components/base/anomaly_module.py#L48-L50 The method is the same, but they differ in data they work on. In case of image threshold, it is calculated on image level predictions (indicating if image is anomalous or not) trying to maximize image level F1. In case of pixel threshold, the calculation is done on the entire anomaly map produced by the model: https://github.com/openvinotoolkit/anomalib/blob/d7e7d86411d106369e9cca53d8c148cba659493a/src/anomalib/models/components/base/anomaly_module.py#L159-L183
thank you very much for your help!
Describe the bug
Hello everyone,
I've been working with the anomalib recently and have encountered a question regarding the threshold calculation for image and pixel anomalies.
Specifically, I'm curious about how the anomalib determines the thresholds for image and pixel anomalies. Does it follow a specific method, such as choosing the point at the most left corner of the ROC curve, or does it employ another approach?
Furthermore, I'm interested in understanding whether the thresholds for image and pixel anomalies differ in their calculation and results.
Any insights or information about the internal workings of Anomalib's thresholding mechanism would be greatly appreciated. I want to ensure that I have a clear understanding of how these thresholds are determined to make informed decisions in my anomaly detection tasks.
Thank you in advance for your assistance
Best regards
Dataset
MVTec
Model
PatchCore
Steps to reproduce the behavior
see config file
OS information
/
Expected behavior
/
Screenshots
No response
Pip/GitHub
GitHub
What version/branch did you use?
main
Configuration YAML
Logs
Code of Conduct