Out-of-Distribution Detection#
The OOD module provides methods for detecting when a model encounters data that is significantly different from its training distribution.
Base Class#
|
Abstract base class for out-of-distribution (OOD) detection methods. |
Score-based Methods#
|
Maximum-Softmax-Probability (Hendrycks & Gimpel, 2017). |
|
MaxLogit OOD detection (Hendrycks et al., 2019). |
|
Energy-based score (Liu et al., NeurIPS 2020). |
|
ODIN: Out-of-Distribution detector for Neural Networks (Liang et al., ICLR 2018). |
Distance-based Methods#
|
Feature-space Mahalanobis (Lee et al., NeurIPS 2018). |
|
KNN-based OOD detection (Sun et al., NeurIPS 2022). |
Training Methods#
|
Apply mixup data augmentation. |
|
Compute mixup loss. |
|
Outlier Exposure (OE) for improved OOD detection. |
|
Energy-based regularization for OOD detection. |
|
CutMix augmentation for improved robustness and OOD detection. |
Metrics#
|
Compute AUROC for OOD detection. |
|
Compute False Positive Rate at a target True Positive Rate. |
|
Compute detection accuracy at a given ID acceptance-rate threshold. |
Visualization#
|
Plot ROC curve for OOD detection. |
|
Plot histogram of OOD scores for ID and OOD samples. |
Utilities#
|
Compute OOD score threshold that accepts |
|
Get binary OOD predictions based on threshold. |
|
Extract features from a specific layer of the model. |