XOOD: Extreme Value Based Out-Of-Distribution Detection For Image Classification

Frej Berglind, Haron Temam, Supratik Mukhopadhyay, Kamalika Das, Md Saiful Islam Sajol, Kumar Sricharan, Kumar KallurupalliarXiv 2022 · OpenReview

Abstract

Detecting out-of-distribution (OOD) data at inference time is crucial for many applications of machine learning. We present XOOD: a novel extreme value-based OOD detection framework for image classification that consists of two algorithms. The first, XOOD-M, is completely unsupervised, while the second XOOD-L is self-supervised. Both algorithms rely on the signals captured by the extreme values of the data in the activation layers of the neural network in order to distinguish between in-distribution and OOD instances. We show experimentally that both XOOD-M and XOOD-L outperform state-of-the-art OOD detection methods on many benchmark data sets in both efficiency and accuracy, reducing false-positive rate (FPR95) by 50%, while improving the inferencing time by an order of magnitude.

1. Introduction

Deep neural networks are notoriously overconfident. When presented with inputs outside their training distribution—such as a model trained on animals being shown a vehicle—they often fail to signal uncertainty, instead providing high-confidence but incorrect classifications. This "silent failure" poses significant risks in safety-critical domains like autonomous driving and medical diagnostics.

Detecting Out-of-Distribution (OOD) data is the primary defense against such failures. However, existing methods typically face a trade-off between computational efficiency and detection accuracy. Many state-of-the-art (SOTA) techniques require prior knowledge of potential OOD data or introduce massive computational overhead. XOOD addresses these challenges by monitoring extreme activation values within the network, providing a fast and effective detection mechanism.

2. Methodology: Leveraging Extreme Values

The core innovation of XOOD is the observation that for In-Distribution (ID) data, the distribution of maximum and minimum values in activation layers is consistently unimodal. OOD data, by contrast, tends to fall into the "tails" of these distributions or create entirely separate modes.

The unimodal distribution of layer maximums for ID data vs. the shifted distribution for OOD data (LSUN).

The framework introduces two distinct algorithms:

  1. XOOD-M (Unsupervised): This version calculates the mean and covariance of extreme values from the training data. At inference time, it employs a regularized Mahalanobis distance to measure how far a new input's extreme values deviate from the established training norm. The addition of a regularization constant ($C$) allows the model to balance standard statistical distance with $L_2$ distance, boosting performance across various architectures.
  2. XOOD-L (Self-supervised): This version does not require external OOD data. Instead, it generates "distorted" versions of training data (using noise, blur, and geometric shifts) to serve as a proxy for the unknown. A logistic regression model is then trained to distinguish between clean training data and these distortions based on their extreme value signatures.

Because these algorithms focus solely on the global maximum and minimum of each layer, they maintain linear complexity, making them significantly lighter than methods requiring complex matrix multiplications.

3. Experimental Results

The researchers evaluated XOOD across standard benchmarks including CIFAR-10, CIFAR-100, and ImageNet-1000, testing against OOD sets like LSUN, iNaturalist, and Textures.

Comparison of OOD detection performance: The baseline (a) shows significant overlap, while XOOD-M (b) and XOOD-L (c) achieve near-perfect separation and higher AUC.

Key Findings:

  • Superior Accuracy: XOOD-L and XOOD-M outperformed SOTA methods like Gram and Mahalanobis. On average, they reduced the False Positive Rate (FPR95) by approximately 50%.
  • Efficiency: XOOD is roughly 10x to 30x faster than the Gram method. While some OOD methods add up to 2000% overhead to inference time, XOOD adds only 24% to 39%, making it viable for real-time edge computing.
  • Robustness: The method proved highly resilient to Gaussian and uniform noise, which frequently causes other OOD detectors to fail.

4. Conclusion and Future Work

XOOD demonstrates that the "extreme" signals in a network's layers are highly descriptive of data distribution. While the method struggles when ID and OOD datasets are extremely similar (e.g., CIFAR-10 vs. CIFAR-100), it provides a new benchmark for efficient OOD detection. Future research will explore expanding the XOOD framework to Large Language Models (LLMs) and Graph Neural Networks.

Summary updated

Abstract

Detecting out-of-distribution (OOD) data at inference time is crucial for many applications of machine learning. We present XOOD: a novel extreme value-based OOD detection framework for image classification that consists of two algorithms. The first, XOOD-M, is completely unsupervised, while the second XOOD-L is self-supervised. Both algorithms rely on the signals captured by the extreme values of the data in the activation layers of the neural network in order to distinguish between in-distribution and OOD instances. We show experimentally that both XOOD-M and XOOD-L outperform state-of-the-art OOD detection methods on many benchmark data sets in both efficiency and accuracy, reducing false-positive rate (FPR95) by 50%, while improving the inferencing time by an order of magnitude.
BibTeX
@misc{berglind2022xood,
  author = {Frej Berglind and Haron Temam and Supratik Mukhopadhyay and Kamalika Das and Md Saiful Islam Sajol and Kumar Sricharan and Kumar Kallurupalli},
  title = {{XOOD: Extreme Value Based Out-Of-Distribution Detection For Image Classification}},
  year = {2022},
  eprint = {2208.00629},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2208.00629},
}
Figure