Table of Contents
Fetching ...

Your Data Is Not Perfect: Towards Cross-Domain Out-of-Distribution Detection in Class-Imbalanced Data

Xiang Fang, Arvind Easwaran, Blaise Genest, Ponnuthurai Nagaratnam Suganthan

TL;DR

This work tackles cross-domain out-of-distribution detection under class-imbalanced data (CCOD) by introducing the Uncertainty-Aware Adaptive Semantic Alignment (UASA) network. UASA comprises four modules: Label-Driven Prototype Building for Source Classification to generate robust source prototypes $M=igl\{m_c\bigr\}$; Prototype-Guided Domain Alignment for Target Classification using a memory bank to align targets to prototypes; Adaptive Threshold Generation for Target OOD Detection with per-sample thresholds based on entropy; and Uncertainty-Aware Target Clustering to mitigate class imbalance via KL-based pairwise constraints in an uncertainty-weighted memory. Across DomainNet, Office-Home, and VisDA-C, UASA yields substantial improvements over state-of-the-art methods in both class-imbalanced and class-balanced CCOD settings, with notable gains such as a 9.06% improvement on P→R in DomainNet. The approach advances practical OOD detection by addressing semantic gap, domain shift, and class distribution skew in a unified framework, showing strong generalization across diverse multi-domain benchmarks. Future work includes extending UASA to video data and exploring alternative domain-alignment strategies to further boost robustness.

Abstract

Previous OOD detection systems only focus on the semantic gap between ID and OOD samples. Besides the semantic gap, we are faced with two additional gaps: the domain gap between source and target domains, and the class-imbalance gap between different classes. In fact, similar objects from different domains should belong to the same class. In this paper, we introduce a realistic yet challenging setting: class-imbalanced cross-domain OOD detection (CCOD), which contains a well-labeled (but usually small) source set for training and conducts OOD detection on an unlabeled (but usually larger) target set for testing. We do not assume that the target domain contains only OOD classes or that it is class-balanced: the distribution among classes of the target dataset need not be the same as the source dataset. To tackle this challenging setting with an OOD detection system, we propose a novel uncertainty-aware adaptive semantic alignment (UASA) network based on a prototype-based alignment strategy. Specifically, we first build label-driven prototypes in the source domain and utilize these prototypes for target classification to close the domain gap. Rather than utilizing fixed thresholds for OOD detection, we generate adaptive sample-wise thresholds to handle the semantic gap. Finally, we conduct uncertainty-aware clustering to group semantically similar target samples to relieve the class-imbalance gap. Extensive experiments on three challenging benchmarks demonstrate that our proposed UASA outperforms state-of-the-art methods by a large margin.

Your Data Is Not Perfect: Towards Cross-Domain Out-of-Distribution Detection in Class-Imbalanced Data

TL;DR

This work tackles cross-domain out-of-distribution detection under class-imbalanced data (CCOD) by introducing the Uncertainty-Aware Adaptive Semantic Alignment (UASA) network. UASA comprises four modules: Label-Driven Prototype Building for Source Classification to generate robust source prototypes ; Prototype-Guided Domain Alignment for Target Classification using a memory bank to align targets to prototypes; Adaptive Threshold Generation for Target OOD Detection with per-sample thresholds based on entropy; and Uncertainty-Aware Target Clustering to mitigate class imbalance via KL-based pairwise constraints in an uncertainty-weighted memory. Across DomainNet, Office-Home, and VisDA-C, UASA yields substantial improvements over state-of-the-art methods in both class-imbalanced and class-balanced CCOD settings, with notable gains such as a 9.06% improvement on P→R in DomainNet. The approach advances practical OOD detection by addressing semantic gap, domain shift, and class distribution skew in a unified framework, showing strong generalization across diverse multi-domain benchmarks. Future work includes extending UASA to video data and exploring alternative domain-alignment strategies to further boost robustness.

Abstract

Previous OOD detection systems only focus on the semantic gap between ID and OOD samples. Besides the semantic gap, we are faced with two additional gaps: the domain gap between source and target domains, and the class-imbalance gap between different classes. In fact, similar objects from different domains should belong to the same class. In this paper, we introduce a realistic yet challenging setting: class-imbalanced cross-domain OOD detection (CCOD), which contains a well-labeled (but usually small) source set for training and conducts OOD detection on an unlabeled (but usually larger) target set for testing. We do not assume that the target domain contains only OOD classes or that it is class-balanced: the distribution among classes of the target dataset need not be the same as the source dataset. To tackle this challenging setting with an OOD detection system, we propose a novel uncertainty-aware adaptive semantic alignment (UASA) network based on a prototype-based alignment strategy. Specifically, we first build label-driven prototypes in the source domain and utilize these prototypes for target classification to close the domain gap. Rather than utilizing fixed thresholds for OOD detection, we generate adaptive sample-wise thresholds to handle the semantic gap. Finally, we conduct uncertainty-aware clustering to group semantically similar target samples to relieve the class-imbalance gap. Extensive experiments on three challenging benchmarks demonstrate that our proposed UASA outperforms state-of-the-art methods by a large margin.

Paper Structure

This paper contains 13 sections, 13 equations, 4 figures, 9 tables.

Figures (4)

  • Figure 1: (a) Example of the class-imbalanced cross-domain out-of-distribution detection (CCOD) setting. (b) and (c) Comparison between previous models and our proposed model; previous OOD detection methods only address the semantic gap within a single domain while we aim to relieve three gaps: semantic gap (between ID samples and OOD samples), domain gap (between the labeled source domain and unlabeled target domain) and class-imbalance (between different classes).
  • Figure 2: Overview of our proposed UASA system for the proposed CCOD task. Underlined module names refer to the eponymous sections in the text. First, we feed all source and target images into a ResNet-50 network resnet to extract their features. (i) In the label-driven prototype building (LPB) module, we build label-driven source prototypes by classifying source images. (ii) In the prototype-guided domain alignment (PDA) module, we leverage these prototypes in a memory bank for target classification. (iii) In the adaptive threshold generation (ATG) module, we automatically generate a threshold for each target sample to distinguish if the sample is OOD or ID. If it is ID, we choose the label with the highest probability as its label; otherwise, we mark it as OOD. (iv) In the uncertainty-aware target clustering (UC) module, we cluster target samples into different clusters. By aligning semantically similar samples in each cluster, we alleviate the class-imbalance gap.
  • Figure 3: Visualizations for the P$\rightarrow$R task on DomainNet. Left and Middle: T-SNE visualizations of "before domain adaptation" (Left) and "after domain adaptation" (Middle), where red triangles denote source "cat" samples and blue circles denote target "cat" samples. Right: Visualization of our clustering results. We show partial samples from the "Cat" cluster, where the labeled percentage is larger than 85%. We report the probability above each image. Images with red edges are from the painting domain. Images with blue edges are from the real-world domain.
  • Figure 4: Left and Middle: ablative CCOD performance in terms of loss (Left) and performance (Middle) for the P$\rightarrow$R task on the DomainNet dataset across training epochs, where "ACC" means "source classification accuracy". Right: Parameter sensitivity ($\lambda_1, \lambda_2,\lambda_3,\alpha$).