Table of Contents
Fetching ...

Adaptive Hierarchical Graph Cut for Multi-granularity Out-of-distribution Detection

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

TL;DR

This work tackles the challenge of OOD detection in settings where unlabeled data mix ID and OOD samples with varying label granularity. It proposes Adaptive Hierarchical Graph Cut (AHGC), which builds a hierarchical KNN graph, uses linkage and density-guided graph cuts, and applies intra-subgraph label assignment, cross-level feature aggregation, and dual augmentation with an energy-based inference to distinguish ID from OOD. The approach yields strong empirical gains on SC-OOD benchmarks (CIFAR-10/100) and demonstrates the value of modeling multi-granularity semantics through graph-based clustering and self-supervised cues. The results suggest AHGC is effective for real-world OOD detection where semantic relationships across coarse- and fine-grained labels exist, with practical implications for safer AI deployment.

Abstract

This paper focuses on a significant yet challenging task: out-of-distribution detection (OOD detection), which aims to distinguish and reject test samples with semantic shifts, so as to prevent models trained on in-distribution (ID) data from producing unreliable predictions. Although previous works have made decent success, they are ineffective for real-world challenging applications since these methods simply regard all unlabeled data as OOD data and ignore the case that different datasets have different label granularity. For example, "cat" on CIFAR-10 and "tabby cat" on Tiny-ImageNet share the same semantics but have different labels due to various label granularity. To this end, in this paper, we propose a novel Adaptive Hierarchical Graph Cut network (AHGC) to deeply explore the semantic relationship between different images. Specifically, we construct a hierarchical KNN graph to evaluate the similarities between different images based on the cosine similarity. Based on the linkage and density information of the graph, we cut the graph into multiple subgraphs to integrate these semantics-similar samples. If the labeled percentage in a subgraph is larger than a threshold, we will assign the label with the highest percentage to unlabeled images. To further improve the model generalization, we augment each image into two augmentation versions, and maximize the similarity between the two versions. Finally, we leverage the similarity score for OOD detection. Extensive experiments on two challenging benchmarks (CIFAR- 10 and CIFAR-100) illustrate that in representative cases, AHGC outperforms state-of-the-art OOD detection methods by 81.24% on CIFAR-100 and by 40.47% on CIFAR-10 in terms of "FPR95", which shows the effectiveness of our AHGC.

Adaptive Hierarchical Graph Cut for Multi-granularity Out-of-distribution Detection

TL;DR

This work tackles the challenge of OOD detection in settings where unlabeled data mix ID and OOD samples with varying label granularity. It proposes Adaptive Hierarchical Graph Cut (AHGC), which builds a hierarchical KNN graph, uses linkage and density-guided graph cuts, and applies intra-subgraph label assignment, cross-level feature aggregation, and dual augmentation with an energy-based inference to distinguish ID from OOD. The approach yields strong empirical gains on SC-OOD benchmarks (CIFAR-10/100) and demonstrates the value of modeling multi-granularity semantics through graph-based clustering and self-supervised cues. The results suggest AHGC is effective for real-world OOD detection where semantic relationships across coarse- and fine-grained labels exist, with practical implications for safer AI deployment.

Abstract

This paper focuses on a significant yet challenging task: out-of-distribution detection (OOD detection), which aims to distinguish and reject test samples with semantic shifts, so as to prevent models trained on in-distribution (ID) data from producing unreliable predictions. Although previous works have made decent success, they are ineffective for real-world challenging applications since these methods simply regard all unlabeled data as OOD data and ignore the case that different datasets have different label granularity. For example, "cat" on CIFAR-10 and "tabby cat" on Tiny-ImageNet share the same semantics but have different labels due to various label granularity. To this end, in this paper, we propose a novel Adaptive Hierarchical Graph Cut network (AHGC) to deeply explore the semantic relationship between different images. Specifically, we construct a hierarchical KNN graph to evaluate the similarities between different images based on the cosine similarity. Based on the linkage and density information of the graph, we cut the graph into multiple subgraphs to integrate these semantics-similar samples. If the labeled percentage in a subgraph is larger than a threshold, we will assign the label with the highest percentage to unlabeled images. To further improve the model generalization, we augment each image into two augmentation versions, and maximize the similarity between the two versions. Finally, we leverage the similarity score for OOD detection. Extensive experiments on two challenging benchmarks (CIFAR- 10 and CIFAR-100) illustrate that in representative cases, AHGC outperforms state-of-the-art OOD detection methods by 81.24% on CIFAR-100 and by 40.47% on CIFAR-10 in terms of "FPR95", which shows the effectiveness of our AHGC.

Paper Structure

This paper contains 27 sections, 10 equations, 7 figures, 5 tables.

Figures (7)

  • Figure 1: (a) Relationship between labeled/unlabeled dataset and ID/OOD dataset. (b) Relationship between coarse- and fine-grained labels. In fact, "Tabby cat", "Persian cat" and "Egyptian cat" belong to the "Cat" class. (c) Previous methods ignore the relationship between coarse- and fine-grained samples, and mistakenly treat unlabeled ID samples (Persian cat) as OOD. (c) Brief framework of our proposed AHGC network, detailed in Fig. \ref{['fig:pipeline']}. (d) Performance comparison (lower FPR95 value means better performance) between state-of-the-art methods and our AHGC on two semantically coherent out-of-distribution detection benchmarks yang2021semantically: the CIFAR-10 benchmark and the CIFAR-100 benchmark, where left: CIFAR-10 krizhevsky2009learning is used as the labeled dataset and Tiny-ImageNet le2015tiny as the unlabeled dataset, and right: CIFAR-100 krizhevsky2009learning is utilized as the labeled dataset and Tiny-ImageNet le2015tiny as the unlabeled dataset. Best viewed in color.
  • Figure 2: Overview of the proposed AHGC. Firstly, we utilize the ResNet-18 network he2016deep to extract the visual features of labeled images $\mathcal{D}^L$ and unlabeled images $\mathcal{D}^U$. Then, we construct a hierarchical KNN graph to connect each image based on the cosine similarity. After that, we leverage the ground-truth labels in the labeled dataset as supervision to compute the linkage and density of the graph. Based on the linkage and density information, we cut the graph into multiple subgraphs by removing low-weight edges from the graph. If the labeled percentage is larger than a predefined threshold, we will assign the label with the highest percentage to unlabeled images. To improve the model generalization, we augment each image into two augmentation versions and then maximize the similarity between the two versions. During inference, with a classification head, we utilize a fully-connected layer to map the image features into a logit space. Then, we leverage the similarity score from the logit as the evaluation of OOD samples. We color labeled data flow as red and unlabeled data flow as blue. Finally, we repeat these steps until the loss converges. Best viewed in color.
  • Figure 3: Illustration of the attention-aware graph cut module, where "AGC" means the "adaptive graph cut" module, the image with a red edge in a subgraph is its peak node, and labels are attached to labeled images. Multiple levels of AGC are utilized into the framework, where each level contains four GAT layers and an MLP layer followed by a softmax operation. Based on each AGC, we can divide the large graph into multiple subgraphs, and choose the representative node as the peak node. Therefore, we can integrate the multi-granularity images with the same semantics into a subgraph. Best viewed in color.
  • Figure 4: Performance of our proposed AHGC and UDG yang2021semantically on CIFAR-10 benchmark during training process. Since the maximum number of epochs on UDG is 100, we report our performance of the first 100 epochs for fair comparison.
  • Figure 5: Effect of subgraph number $K$ on the CIFAR-10 benchmark (left) and for the CIFAR-100 benchmark (right).
  • ...and 2 more figures