Introduction
Deep neural networks (DNNs) often exhibit overconfidence when processing data outside their training distribution (Out-of-Distribution, or OOD). This behavior poses significant risks in safety-critical domains like autonomous driving or medical diagnostics. While existing OOD detection methods provide confidence scores, they typically operate as "black boxes," offering no insight into why a particular sample is flagged. This paper introduces a novel framework that not only improves detection performance but also provides human-interpretable visual explanations through heatmap generation.
Methodology
The proposed approach utilizes a fixed, pre-trained classifier augmented with a secondary decoder network. The core innovation lies in treating OOD detection as a visual explanation task.
The Heatmap Concept
The system generates a heatmap that represents the discrepancy between an input image and its closest In-Distribution (ID) counterpart. For a true ID image, the target heatmap is zero (represented as blue). For an OOD image, the heatmap highlights regions that deviate from the learned distribution.
Finding the "Closest" ID Image
To define the target heatmap for an OOD sample, the authors analyze the classifier's penultimate layer. They identify an ID sample that shares the same predicted class but has the minimum Euclidean distance in the feature space. This "closest" ID image serves as the reference for what the model "expects" to see.
Decoder and Scoring
A decoder, modeled after the DCGAN generator, is trained to reconstruct these heatmaps using the classifier's internal features and class predictions. During inference, the decoder produces a heatmap for the input. An OOD score is then derived by calculating the average of the maximum pixel values across the heatmap; a high response indicates a high likelihood of the image being OOD.
Experimental Results
The method was evaluated against standard benchmarks including CIFAR-10, CIFAR-100, and Tiny ImageNet as ID datasets, with various OOD test sets like iSUN and SVHN.
Detection Performance
The heatmap-based approach significantly outperforms established baselines such as Maximum Softmax Probability (MSP), ODIN, and Energy-based scoring. On the CIFAR-10 benchmark using a ResNet18 architecture, the method reduced the False Positive Rate (FPR) at 95% True Positive Rate (TPR) to 15.37%, compared to 36.52% for the previous state-of-the-art (ReAct). AUROC scores consistently exceeded 96% for CIFAR-10 and remained robust even on more complex datasets.
Interpretability and Robustness
Qualitative analysis confirms that the heatmaps accurately highlight OOD regions (indicated by red/yellow) while remaining blank for ID samples. Furthermore, the model demonstrates intuitive sensitivity to environmental factors; for instance, images with extreme lighting or low contrast are flagged as OOD because their features become unrecognizable to the classifier.
Conclusion
By reframing OOD detection as an explanation problem, this research provides a dual benefit: state-of-the-art accuracy and transparency. The "plug-and-play" nature of the decoder allows it to be integrated with existing classifiers without retraining. Future work will focus on reducing the computational overhead of the decoder and extending the framework to more complex tasks like object detection and semantic segmentation.
Summary updated