NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Practical Evaluation of Out-of-Distribution Detection Methods for Image Classification

Engkarat Techapanurak, Takayuki Okatani

Abstract

We reconsider the evaluation of OOD detection methods for image recognition. Although many studies have been conducted so far to build better OOD detection methods, most of them follow Hendrycks and Gimpel's work for the method of experimental evaluation. While the unified evaluation method is necessary for a fair comparison, there is a question of if its choice of tasks and datasets reflect real-world applications and if the evaluation results can generalize to other OOD detection application scenarios. In this paper, we experimentally evaluate the performance of representative OOD detection methods for three scenarios, i.e., irrelevant input detection, novel class detection, and domain shift detection, on various datasets and classification tasks. The results show that differences in scenarios and datasets alter the relative performance among the methods. Our results can also be used as a guide for practitioners for the selection of OOD detection methods.

Introduction: The Spectrum of Uncertainty

In real-world deployment, a neural network does not simply encounter "known" or "unknown" images; it faces a complex spectrum of uncertainty. Most research follows a narrow evaluation protocol where Out-of-Distribution (OOD) simply means images from a completely different dataset. However, a dog-breed classifier might encounter three distinct challenges:

  1. Irrelevant Inputs: A picture of a sofa (completely unrelated).
  2. Novel Classes: A picture of a rare dog breed not seen during training (semantically similar but technically OOD).
  3. Domain Shift: A picture of a known dog breed taken with a low-quality, blurry, or aging camera sensor.

This paper moves beyond the standard "one-size-fits-all" evaluation by testing methods across these three distinct real-world scenarios. The authors find that while popular methods like the Mahalanobis detector excel at spotting irrelevant data, Cosine Similarity emerges as the most robust "all-rounder" for practitioners, consistently performing well even when OOD samples closely resemble the training data.

Evaluated OOD Detection Methods

The study evaluates several representative OOD detection methods to determine their practical utility:

  • Baseline (Max-Softmax): Utilizing the highest probability score from the final layer.
  • MC Dropout: A Bayesian approach that runs multiple passes with dropout at test time to measure prediction uncertainty.
  • ODIN*: An improved version of the "Out-of-Distribution detector for Neural networks" using input perturbation and temperature scaling without requiring OOD samples for tuning.
  • Mahalanobis Detector: A method that models the distribution of internal network activations as Gaussians.
  • Cosine Similarity: Replacing the standard dot-product in the final layer with a scaled cosine similarity between feature vectors and class centers.
  • Meta-Approach for Domain Shift: For domain shift scenarios, the authors propose using OOD scores as input to a multilayer perceptron (MLP) regressor that predicts the expected classification error on incoming data batches.

Experimental Setup and Datasets

To ensure a comprehensive evaluation, the study utilizes a wide array of standard and specialized datasets across different classification tasks.

Examples of datasets used in the study, including Stanford Dogs, Plant Seedling, Food-101, CUB-200 (Birds), and Stanford Cars.
  • General Classification: Stanford Dogs, Plant Seedling, Food-101, CUB-200 (Birds), and Stanford Cars.
  • Novel Class Testing: Oxford-IIIT Pet (splitting dog breeds into "known" and "novel") and a subset of Food-101.
  • Domain Shift: ImageNet and Food-101 modified with 19 types of image corruptions (blur, noise, weather) at five levels of severity.
  • Real-World Domain Shift: The Office-31 dataset, containing images of the same objects across three domains: Amazon (clean), DSLR (high-res), and Webcam (low-res).

Key Insights and Results

The "Near-OOD" Challenge

Methods like the Mahalanobis detector are state-of-the-art for "far" OOD (e.g., detecting a car in a dog dataset). However, they struggle significantly with "near" OOD (detecting a new dog breed), where they can actually perform worse than the simple Max-Softmax baseline. In novel class detection, Cosine Similarity achieved the highest performance (e.g., 94.1% AUROC on Dogs with fine-tuning), while the Mahalanobis detector lagged behind at 78.7%.

Cosine Similarity as the "Swiss Army Knife"

Unlike other methods that fluctuate in performance based on the task, Cosine Similarity was consistently in the top tier across all three scenarios. It is particularly effective at novel class detection and provides a reliable signal for domain shift prediction.

The Impact of Pre-training

Fine-tuning a model from an ImageNet pre-trained checkpoint drastically improves OOD detection across the board. For irrelevant inputs, most methods achieved >95% AUROC when using pre-trained models, making this a largely solved problem for high-capacity networks.

Domain Shift vs. OOD Detection

The authors highlight that detecting a domain shift is fundamentally about predicting an accuracy drop, not just identifying a change in input distribution. Confidence-based signals, such as MC Dropout and Cosine Similarity, yielded the lowest Mean Absolute Error (MAE) when predicting classification error on corrupted images, proving they are more reliable "warning lights" for model degradation.

Conclusion and Future Work

While this study provides a practical guide for method selection, several challenges remain. The proposed meta-approach for domain shift detection requires some labeled data from a shifted domain to train the error-predicting regressor. Furthermore, distinguishing between an irrelevant input and a novel class input remains a difficult problem. For practitioners, the results suggest that Cosine Similarity offers the best balance of robustness and performance across the varied uncertainties encountered in real-world image classification.

Summary updated

BibTeX
@misc{techapanurak2021practical,
  author = {Engkarat Techapanurak and Takayuki Okatani},
  title = {{Practical Evaluation of Out-of-Distribution Detection Methods for Image Classification}},
  year = {2021},
  eprint = {2101.02447},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2101.02447},
}
Figure