Out-of-distribution detection is a crucial technique for deploying machine learning models in the real world to handle the unseen scenarios. In this paper, we propose a simple but effective Neural Activation Prior (NAP) for out-of-distribution detection (OOD). Our neural activation prior is based on a key observation that, for a channel before the global pooling layer of a fully trained neural network, the probability of a few of its neurons being activated with a larger response by an in-distribution (ID) sample is significantly higher than that by an OOD sample. An intuitive explanation is each channel in a model fully trained on ID dataset would play a role in detecting a certain pattern in the samples within the ID dataset, and a few neurons can be activated with a large response when the pattern is detected in an input sample. Thus, a new scoring function based on this prior is proposed to highlight the role of these strongly activated neurons in OOD detection. This approach is plug-and-play and does not lead to any performance degradation on in-distribution data classification and requires no extra training or statistics from training or external datasets. Notice that previous methods primarily rely on post-global-pooling features of the neural networks, while the within-channel distribution information we leverage would be discarded by the global pooling operator. Consequently, our method is orthogonal to existing approaches and can be effectively combined with them in various applications. Experimental results show that our method achieves the state-of-the-art performance on CIFAR-10, CIFAR-100 and ImageNet datasets, which demonstrates the power of the proposed prior.
翻译:分布外检测是机器学习模型在实际部署中处理未知场景的关键技术。本文提出一种简单而有效的神经激活先验(Neural Activation Prior, NAP)用于分布外检测(Out-of-Distribution Detection, OOD)。我们的神经激活先验基于一个关键观察:在完全训练的神经网络全局池化层之前的某个通道中,分布内(In-Distribution, ID)样本激活少数神经元产生较大响应的概率显著高于分布外样本。直观解释是,在ID数据集上完全训练的模型中,每个通道负责检测ID样本中的特定模式,当输入样本中检测到该模式时,少数神经元会被较大响应激活。基于此先验,我们提出新的评分函数,以突出这些强激活神经元在OOD检测中的作用。该方法即插即用,不会导致分布内数据分类性能下降,且无需额外训练或从训练集/外部数据集获取统计信息。值得注意的是,现有方法主要依赖神经网络全局池化后的特征,而我们利用的通道内分布信息会被全局池化操作丢弃。因此,我们的方法与现有方法正交,可在各种应用中有效结合。实验结果表明,本方法在CIFAR-10、CIFAR-100和ImageNet数据集上达到最优性能,验证了所提先验的有效性。