Towards Boosting Out-of-Distribution Detection from a Spatial Feature Importance Perspective
Boosting Out-of-Distribution Detection Performance from the Perspective of Spatial Feature Importance
Research Background and Problem Statement
In practical applications of deep learning models, ensuring that models can reliably reject predictions when faced with inputs from unknown categories is crucial for system safety and robustness. This need has spurred research in Out-of-Distribution Detection (OOD Detection). OOD detection aims to distinguish samples within the range of the model’s training data distribution (i.e., In-Distribution, ID) from those outside this range (i.e., Out-of-Distribution). In recent years, researchers have proposed various detection criteria, such as MSP (Maximum Softmax Probability), Energy Score, GradNorm, etc., to construct rejection regions for models and identify samples falling into these regions as out-of-distribution.
However, existing methods typically compute detection criteria based on all dense features of the model, overlooking the fact that different features may exhibit varying importance in the decision-making process. This “one-size-fits-all” approach might cause the model to be interfered by redundant or irrelevant features during detection, thereby limiting further improvements in detection performance. To address this, the authors propose a novel perspective: re-examining the obstacles in OOD detection tasks from the viewpoint of spatial feature importance and attempting to enhance detection performance by purifying unimportant features.
Paper Source and Author Information
This paper, titled “Towards Boosting Out-of-Distribution Detection from a Spatial Feature Importance Perspective,” was co-authored by Yao Zhu (Zhejiang University), Xiu Yan (Meituan Group), and Chuanlong Xie (Beijing Normal University) and published in the top-tier international journal of computer vision, International Journal of Computer Vision (IJCV). The paper was accepted on January 6, 2025, and officially published online in 2025. This research was supported by the National Natural Science Foundation of China (No. 12201048).
Research Workflow and Methodology
1. Spatial-Oriented Feature Attribution
To quantify the importance of different spatial positions in dense features, the authors first introduced a Shapley value-based spatial-oriented feature attribution method. The Shapley value is a mathematical tool originating from cooperative game theory used to measure each player’s contribution to the overall payoff. In this study, each spatial feature in the dense features is considered a “player,” and its marginal contribution to the model’s prediction is calculated using the following formula:
[ φ_{ai} = \frac{1}{HW} \sum{q=1}^{HW} \frac{1}{\binom{HW-1}{q-1}} \sum_{s \in Sq(i)} Δ{a_i}(s) ]
Here, (Δ_{a_i}(s)) represents the change in model prediction when adding feature (a_i); (S_q(i)) is the set of all subsets of size (q) that do not include (a_i). Due to the high computational cost of directly calculating Shapley values, the authors employed Monte Carlo sampling for approximation.
Through this method, the authors generated a feature importance map and upsampled it to the input image size to form a heatmap. These heatmaps not only intuitively reflect key areas in the model’s decision-making process but also outperform existing CAM (Class Activation Mapping) series methods in terms of local fidelity and global fidelity.
2. Spatial Feature Purification (SFP)
Based on the above feature attribution method, the authors further proposed a spatial feature purification method (SFP). Specifically, SFP removes spatial features with lower importance from dense features according to the feature importance map while retaining more critical features for model decisions. The purified features are then used to compute detection criteria, thereby enhancing detection performance.
The specific steps of SFP are as follows: 1. Sort the feature importance map in ascending order to obtain a sorted list of feature importance. 2. Select the (n = \lfloor r \cdot HW \rfloor) least important features based on the set purification ratio (r). 3. Set these features to zero to generate the purified feature map.
Experimental Design and Validation
Datasets and Models
To validate the effectiveness of SFP, the authors conducted experiments on multiple benchmark datasets, including large-scale ImageNet and its variant ImageNet-V2, as well as small-scale CIFAR-100. The experiments involved various model architectures, covering CNNs (e.g., ResNet-50, ResNetV2) and Transformers (e.g., Swin-Tiny, TinyViT).
Detection Criteria
The authors compared the performance improvement of seven mainstream OOD detection criteria (such as Energy Score, KNN, ViM, etc.) and three model post-processing methods (such as DICE, ASH, LINE).
Performance Evaluation Metrics
The experiments used two main evaluation metrics: FPR95 (False Positive Rate at 95% True Positive Rate) and AUROC (Area Under the Receiver Operating Characteristic Curve). Lower FPR95 and higher AUROC indicate better detection performance.
Main Results and Analysis
1. Performance of Feature Attribution Method
Experimental results show that the feature attribution method proposed by the authors outperforms existing CAM series methods in both local fidelity and global fidelity. For example, when removing the most relevant pixels, the authors’ method significantly reduced the model’s prediction confidence; whereas when removing the least relevant pixels, the model’s confidence changed minimally. This indicates that the method can more accurately capture key areas in the model’s decision-making process.
2. Enhancement of Detection Performance by SFP
In the ImageNet benchmark tests, SFP significantly improved the performance of various detection criteria. For instance, for the Energy Score, SFP reduced the FPR95 by an average of 18.39% on the ResNet-50 model, while ViM’s FPR95 was reduced by 26.45%. Additionally, on the ImageNet-V2 dataset, SFP also performed well, especially under natural distribution shift scenarios, where the performance improvement was even more pronounced.
3. Compatibility and Extensibility
The authors also validated the compatibility of SFP with other model post-processing methods. Experimental results showed that SFP could further enhance the performance of existing post-processing methods (such as DICE, ASH, LINE). For example, when combined with Energy Score, SFP reduced DICE’s FPR95 from 79.58% to 55.41%.
Conclusion and Significance
Scientific Value
This study re-examines the OOD detection task from the perspective of spatial feature importance, revealing the potential negative impact of non-essential features on detection performance. By introducing the SFP method, the authors successfully enhanced the performance of various detection criteria, demonstrating the potential of feature purification in improving model robustness.
Application Value
As a plug-and-play method, SFP can seamlessly integrate into existing OOD detection frameworks, offering broad application prospects. Especially in high-risk fields like autonomous driving and medical diagnosis, SFP can help models more accurately identify unknown categories, thereby enhancing system safety.
Research Highlights
- Novel Perspective: Redefines the obstacles in OOD detection tasks from the perspective of spatial feature importance.
- Innovative Methods: First application of Shapley values to spatial position attribution in dense features, proposing an efficient and highly faithful feature attribution method.
- Wide Applicability: SFP is suitable for various model architectures and detection criteria, showcasing strong compatibility and extensibility.
This research provides new insights into understanding the internal mechanisms of deep models and points the way forward for future developments in the field of OOD detection.