Skip to content
AI.info

Research

COMBOOD: A Semiparametric Approach for Detecting Out-of-distribution Data for Image Classification

Overview Research area: Out-of-distribution (OOD) detection for image classification, specifically post-hoc, unsupervised detection methods built on distance metrics in feature space. Technical level:

COMBOOD: A Semiparametric Approach for Detecting Out-of-distribution Data for Image Classification
arXiv
2602.07042
Published
2026-02-04
Authors
Magesh Rajasekaran, Md Saiful Islam Sajol, Frej Berglind, Supratik Mukhopadhyay, Kamalika Das

AI summary

Overview

Research area: Out-of-distribution (OOD) detection for image classification, specifically post-hoc, unsupervised detection methods built on distance metrics in feature space.

Technical level: Intermediate. The paper assumes familiarity with deep network feature extractors, Mahalanobis distance, and k-nearest-neighbor density estimation, but the core idea is combinable from two standard tools.

Scope: The paper proposes COMBOOD, a semi-parametric framework that fuses a parametric regularized Mahalanobis distance score with a non-parametric nearest-neighbor score, and benchmarks it against ODIN, Mahalanobis (MDS), Gram matrix, and KNN on the OpenOOD version 1 and version 1.5 benchmarks plus a document dataset.

What This Paper Is About

A neural network classifier must assign every test image to one of its known classes, even when that image comes from a totally different distribution — an elephant shown to a horse/giraffe classifier gets labeled as one or the other rather than flagged as unknown. The paper's goal is an unsupervised confidence score that reliably marks such images as out-of-distribution, working both when the OOD data is far from the training data in embedding space (far-OOD) and when it is semantically close (near-OOD). The authors argue that parametric Mahalanobis distance handles far-OOD well but fails at near-OOD, while non-parametric nearest-neighbor distance is stronger overall but still leaves room for improvement, so they combine the two.

Key Contributions

  1. A novel unsupervised semi-parametric OOD detection framework (COMBOOD) that combines a non-parametric nearest-neighbor signal with a parametric regularized Mahalanobis signal into a single confidence score, without requiring access to OOD data during training.

  2. Empirical outperformance of state-of-the-art post-hoc methods on the OpenOOD benchmark datasets (both version 1 and version 1.5) for far-OOD and near-OOD, and on the documents dataset from [14], measured in accuracy (AUROC/AUPR). For a majority of benchmark datasets, the accuracy gains over the state of the art are reported as statistically significant.

  3. Two feature extraction strategies and a finding about which to pair with which component. The first computes global extrema of input features before each activation layer, with a Yeo-Johnson transform fitted on training-data extreme values standardized to zero mean and unit variance. The second extracts L2-normalized penultimate-layer embeddings. COMBOOD works best when the non-parametric component uses penultimate embeddings and the parametric component uses global extrema.

  4. Linear scaling and measured inference efficiency. COMBOOD is reported to scale linearly with the size of the embedding space; the extreme-value features have dimension 2 × r, where r is the number of activation layers (typically at most 1000), keeping the Mahalanobis computation tractable.

