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}.
翻译:检测分布外(OOD)样本对于部署在开放环境中的机器学习模型至关重要。基于分类器的得分因其细粒度的检测能力成为OOD检测的标准方法。然而,这些得分往往存在过度自信问题,会将远离分布内区域的OOD样本错误分类。为解决这一挑战,我们提出了一种名为最近邻指导(NNGuide)的方法,该方法引导基于分类器的得分尊重数据流形的边界几何结构。NNGuide在保留基于分类器得分的细粒度能力的同时,降低了对OOD样本的过度自信。我们在ImageNet OOD检测基准上进行了多种设置下的广泛实验,包括分布内数据经历自然分布偏移的场景。实验结果表明,NNGuide在基础检测得分上实现了显著性能提升,并在AUROC、FPR95和AUPR指标上均达到了最先进水平。代码发布于\url{https://github.com/roomo7time/nnguide}。