Abstract
Detecting out-of-distribution (OOD) data is a critical capability for machine learning models deployed in open-world environments. Few-shot OOD detection (FSOD) seeks to achieve this using only a limited number of training samples. While current state-of-the-art methods utilize prompt learning with multimodal models like CLIP, they often suffer from a "clean data bias," leading to poor robustness when faced with background noise. This paper introduces NNI-FSOD (Near-boundary Noise Improved FSOD), a framework that transforms background noise into a valuable training asset. By identifying and utilizing "near-boundary noise," NNI-FSOD tightens the in-distribution (ID) class space and improves detection boundaries. Furthermore, a multimodal prototype fusion strategy is employed during testing to leverage the complementary strengths of visual and textual features. Experimental results demonstrate that NNI-FSOD significantly outperforms existing methods, improving FPR95 by 11.05% and AUROC by 2.24% on average.
Introduction
In real-world applications, such as autonomous driving, models must distinguish between known classes (In-Distribution) and unseen anomalies (Out-of-Distribution). FSOD is particularly challenging because the model must learn these boundaries from very few examples. Existing methods often fine-tune on centered, high-quality images, making them sensitive to background interference in test scenarios. A noisy ID sample might be mistaken for OOD, or a noisy OOD sample might be misclassified as ID. NNI-FSOD addresses this by explicitly modeling the noise found within the few-shot training set.
Methodology: The NNI-FSOD Framework
The NNI-FSOD approach consists of three integrated phases designed to refine the model's understanding of class boundaries.
1. Noise Discovering
Leveraging the zero-shot alignment capabilities of CLIP, the framework decomposes training images into multiple regional crops. By calculating the cosine similarity between these regions and the target class label (e.g., "a photo of a cat"), the model distinguishes between "clean" regions (high similarity) and "noise" regions (low similarity).
2. Noise Improvement
Rather than discarding background noise, NNI-FSOD treats it as "near-boundary" data that defines the limits of the ID space. A generator is used to synthesize additional OOD-like samples from this noise. A specialized loss function, $\mathcal{L}_{NNI}$, is then applied to "tighten" the ID distribution by pushing ID features closer together while simultaneously pulling noise and synthesized OOD features away. This creates a more compact and discriminative feature space.
3. Multimodal Prototype Fusion
During the inference phase, the model combines textual prototypes (derived from CLIP's text encoder) with visual prototypes (learned from the training images). This fusion allows the model to benefit from both the broad semantic robustness of text and the fine-grained visual details of the specific few-shot examples, leading to more accurate classification and OOD detection.
Experimental Evaluation
The performance of NNI-FSOD was evaluated using ImageNet-1K as the ID dataset and four standard OOD benchmarks: iNaturalist, SUN, Places, and Texture. These benchmarks provide a rigorous test of the model's ability to generalize across diverse scenes and objects.
Key Results
NNI-FSOD achieved state-of-the-art results across multiple metrics:
- FPR95 (False Positive Rate at 95% Recall): Reduced by an average of 11.05% compared to the baseline.
- AUROC: Increased by 2.24%.
- ID Accuracy: Improved by 1.87%, showing that OOD robustness does not come at the cost of classification performance.
The framework proved effective across different backbones, including ResNet and Vision Transformers (ViT), highlighting its architectural flexibility.
Discussion and Future Work
The primary innovation of NNI-FSOD is the "waste-to-treasure" philosophy—treating background noise as a proxy for the OOD boundary. By making the ID representation more compact, the model leaves more "room" in the feature space for correctly identifying anomalies.
However, the method's reliance on pre-trained models like CLIP means its effectiveness is partially bounded by CLIP's internal representations. Additionally, hyperparameters such as the noise threshold and sampling variance may require tuning for highly specialized domains. Future research could explore automated hyperparameter optimization or more advanced segmentation techniques to further refine noise discovery.
Conclusion
NNI-FSOD represents a significant step forward in making few-shot OOD detection robust for real-world deployment. By turning environmental noise into a training signal and fusing multimodal knowledge, it establishes a new performance benchmark for the field.
Summary updated