anomalyThreshold
Optimal anomaly threshold for set of anomaly scores and corresponding labels
Since R2022b
Syntax
Description
calculates the optimal anomaly threshold given per-image anomaly scores and corresponding
ground truth labels. t
= anomalyThreshold(gtLabels
,scores
,anomalyLabels
)anomalyLabels
indicates which class labels in
gtLabels
belong to the anomaly (positive) class. When performing
anomaly detection, images with scores below the calculated threshold are considered normal
images and images with scores above the threshold are considered anomalous images.
Note
This functionality requires Deep Learning Toolbox™ and the Automated Visual Inspection Library for Computer Vision Toolbox™. You can install the Automated Visual Inspection Library for Computer Vision Toolbox from Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.
also specifies the optimization method.t
= anomalyThreshold(gtLabels
,scores
,anomalyLabels
,optimMethod
)
also specifies the maximum false positive rate.t
= anomalyThreshold(gtLabels
,scores
,anomalyLabels
,MaxFalsePositiveRate=maxFPR
)
also specifies the maximum false negative rate.t
= anomalyThreshold(gtLabels
,scores
,anomalyLabels
,MaxFalseNegativeRate=maxFNR
)
[
also returns the receiver operating characteristic (ROC) curve and performance
metrics.t
,anomalyROC
] = anomalyThreshold(___)
Examples
Input Arguments
Output Arguments
Tips
You can plot ROC and PR curves returned by
anomalyROC
using theplot
(Deep Learning Toolbox) function.
Version History
Introduced in R2022b
See Also
fcddAnomalyDetector
| patchCoreAnomalyDetector
| fastFlowAnomalyDetector
| rocmetrics
(Deep Learning Toolbox) | anomalyMap
Topics
- Getting Started with Anomaly Detection Using Deep Learning
- ROC Curve and Performance Metrics (Deep Learning Toolbox)