Abstract
Deep Neural Networks (DNNs) often exhibit overconfidence when encountering Out-of-Distribution (OOD) samples, posing significant safety risks. We present KIRBY (Key In-distribution feature Replacement BY inpainting), a novel method that generates a "near-distribution" surrogate OOD dataset from existing training data. By identifying class-discriminative features via saliency maps and replacing them with background textures through inpainting, KIRBY trains a rejection network that effectively distinguishes between known classes and semantically similar outliers. Our approach outperforms state-of-the-art methods like Outlier Exposure without requiring external datasets.
Introduction
A fundamental challenge in deploying machine learning models is their tendency to classify unseen categories into known classes with high certainty. This "overconfidence" is particularly dangerous in high-stakes domains like autonomous driving or medical diagnostics. Traditional OOD detection often relies on auxiliary datasets of random images (Outlier Exposure) or synthetic GAN-generated outliers. However, these methods frequently struggle with "hard" outliers that share semantic context with the training data—for instance, mistaking a bridge for a ship because both appear over water.
Methodology: The KIRBY Pipeline
The authors propose a three-step procedure to create a surrogate dataset that mimics the background context of the training data while removing the primary objects of interest.
- Feature Identification: The model utilizes Class Activation Maps (CAM) to pinpoint pixels that are most discriminative for a specific class (e.g., the features that define a "dog").
- Erasure and Inpainting: These identified features are masked. The resulting void is filled using a Fast Marching Inpainting algorithm. This process pulls textures from the surrounding background to create a plausible image that contains the original "context" but lacks the "object."
- Rejection Training: A shallow rejection network is appended to the penultimate layer of a frozen, pre-trained classifier. This network is trained to differentiate between the original In-Distribution (ID) samples and the newly synthesized surrogate OOD samples.
KIRBY is implemented in two variants: KIRBY-B (a binary ID vs. OOD classifier) and KIRBY-M (a multi-class classifier handling $K$ original classes plus one OOD class).
The Background Trap and Semantic Proximity
A key insight of this research is the "Background Trap." DNNs often rely heavily on background textures for classification. By using inpainting to create images consisting solely of background, KIRBY forces the rejection network to learn that context alone is insufficient for a sample to be considered "In-Distribution."
Furthermore, KIRBY’s surrogate samples are mathematically closer to the ID data (measured via Hausdorff distance) than typical GAN-generated samples. This proximity makes them more effective "hard negatives" for training, as they challenge the model to focus on the presence of the actual object rather than just the scene.
Key Results
KIRBY consistently matched or exceeded the performance of state-of-the-art benchmarks across CIFAR-10, CIFAR-100, and STL-10 datasets:
- Reduced False Positives: On CIFAR-100, KIRBY-B achieved a False Positive Rate (FPR) at 95% TPR of 13.03% on the iSUN dataset, significantly outperforming the "Energy" method, which recorded 72.43%.
- Efficiency: Unlike Outlier Exposure (OE), which requires massive external datasets (e.g., 80 million images), KIRBY achieves superior results using only the surrogate data generated from the training set itself.
- Architecture Agnostic: The method proved robust across various backbones, including WideResNet, ResNet, and DenseNet, without requiring retraining of the original classification layers.
Limitations and Future Work
The efficacy of KIRBY is tied to the quality of the saliency maps; if the CAM fails to accurately locate the object, the inpainting will not effectively erase the class-discriminative features. While the method excels in natural scenes with distinct backgrounds, its performance in highly abstract or cluttered environments remains an area for further study. Future research may explore deep-learning-based generative inpainting to create even more plausible surrogate samples.
Summary updated