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

COMBOOD: A Semiparametric Approach for Detecting Out-of-distribution Data for Image Classification
Notice: This research summary and analysis were automatically generated using AI technology. For absolute accuracy, please refer to the [Original Paper Viewer] below or the Original ArXiv Source.

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.


💡 Research Summary

The paper introduces COMBOOD, a novel semi‑parametric framework for out‑of‑distribution (OOD) detection in image classification. Existing OOD methods fall into two main categories: parametric approaches based on Mahalanobis distance and non‑parametric approaches based on nearest‑neighbor (k‑NN) distance. Mahalanobis distance works well when test samples are far from the training distribution (far‑OOD) because it models the feature space as a multivariate Gaussian, but it struggles with near‑OOD samples that are close to the in‑distribution manifold. Conversely, k‑NN is effective for near‑OOD detection as it directly measures local density, yet its performance degrades for far‑OOD and its computational cost can become prohibitive in high‑dimensional spaces.

COMBOOD combines the strengths of both by converting each distance into a probabilistic confidence score and then adding the scores without any learned weighting. Specifically, the k‑NN distance (k_d) is transformed into (k_c = -\sqrt{n},\log(k_d)), where (n) is the feature dimensionality. The regularized Mahalanobis distance (m_d) is transformed into (m_c = \log\big(\exp(-m_d^2/2) / \sqrt{(2\pi)^n \det(M’)}\big)), where (M’ = M + C I) is the covariance matrix regularized by a constant (C). The final OOD score is simply (score = k_c + m_c). This additive scheme avoids the need for user‑specified weighting and lets each component contribute evidence according to its own statistical scale.

Two feature extraction strategies are explored. The first computes global extrema (maximum and minimum) of each activation layer, applies a Yeo‑Johnson transform, and standardizes the resulting 2 × r‑dimensional vector (r = number of layers). This low‑dimensional representation makes Mahalanobis distance computation extremely efficient and yields strong performance on far‑OOD tasks. The second extracts L2‑normalized embeddings from the penultimate layer of a pretrained network, providing high‑level semantic features that are especially useful for k‑NN based detection of near‑OOD samples.

Algorithmically, the Mahalanobis component estimates the mean (\mu) and covariance (M) from training features, adds diagonal regularization (C) to improve numerical stability, and computes the quadratic form for each test sample. The k‑NN component builds an index (e.g., KD‑Tree) over the same training features and retrieves the distance to the k‑th nearest neighbor. Both components operate in an unsupervised manner, requiring no class labels at test time.

Extensive experiments were conducted on the OpenOOD benchmark (versions 1 and the newer 1.5) covering a variety of far‑OOD and near‑OOD scenarios, as well as on a document‑image dataset that mimics real‑world OCR pipelines. Evaluation metrics include AUROC, AUPR, and FPR@95 TPR. COMBOOD consistently outperformed state‑of‑the‑art baselines such as ODIN, Energy‑Based, pure Mahalanobis, and pure k‑NN methods. Notably, it achieved 3–5 % higher AUROC on near‑OOD datasets while matching or slightly surpassing Mahalanobis on far‑OOD datasets. Computationally, the method scales linearly with the embedding dimension, preserving real‑time feasibility.

The authors acknowledge limitations: the simple additive combination may not be optimal for every data distribution, and the hyper‑parameters (C) (regularization) and (k) (nearest‑neighbor count) can be sensitive to dataset characteristics. Future work is suggested on automated hyper‑parameter selection, incorporation of additional distance measures (e.g., cosine, Wasserstein), and extension to non‑image modalities such as text or time‑series data.

In summary, COMBOOD offers a practical, theoretically grounded solution that merges parametric and non‑parametric evidence for OOD detection, delivering superior accuracy across both near and far OOD regimes while maintaining linear computational complexity, making it well‑suited for deployment in safety‑critical and large‑scale automated systems.


Comments & Academic Discussion

Loading comments...

Leave a Comment