Detectors¶
Out-of-Distribution detectors, grouped by method family. All of them implement the
common detector interface: fit on in-distribution data (only where a detector
requires it), then call the detector to get outlier scores, which are larger for outliers.
Comparison¶
Detector |
Input |
Fit |
Classification |
Segmentation |
Paper |
|---|---|---|---|---|---|
feature maps |
✓ |
||||
features |
yes |
✓ |
|||
logits |
✓ |
✓ |
|||
logits |
✓ |
✓ |
|||
features |
yes |
✓ |
|||
logits |
✓ |
✓ |
|||
features |
yes |
✓ |
— |
||
model inputs |
✓ |
||||
model inputs |
✓ |
||||
several layers |
yes |
✓ |
|||
logits |
yes |
✓ |
|||
features |
yes |
✓ |
|||
features |
✓ |
||||
features |
yes |
✓ |
|||
model inputs |
yes |
✓ |
|||
logits |
✓ |
✓ |
|||
logits |
✓ |
✓ |
|||
model inputs |
✓ |
✓ |
|||
features |
✓ |
||||
several layers |
yes |
✓ |
|||
model inputs |
yes |
✓ |
|||
features |
yes |
✓ |
|||
features |
yes |
✓ |
|||
model inputs |
✓ |
||||
logits |
yes |
✓ |
|||
features |
yes |
✓ |
|||
feature maps |
✓ |
||||
feature maps |
yes |
✓ |
✓ |
||
features |
yes |
✓ |
|||
feature maps |
✓ |
||||
features |
yes |
✓ |
|||
logits |
yes |
✓ |
|||
features |
yes |
✓ |
|||
feature maps |
yes |
✓ |
|||
logits |
✓ |
✓ |
Probability-based¶
Probability-based methods are based on the observation that OOD inputs tend to be assigned lower posteriors with higher entropy, i.e., the predicted distribution is often less concentrated on a single class.
Logit-based¶
Logit-based methods are based on the observation that OOD inputs tend to yield different logits compared to ID data.
Feature-based¶
- Mahalanobis Distance (MD)
- Multi-Layer Mahalanobis Distance (MD)
- Relative Mahalanobis Distance (RMD)
- Virtual Logit Matching (ViM)
- Nearest Neighbor (kNN)
- Nearest Neighbor Guidance (NNGuide)
- Simplified Hopfield Energy (SHE)
- Gram Matrices Based (GM)
- Neural Collapse Inspired (NCI)
- Fast Decision Boundary Distance (fDBD)
- Gaussian Mixture Model (GMM)
- Predictive Normalized Maximum Likelihood (pNML)
- Maximum Concept Matching (MCM)
- Logit Scaling (LTS)
Gradient-based¶
Gradient-based detectors are based on the observation that the gradients (w.r.t. the model parameters, the inputs or intermediate activations) for ID and OOD data behave differently. All gradient-based detectors inherit from
pytorch_ood.api.GradientDetector.
Activation Pruning¶
Activation pruning methods are based on the observation that OOD inputs cause unusual activations in the model, and that, by rectifying these unusual activations, we can often improve discriminability of ID and OOD samples.