Main Findings

  • ResNet18 results on CIFAR-10 and CIFAR-100: Across near-OOD and far-OOD categories, COMBOOD outperforms ODIN and the Mahalanobis method in all experiments, and outperforms Gram in all far and near OOD scenarios despite Gram being far more computationally expensive. COMBOOD outperforms KNN in most near-OOD and far-OOD scenarios. Example: for CIFAR-10 near-OOD on CIFAR-100, AUROC values are reported as 77.68 (ODIN) / 89.76 (MDS) / 66.3 (Gram) / 82.78 (Reg. Mahalanobis) / 89.73 (KNN) / 90.08 (COMBOOD).

  • LeNet results on MNIST: COMBOOD reaches the best or tied-best scores in most rows, e.g. far-OOD average AUROC of 99.02 (ODIN) / 99.75 (MDS) / 98.12 (Gram) / 99.99 (Reg. Mahalanobis) / 96.66 (KNN) / 99.99 (COMBOOD), and AUPR of 98.46 / 99.64 / 97.60 / 99.99 / 95.72 / 99.99. On NotMNIST (near-OOD) it reaches AUROC 98.20 versus 97.37 for KNN, and on FashionMNIST it reaches 98.71 versus 95.68 for KNN.

  • ResNet50 results on ImageNet-1k: Near-OOD average AUROC is 73.15 (ODIN) / 68.34 (MDS) / 68.27 (Gram) / 62.77 (Reg. Mahalanobis) / 80.81 (KNN) / 81.38 (COMBOOD); far-OOD average AUROC is 94.42 / 89.19 / 93.96 / 88.18 / 98.01 / 98.44. On the individual near-OOD sets, COMBOOD scores 77.71 on Species (KNN 76.37) and 87.13 on iNaturalist (KNN 85.04); on ImageNet-O (far-OOD), KNN scores 75.39 versus COMBOOD's 74.08.

  • Document dataset case study: Training used 1000 images and testing 500 images. Out of 500 test images, KNN misclassified 79 while COMBOOD misclassified 39, reducing the error rate from 15.8% to 7.8%. AUROC values for Reg. Mahalanobis / KNN / COMBOOD are 90.74 / 97.35 / 98.52 on RVL_CDIP_N and 90.38 / 97.78 / 98.72 on RVL_CDIP_O; AUPR values are 99.71 / 99.93 / 99.96 and 99.15 / 99.83 / 99.9 respectively.

  • Regularization choice: The ℓ2 regularization constant C in the regularized Mahalanobis method cannot be learned via cross validation, so a wide range of values was tested; C = 1 worked well across all architectures and datasets. Figure 1 compares detection performance for C ranging from 0 to ∞, where ∞ corresponds to L2 distance instead of Mahalanobis distance; the figure reports AUROC of Regularized Mahalanobis on test sets of CIFAR10, CIFAR100 and MNIST.

  • Inference time (ImageNet-1k, ResNet50): Average per-image inference time for COMBOOD is 5.4 ms, with per-dataset values of 5.78 (Species), 5.33 (OpenImage-O), 5.17 (MNIST), 6.3 (ImageNet-O), 5.05 (iNaturalist) and 5.22 (Texture). The two components can be processed simultaneously and the maximum of the two times is recorded. Experiments used a single NVIDIA Tesla V100 GPU and one Intel Xeon Silver 4216 CPU with batch size 128, averaged over 10 runs.

  • Why the parametric component is fast here: With global extrema as input, the feature dimension is twice the model depth (typically at most 1000), so Mahalanobis distance can be computed efficiently; the paper states this is why the method outperforms Gram and Mahalanobis on inference time by an order of magnitude. Using penultimate-layer embeddings with the parametric Mahalanobis approach significantly slows it down without any performance gain.

  • Statistical significance: A McNemar test was used to compare COMBOOD against KNN (described as the best-performing post-hoc method evaluated in the OpenOOD framework); the improvements are reported as statistically significant for most benchmark datasets.

Methodology in Plain English

The method starts from two existing ways of scoring how strange an image looks to a trained network.

