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

Enhancing The Reliability of Out-of-distribution Image Detection in Neural Networks

Shiyu Liang, Yixuan Li, R. Srikant, Unknown author

Abstract & TL;DR

Modern deep neural networks are remarkably good at classifying images they were trained on, but they suffer from a dangerous "overconfidence" problem. When shown something completely alien—like a random noise pattern or an image from a totally different category—they often assign it to a known class with high certainty.

To address this, the authors propose ODIN (Out-of-DIstribution detector for Neural networks), a simple yet powerful post-hoc method that helps pre-trained models identify images they haven't seen during training. By applying temperature scaling to the softmax function and adding subtle perturbations to input images, ODIN significantly widens the confidence gap between "known" and "unknown" data without requiring any model retraining.

The Challenge of Out-of-Distribution Detection

In safety-critical applications like autonomous driving or medical diagnosis, a model must know when it is "out of its depth." This is known as Out-of-Distribution (OOD) detection.

Previous approaches to OOD detection either required expensive retraining or relied on simple softmax scores that weren't robust enough to reliably separate in-distribution data from OOD noise. A pre-trained network will often output a high-confidence softmax score even for an image that looks nothing like its training data, making raw softmax an unreliable metric for uncertainty.

The ODIN Method

ODIN introduces two key "knobs" that can be tuned after a model is already trained, requiring zero changes to the underlying architecture or weights:

  1. Temperature Scaling ($T$): Instead of the standard softmax, ODIN uses a "tempered" version where the logits (the raw outputs before the final probability layer) are divided by a large number $T$. While temperature scaling is often used to soften probability distributions, the authors found that at high temperatures, it actually helps push the scores of in-distribution and OOD images further apart.
  2. Input Preprocessing ($\epsilon$): ODIN applies a tiny, controlled perturbation to the input image before passing it through the network. By adding a small amount of the gradient of the log-softmax score back into the image, the model's confidence in the predicted class increases. Crucially, this confidence boost is significantly stronger for in-distribution images than for OOD images.
Effect of Temperature and Perturbation Magnitude on Performance

By combining these two techniques, the maximum softmax score becomes a much more reliable "detector" for whether an image belongs to the training distribution.

Key Insights

  • The Power of the Gap: The core insight is that in-distribution images have a much larger gap between their highest logit and the remaining logits compared to OOD images. Temperature scaling mathematically amplifies this difference.
  • Perturbation as a Filter: Because the model is "tuned" to the features of the training data, the gradient of the loss is more meaningful for in-distribution samples. Perturbing the image along this gradient "rewards" the model's existing knowledge, making it much more confident in its correct predictions while leaving it relatively unimpressed by OOD samples.
  • Zero Retraining: This method works on any pre-trained softmax classifier. You just change how you process the input and the final output layer.

Experimental Results

The researchers evaluated ODIN across several popular benchmarks, using CIFAR-10 and CIFAR-100 as in-distribution sets, and Tiny-ImageNet, LSUN, iSUN, and synthetic noise as OOD sets. The experiments utilized state-of-the-art architectures including DenseNet and Wide ResNet (WRN).

ODIN established a new state-of-the-art for OOD detection at the time of publication, consistently outperforming the standard baseline.

ROC Curve comparing Baseline and ODIN
  • Massive FPR Reduction: On a DenseNet trained on CIFAR-10, ODIN reduced the False Positive Rate (FPR) from 34.7% to just 4.3% (at a 95% True Positive Rate) when tested against Tiny-ImageNet.
  • Consistency: The performance gains were consistent across different OOD datasets, whether they were natural images (LSUN) or pure synthetic noise.
  • Architecture Agnostic: The method worked equally well for both DenseNet and Wide ResNet, proving its versatility.

Limitations and Future Work

While highly effective, ODIN does come with a few trade-offs:

  • Hyperparameter Tuning: ODIN requires two hyperparameters ($T$ and $\epsilon$) to be tuned using a small "hold-out" set of OOD images. While the tuning set choice isn't overly sensitive, it still requires the developer to have some representative "unknown" data on hand.
  • Computational Overhead: The input preprocessing step requires a backward pass to calculate the gradient for every image at test time. This effectively doubles the inference time, which might be a hurdle for real-time, low-latency applications.

Future directions suggest exploring ODIN in other domains beyond computer vision, such as natural language processing (NLP) and speech recognition, where overconfidence remains a major issue.

Summary updated

BibTeX
@inproceedings{liang2018enhancing,
  author = {Shiyu Liang and Yixuan Li and R. Srikant and Unknown author and Unknown author},
  title = {{Enhancing The Reliability of Out-of-distribution Image Detection in Neural Networks}},
  booktitle = {International Conference on Learning Representations},
  year = {2018},
  url = {https://openreview.net/forum?id=H1VGkIxRZ},
}
Figure