In or Out? Fixing ImageNet Out-of-Distribution Detection Evaluation

Julian Bitterwolf, Maximilian Müller, Matthias Hein

Out-of-Distribution (OOD) detection is a critical safety mechanism in machine learning, allowing a model to confidently state "I don't know" when confronted with data outside its training distribution. For models trained on ImageNet-1K (IN-1K), OOD performance is typically evaluated using datasets like Places or Textures. However, recent research exposes a massive flaw in this standard evaluation protocol: popular OOD benchmarks are heavily contaminated with In-Distribution (ID) objects, leading to unfair evaluations that actively penalize superior models.

The Contamination Problem

The authors identify that standard OOD datasets are riddled with ImageNet objects. This contamination occurs in two primary ways:

  1. Categorical Contamination: An OOD class semantically overlaps with an ID class. For example, the "hayfield" category in the Places dataset overlaps directly with the "hay" category in ImageNet.
  2. Incidental Contamination: An OOD image happens to feature an ID object in the background. For instance, an image representing the "sky" category might contain an "airliner" flying in the distance.

Because of this contamination, when high-capacity models like Vision Transformers (ViTs) correctly identify these hidden ID objects, they are penalized by the benchmark for registering a "false positive." Essentially, the machine learning community has been punishing its best models for exhibiting superior recognition capabilities.

Introducing NINCO and Synthetic Unit Tests

To rectify this evaluation crisis, the authors introduce NINCO (No ImageNet Class Objects), a rigorously cleaned OOD benchmark containing 5,879 images across 64 classes. Through painstaking manual inspection, every image in NINCO was verified to ensure zero IN-1K objects are present.

Alongside NINCO, the researchers developed 17 "OOD unit tests" comprising 400 samples each of synthetic images (e.g., solid black, solid white, or uniform noise). These tests are designed to evaluate whether models can handle trivial OOD cases that might occur during real-world sensor or camera failures.

Key Insights and Results

By benchmarking 11 different OOD detection methods across various architectures on these new datasets, the authors uncovered several critical insights:

  • The "Better Model Paradox": On contaminated datasets, weaker models (like ResNet-50) often appear to outperform ViTs. This is an illusion; the ResNet is simply "blind" to background ID objects, whereas the ViT detects them and is subsequently penalized by the flawed benchmark.
  • Massive Performance Corrections: The authors found that over 50% of samples in popular OOD datasets like Places and Species actually contain ImageNet objects. Once these datasets were cleaned, OOD detection error rates (measured as False Positive Rate at 95% True Positive Rate) dropped by more than 50% for certain methods.
  • Top Performers: Evaluated on the clean NINCO benchmark, the combination of a Vision Transformer (ViT) utilizing Mahalanobis distance emerged as the strongest OOD detector, consistently outperforming traditional logit-based methods.
  • The "Black Image" Failure: The synthetic unit tests revealed a surprising vulnerability: many sophisticated OOD detectors that excel on natural images fail completely on simple unit tests. Some detectors were easily fooled by solid black or grey images, posing a significant safety concern for real-world deployment.
  • The Role of Pretraining: Pretraining on larger datasets (like ImageNet-21K) significantly boosts OOD detection, particularly for feature-space distance metrics. Interestingly, traditional supervised pretraining outperformed CLIP-style pretraining for this specific task.

Limitations and Future Directions

While NINCO represents a major step forward for trustworthy machine learning evaluation, the authors acknowledge that manual cleaning is labor-intensive and difficult to scale as datasets grow. Future work must focus on automating the detection of incidental ID objects to curate even larger clean OOD datasets.

Furthermore, the failure of advanced models on simple synthetic unit tests highlights a glaring blind spot. The community needs to develop OOD methods that are robust to both semantic shifts (encountering new, unseen objects) and covariate shifts (experiencing sensor failures or noise), ensuring models fail safely in all unpredictable real-world scenarios.

Source: Bitterwolf, J., Müller, M., & Hein, M. (2023). In or Out? Fixing ImageNet Out-of-Distribution Detection Evaluation. ICLR 2023 Workshop on Trustworthy ML.

Summary updated

BibTeX
@inproceedings{bitterwolf2023or,
  author = {Julian Bitterwolf and Maximilian Müller and Matthias Hein},
  title = {{In or Out? Fixing ImageNet Out-of-Distribution Detection Evaluation}},
  booktitle = {International Conference on Machine Learning},
  year = {2023},
  url = {https://openreview.net/forum?id=ChniRIfpRR},
}
Figure