The first is Mahalanobis distance, which measures how far a test point sits from the mean of the training features, taking the covariance of those features into account. The authors regularize it by adding a constant C to the diagonal of the covariance matrix (M' = M + C·I, with C = 1 in practice), which keeps the computation stable and lets them control what counts as in-distribution. This distance works well when OOD images are far away, but not when they are close.

The second is nearest-neighbor distance: find the k nearest training images to the test image in feature space and use that distance as a strangeness measure. This is non-parametric and handles the closer cases better.

COMBOOD converts each distance into a confidence score using log distributions — kc = −√n · log(kd) for the nearest-neighbor distance kd, and mc = log(exp(−md²/2) / √det(2πM')) for the regularized Mahalanobis distance md — and simply adds them: score = kc + mc. The authors deliberately avoid weighted addition because that would force users to pick ad-hoc weights.

The two components do not have to share features. The nearest-neighbor component uses L2-normalized penultimate-layer embeddings, which capture the highest level of abstraction. The Mahalanobis component uses the global maximum and minimum of the input before each activation layer, transformed with a Yeo-Johnson transform fitted on training extreme values and standardized. The motivation given is that penultimate embeddings lose information from earlier layers and lose magnitude information during normalization, whereas per-layer extrema recover information across all layers including magnitude; the two strategies therefore complement each other for far-OOD and near-OOD. The approach needs no OOD data at training time and no labels or image topology for the extreme-value features.

Why This Matters

Impact on research. The paper challenges the assumption that a single parametric or non-parametric distance is sufficient for OOD detection, showing that a semi-parametrically combined score can beat both components and match or exceed KNN, which prior benchmarking identified as the strongest post-hoc method. It also addresses a gap the authors highlight: inference time has "largely been neglected in research," and the paper reports inference time alongside AUROC/AUPR, with the method scaling linearly in embedding size.

Real-world applications:

  • Automatic text extraction from documents, including crumpled or damaged pages that a model would otherwise silently attempt to read.
  • Handwritten tax documents and physician prescriptions, where automating extraction requires knowing when to abstain.
  • Medical diagnosis and finance, where models must flag inputs whose decisions cannot be trusted and require human intervention.
  • Autonomous driving and mission-critical geospatial applications, where acting on OOD input is unsafe.

Industry relevance. The paper is co-authored with an industry affiliation (Intuit Inc.) and repeatedly motivates the work with document-processing products. Because the method is unsupervised, post-hoc, and linear in embedding size, it can be bolted onto existing pretrained networks without retraining and without collecting OOD examples, and the reported per-image inference time of 5.4 ms on ImageNet-1k with ResNet50 makes it plausible for production pipelines.

Future Directions

  • Data-driven prior combination. The authors state that the way the two priors are currently combined is not data-driven, and they plan to investigate data-driven combination approaches, in particular considering the kurtosis of the ID and OOD distributions.
  • Extending to layer and class applicability. The future work section names studying OOD detection for image classification in both near and far scenarios using notions of layer and class applicability [5].
  • Extending to generative models. The same notions are to be extended to generative models [6].
  • Closing the remaining KNN gaps. COMBOOD does not beat KNN on every row — for example, on ImageNet-O it scores 74.08 AUROC versus KNN's 75.39 — leaving an open question about which OOD regimes still favor pure non-parametric detection.

Target Audience

Researchers and practitioners in computer vision and trustworthy machine learning who work on uncertainty estimation, OOD detection, or safe deployment of image classifiers; engineers building document-processing or other automation pipelines who need a low-overhead, unsupervised post-hoc check on a pretrained model; and benchmark-oriented researchers who will care about the OpenOOD version 1 and version 1.5 comparisons and the statistical significance testing. Readers should be comfortable with linear algebra notation (covariance matrices, L2 norms) but do not need a deep background in OOD literature to follow the core idea.

Authors’ abstract

Identifying out-of-distribution (OOD) data at inference time is crucial for many machine learning applications, especially for automation. We present a novel unsupervised semi-parametric framework COMBOOD for OOD detection with respect to image recognition. Our framework combines signals from two distance metrics, nearest-neighbor and Mahalanobis, to derive a confidence score for an inference point to be out-of-distribution. The former provides a non-parametric approach to OOD detection. The latter provides a parametric, simple, yet effective method for detecting OOD data points, especially, in the far OOD scenario, where the inference point is far apart from the training data set in the embedding space. However, its performance is not satisfactory in the near OOD scenarios that arise in practical situations. Our COMBOOD framework combines the two signals in a semi-parametric setting to provide a confidence score that is accurate both for the near-OOD and far-OOD scenarios. We show experimental results with the COMBOOD framework for different types of feature extraction strategies. We demonstrate experimentally that COMBOOD outperforms state-of-the-art OOD detection methods on the OpenOOD (both version 1 and most recent version 1.5) benchmark datasets (for both far-OOD and near-OOD) as well as on the documents dataset in terms of accuracy. On a majority of the benchmark datasets, the improvements in accuracy resulting from the COMBOOD framework are statistically significant. COMBOOD scales linearly with the size of the embedding space, making it ideal for many real-life applications.

Read the original paper