Abstract
Detecting out-of-distribution (OOD) inputs is a principal task for ensuring the safety of deploying deep-neural-network classifiers in open-world scenarios. OOD samples can be drawn from arbitrary distributions and exhibit deviations from in-distribution (ID) data in various dimensions, such as foreground semantic features and background domain features. This paper considers the importance of the domain features in OOD detection and proposes to leverage them to enhance the semantic-feature-based OOD detection methods. We propose a novel generic framework, Disentangled Foreground and Background (DFB), that learns domain features from ID training samples via a dense prediction approach. Extensive experiments show that our approach substantially enhances the performance of four different state-of-the-art (SotA) OOD detection methods and achieves new SotA performance on multiple benchmarks.
Introduction
Deep learning classifiers are notoriously overconfident, often assigning high certainty to Out-of-Distribution (OOD) samples from categories they have never seen. A significant challenge in OOD detection is "foreground-background confusion." While most detectors focus on foreground semantic features (e.g., identifying a horse), models often learn spurious correlations with background domain features (e.g., a green field). If an OOD image shares a similar background or possesses a completely alien texture, standard models struggle.
This paper introduces DFB, a framework that explicitly separates an image's foreground objects from its background. By treating the background as its own distinct class, DFB provides a plug-and-play enhancement that significantly boosts the performance of existing state-of-the-art OOD detection methods.
The DFB Framework
The DFB framework operates through a multi-stage process designed to disentangle features without requiring manual segmentation labels.
- Weakly-Supervised Disentanglement: Using Class Activation Mapping (CAM) on a pre-trained $K$-class classifier, the model identifies salient pixels to generate pseudo-masks that separate foreground from background.
- Dense Prediction Learning: A new $(K+1)$-class "dense prediction" network is trained, where the $(K+1)$-th class is dedicated specifically to the "In-Distribution background."
- Lossless Conversion: The dense prediction network is converted back into a standard image classifier by replacing upsampling layers with Global Average Pooling (GAP), maintaining learned features while enabling standard inference.
- Joint OOD Scoring: During inference, the model combines a semantic score (foreground) with a background score from the $(K+1)$-th class using temperature-scaled fusion.
Experimental Results
The researchers evaluated DFB using CIFAR-10 and CIFAR-100 as In-Distribution (ID) data against various OOD datasets including SVHN, Places365, and Textures.
A key insight was the effectiveness of the background score. For datasets like Textures, which lack distinct objects, the background score alone often outperformed traditional semantic scores. By combining these signals, DFB achieved new State-of-the-Art (SotA) results:
- FPR95 Reduction: On CIFAR-10, DFB reduced the False Positive Rate (at 95% True Positive Rate) for the ViM detector from 4.84% to 3.65%.
- Averaged Gains: Across four base models (MSP, ODIN, Energy, and ViM), DFB improved the average FPR95 by 10.38% on CIFAR-10 and 11.78% on CIFAR-100.
- Scalability: The method remained robust in large-scale scenarios like ImageNet-1k, consistently outperforming baseline Energy scores.
Conclusion and Future Work
DFB demonstrates that background domain features are a rich, neglected source of information for OOD detection. While highly effective, the method's performance can be sensitive to the temperature hyperparameter ($T$) used in score fusion. Additionally, the quality of disentanglement depends on the initial model's localization capabilities. Future work may involve extending this framework to zero-shot OOD detection using vision-language models like CLIP to better characterize background features through descriptive prompts.
Summary updated