Detecting out-of-distribution (OOD) inputs during the inference stage is crucial for deploying neural networks in the real world. Previous methods commonly relied on the output of a network derived from the highly activated feature map. In this study, we first revealed that a norm of the feature map obtained from the other block than the last block can be a better indicator of OOD detection. Motivated by this, we propose a simple framework consisting of FeatureNorm: a norm of the feature map and NormRatio: a ratio of FeatureNorm for ID and OOD to measure the OOD detection performance of each block. In particular, to select the block that provides the largest difference between FeatureNorm of ID and FeatureNorm of OOD, we create Jigsaw puzzle images as pseudo OOD from ID training samples and calculate NormRatio, and the block with the largest value is selected. After the suitable block is selected, OOD detection with the FeatureNorm outperforms other OOD detection methods by reducing FPR95 by up to 52.77% on CIFAR10 benchmark and by up to 48.53% on ImageNet benchmark. We demonstrate that our framework can generalize to various architectures and the importance of block selection, which can improve previous OOD detection methods as well.
翻译:在推理阶段检测分布外(OOD)输入对于神经网络在现实世界中的部署至关重要。以往方法通常依赖于从高激活特征图导出的网络输出。本研究中,我们首次揭示:从非最后一层模块获得的特征图范数可以成为更优的OOD检测指标。基于此发现,我们提出一个由FeatureNorm(特征图范数)和NormRatio(用于衡量各模块OOD检测性能的ID与OOD特征范数比值)构成的简单框架。具体而言,为选择使ID特征范数与OOD特征范数差异最大的模块,我们从ID训练样本中生成拼图图像作为伪OOD样本并计算NormRatio,最终选取比值最大的模块。选定合适模块后,基于FeatureNorm的OOD检测方法在CIFAR10基准上将FPR95降低高达52.77%,在ImageNet基准上降低高达48.53%,超越其他OOD检测方法。我们证明该框架可泛化至多种网络架构,并揭示了模块选择的重要性——该方法同样能改进现有OOD检测技术。