Block Selection Method for Using Feature Norm in Out-of-Distribution Detection

Yeonguk Yu, Sungho Shin, Seongju Lee, Changhyun Jun, Kyoobin Lee

Abstract

Standard Out-of-Distribution (OOD) detection often fails because neural networks become "overconfident" in their final layers, assigning high activations to unfamiliar inputs. This paper demonstrates that the norm of feature maps from internal blocks is a much more reliable indicator of OOD status than the final output. We introduce an automated "Jigsaw puzzle" method to select the optimal block for any given architecture, significantly improving detection performance without requiring retraining.

Introduction

When a neural network trained to recognize dogs encounters a picture of a galaxy, it should ideally signal uncertainty rather than confidently labeling it a "Golden Retriever." This is the core challenge of Out-of-Distribution (OOD) detection.

Most existing methods rely on the network's final output, such as Softmax scores or Energy. However, modern deep networks suffer from an "overconfidence" issue: the training process forces final layers to produce high activations to minimize loss. Surprisingly, OOD images often trigger these same high activations in the very last block, making them indistinguishable from In-Distribution (ID) data.

Feature map norm distributions in the last vs. penultimate blocks.

As shown in the figure above, the penultimate (second-to-last) block often provides a vastly superior signal for OOD detection. While ID and OOD activations overlap significantly in the final block, they are clearly separated in earlier layers. This suggests that the overactivation of OOD inputs is primarily a byproduct of the final classification layer's training objective.

Methodology

The authors propose a two-part post-hoc framework that requires no retraining of the model; one simply "taps into" the right internal layer of a pre-trained network.

FeatureNorm

Instead of class probabilities, the method calculates the Frobenius norm of the ReLU-rectified feature map at various internal blocks. OOD images typically produce significantly lower norms than ID images in earlier layers, as these layers are highly tuned to ID features and effectively "ignore" OOD data.

NormRatio and Block Selection

Not every block is equally effective at OOD detection. To find the optimal block without prior exposure to OOD data, the authors use a "Jigsaw puzzle" proxy. ID training images are divided into 3x3 patches and shuffled, destroying semantic meaning while preserving low-level statistics. The NormRatio—the ratio of FeatureNorm between original images and their jigsaw versions—is calculated for every block. The block with the highest ratio is selected for deployment.

Overview of the Block Selection and OOD detection pipeline.

Experimental Results

The researchers evaluated FeatureNorm across standard benchmarks including CIFAR10 and ImageNet, testing architectures like ResNet, VGG, and MobileNet.

  • CIFAR10: On ResNet18, FeatureNorm reduced the FPR95 (False Positive Rate at 95% TPR) to 25.67%, outperforming the next best method (29.14%). On WideResNet, FPR95 dropped to 13.53%, a 52.77% relative reduction.
  • ImageNet: For VGG16, FeatureNorm achieved an average FPR95 of 27.55%, while the next best method (Energy+DICE) was at 54.01%.
  • Compatibility: Simply replacing the "last block norm" with the "selected block norm" improved the performance of other existing OOD methods like MSP and Energy, suggesting block selection is a fundamental enhancement.

Discussion and Limitations

While highly effective, the method shows some architecture sensitivity. It was less effective on ResNet50, possibly due to the "Conv-BN-ReLU" ordering in its blocks causing earlier overactivation. Architectures using "BN-ReLU-Conv" (like WideResNet) performed better. Additionally, while the method excels at detecting semantic shifts, it can struggle with OOD data that shares low-level textures with the ID set (e.g., Places365). Future work may involve investigating the impact of Batch Normalization placement on OOD signals to design more robust architectures.

Summary updated

BibTeX
@inproceedings{yu2022block,
  author = {Yeonguk Yu and Sungho Shin and Seongju Lee and Changhyun Jun and Kyoobin Lee},
  title = {{Block Selection Method for Using Feature Norm in Out-of-Distribution Detection}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2022},
}
Figure