Jaewoo Park, Yoon Gyo Jung, Andrew Beng Jin Teoh
Detecting out-of-distribution (OOD) samples are crucial for machine learning models deployed in open-world environments. Classifier-based scores are a standard approach for OOD detection due to their fine-grained detection capability. However, these scores often suffer from overconfidence issues, misclassifying OOD samples distant from the in-distribution region. To address this challenge, we propose a method called Nearest Neighbor Guidance (NNGuide) that guides the classifier-based score to respect the boundary geometry of the data manifold. NNGuide reduces the overconfidence of OOD samples while preserving the fine-grained capability of the classifier-based score. We conduct extensive experiments on ImageNet OOD detection benchmarks under diverse settings, including a scenario where the ID data undergoes natural distribution shift. Our results demonstrate that NNGuide provides a significant performance improvement on the base detection scores, achieving state-of-the-art results on both AUROC, FPR95, and AUPR metrics. The code is given at \url{https://github.com/roomo7time/nnguide}.
| Task | Dataset | Metric | Value | Model |
|---|---|---|---|---|
| Out-of-Distribution Detection | ImageNet-1k vs OpenImage-O | AUROC | 97.73 | NNGuide (RegNet) |
| Out-of-Distribution Detection | ImageNet-1k vs OpenImage-O | FPR95 | 10.79 | NNGuide (RegNet) |
| Out-of-Distribution Detection | ImageNet-1k vs OpenImage-O | Latency, ms | 31 | NNGuide (RegNet) |
| Out-of-Distribution Detection | ImageNet-1k vs OpenImage-O | AUROC | 92.49 | NNGuide (ResNet50 w/ ReAct) |
| Out-of-Distribution Detection | ImageNet-1k vs OpenImage-O | FPR95 | 35.1 | NNGuide (ResNet50 w/ ReAct) |
| Out-of-Distribution Detection | ImageNet-1k vs OpenImage-O | Latency, ms | 11.1 | NNGuide (ResNet50 w/ ReAct) |
| Out-of-Distribution Detection | ImageNet-1K vs ImageNet-O | AUROC | 92.96 | NNGuide-ViM (ViT-B/16) |
| Out-of-Distribution Detection | ImageNet-1K vs ImageNet-O | FPR95 | 33.1 | NNGuide-ViM (ViT-B/16) |
| Out-of-Distribution Detection | ImageNet-1k vs iNaturalist | AUROC | 99.57 | NNGuide (RegNet) |
| Out-of-Distribution Detection | ImageNet-1k vs iNaturalist | FPR95 | 1.83 | NNGuide (RegNet) |
| Out-of-Distribution Detection | ImageNet-1k vs iNaturalist | Latency, ms | 31 | NNGuide (RegNet) |
| Out-of-Distribution Detection | ImageNet-1k vs iNaturalist | AUROC | 97.7 | NNGuide (ResNet50 w/ ReAct) |
| Out-of-Distribution Detection | ImageNet-1k vs iNaturalist | FPR95 | 11.12 | NNGuide (ResNet50 w/ ReAct) |
| Out-of-Distribution Detection | ImageNet-1k vs iNaturalist | Latency, ms | 11.1 | NNGuide (ResNet50 w/ ReAct) |
| Out-of-Distribution Detection | ImageNet-1k vs Textures | AUROC | 96.11 | NNGuide (ResNet50 w/ ReAct) |
| Out-of-Distribution Detection | ImageNet-1k vs Textures | FPR95 | 17.27 | NNGuide (ResNet50 w/ ReAct) |
| Out-of-Distribution Detection | ImageNet-1k vs Textures | Latency, ms | 11.1 | NNGuide (ResNet50 w/ ReAct) |
| Out-of-Distribution Detection | ImageNet-1k vs Textures | AUROC | 95.82 | NNGuide (RegNet) |
| Out-of-Distribution Detection | ImageNet-1k vs Textures | FPR95 | 17 | NNGuide (RegNet) |
| Out-of-Distribution Detection | ImageNet-1k vs Textures | Latency, ms | 31 | NNGuide (RegNet) |
| Out-of-Distribution Detection | ImageNet-1k vs Places | AUROC | 91.87 | NNGuide (RegNet) |
| Out-of-Distribution Detection | ImageNet-1k vs Places | FPR95 | 31.47 | NNGuide (RegNet) |
| Out-of-Distribution Detection | ImageNet-1k vs SUN | AUROC | 94.43 | NNGuide (RegNet) |
| Out-of-Distribution Detection | ImageNet-1k vs SUN | FPR95 | 21.58 | NNGuide (RegNet) |
| Out-of-Distribution Detection | ImageNet-1k vs Curated OODs (avg.) | AUROC | 95.42 | NNGuide (RegNet) |
| Out-of-Distribution Detection | ImageNet-1k vs Curated OODs (avg.) | FPR95 | 17.97 | NNGuide (RegNet) |
| Out-of-Distribution Detection | ImageNet-1k vs Curated OODs (avg.) | AUROC | 95.45 | NNGuide (ResNet50 w/ ReAct) |
| Out-of-Distribution Detection | ImageNet-1k vs Curated OODs (avg.) | FPR95 | 19.72 | NNGuide (ResNet50 w/ ReAct) |