Table of Contents
Fetching ...

On the Problem of Consistent Anomalies in Zero-Shot Industrial Anomaly Detection

Tai Le-Gia, Ahn Jaehyun

TL;DR

This work tackles the difficulty of consistent anomalies in zero-shot industrial anomaly detection by introducing CoDeGraph, a graph-based framework that exploits neighbor-burnout in patch-level similarity. The method defines an endurance-ratio metric and constructs an anomaly-similarity graph to reveal dense communities of consistent-anomaly images, applying Leiden CPM-based community detection and targeted patch filtering to remove deceptive matches from anomaly scoring. Theoretical support via Extreme Value Theory explains why normal patches exhibit a power-law decay in similarity growth while consistent anomalies deviate after exhausting matches. Empirically, CoDeGraph achieves state-of-the-art performance on consistent-anomaly benchmarks (e.g., 98.5% AUROC for AC and strong segmentation gains) and remains competitive on inconsistent datasets, demonstrating robust zero-shot applicability across architectures such as ViT-L-14-336 and DINOv2.

Abstract

Zero-shot image anomaly classification (AC) and segmentation (AS) are vital for industrial quality control, detecting defects without prior training data. Existing representation-based methods compare patch features with nearest neighbors in unlabeled test images but struggle with consistent anomalies -- similar defects recurring across multiple images -- resulting in poor AC/AS performance. We introduce Consistent-Anomaly Detection Graph (CoDeGraph), a novel algorithm that identifies and filters consistent anomalies from similarity computations. Our key insight is that normal patches in industrial images show stable, gradually increasing similarity to other test images, while consistent-anomaly patches exhibit abrupt similarity spikes after exhausting a limited set of similar matches, a phenomenon we term ``neighbor-burnout.'' CoDeGraph constructs an image-level graph, with images as nodes and edges connecting those with shared consistent-anomaly patterns, using community detection to filter these anomalies. We provide a theoretical foundation using Extreme Value Theory to explain the effectiveness of our approach. Experiments on MVTec AD with the ViT-L-14-336 backbone achieve 98.3% AUROC for AC and AS performance of 66.8% (+4.2%) F1 and 68.1% (+5.4%) AP over state-of-the-art zero-shot methods. Using the DINOv2 backbone further improves segmentation, yielding 69.1% (+6.5%) F1 and 71.9% (+9.2%) AP, demonstrating robustness across architectures.

On the Problem of Consistent Anomalies in Zero-Shot Industrial Anomaly Detection

TL;DR

This work tackles the difficulty of consistent anomalies in zero-shot industrial anomaly detection by introducing CoDeGraph, a graph-based framework that exploits neighbor-burnout in patch-level similarity. The method defines an endurance-ratio metric and constructs an anomaly-similarity graph to reveal dense communities of consistent-anomaly images, applying Leiden CPM-based community detection and targeted patch filtering to remove deceptive matches from anomaly scoring. Theoretical support via Extreme Value Theory explains why normal patches exhibit a power-law decay in similarity growth while consistent anomalies deviate after exhausting matches. Empirically, CoDeGraph achieves state-of-the-art performance on consistent-anomaly benchmarks (e.g., 98.5% AUROC for AC and strong segmentation gains) and remains competitive on inconsistent datasets, demonstrating robust zero-shot applicability across architectures such as ViT-L-14-336 and DINOv2.

Abstract

Zero-shot image anomaly classification (AC) and segmentation (AS) are vital for industrial quality control, detecting defects without prior training data. Existing representation-based methods compare patch features with nearest neighbors in unlabeled test images but struggle with consistent anomalies -- similar defects recurring across multiple images -- resulting in poor AC/AS performance. We introduce Consistent-Anomaly Detection Graph (CoDeGraph), a novel algorithm that identifies and filters consistent anomalies from similarity computations. Our key insight is that normal patches in industrial images show stable, gradually increasing similarity to other test images, while consistent-anomaly patches exhibit abrupt similarity spikes after exhausting a limited set of similar matches, a phenomenon we term ``neighbor-burnout.'' CoDeGraph constructs an image-level graph, with images as nodes and edges connecting those with shared consistent-anomaly patterns, using community detection to filter these anomalies. We provide a theoretical foundation using Extreme Value Theory to explain the effectiveness of our approach. Experiments on MVTec AD with the ViT-L-14-336 backbone achieve 98.3% AUROC for AC and AS performance of 66.8% (+4.2%) F1 and 68.1% (+5.4%) AP over state-of-the-art zero-shot methods. Using the DINOv2 backbone further improves segmentation, yielding 69.1% (+6.5%) F1 and 71.9% (+9.2%) AP, demonstrating robustness across architectures.

Paper Structure

This paper contains 37 sections, 6 theorems, 36 equations, 15 figures, 15 tables, 2 algorithms.

Key Result

Theorem 3.1

Under the assumptions of our model, the similarity growth rate $\tau^{(i)}(x)$ for a normal patch $x$ at neighbor index $i$ is exponentially distributed: where $\alpha$ is the tail index of the underlying similarity distribution. Consequently, the expectation and variance decay with the neighbor index $i$ are The full derivation and formal statement are provided in Appendix sec:growth-rate.

Figures (15)

  • Figure 1: Illustration of zero-shot anomaly detection's consistent-anomaly problem. Industrial images have normal patches (blue squares) that match nearly all test images. Scratches and other random anomalies have high anomaly scores since they fail to find similar matches across the test set. Defects from consistent-anomaly images (flipped metal nuts) easily find deceptive matches within the images (orange region) sharing the same anomaly pattern (rotate counter-clockwise instead of clockwise).
  • Figure 2: Overview of CoDeGraph.
  • Figure 3: Log-log plots of avg. growth rate $\tau^{(i)}(x)$. While normal patches and inconsistent anomalies in the Cable of MVTec AD show power-law decay in the growth rate, consistent anomalies show neighbor-burnout with a sudden rise (orange) in $\tau^{(i)}(x)$ after exhausting similar matches. All patches in Capsule, which has a minimum presence of consistent anomalies, exhibit power-law decay in the growth.
  • Figure 4: Distributions of $\zeta(x, I_{(i)})$ and $d(x, I_{(i)})$ for $i<\omega$ across patch types on cable. (a) The endurance ratio provides clear domination at the tail, with consistent-anomaly patches exhibiting significantly lower $\zeta$, enabling robust identification of suspicious links. (b) Absolute distances $d(x, I)$ show overlapping distributions between normal patches and consistent anomalies, making discrimination challenging.
  • Figure 5: Anomaly similarity graphs on MVTec AD subclasses showing top three communities by density. (a) Metal_Nut: Community #1 contains all 23 flipped metal nuts with exceptionally high density, exceeding the IQR threshold. (b) Screw: Nodes are clustered into distinct communities, but none exhibit exceptionally high density.
  • ...and 10 more figures

Theorems & Definitions (13)

  • Definition 3.1: $\epsilon$-consistent
  • Definition 3.2: $\epsilon$-consistent-anomaly
  • Theorem 3.1: Similarity Growth Dynamics
  • Definition A.1: Normalized Distance Index
  • Lemma A.1
  • proof
  • Lemma A.2
  • proof
  • Theorem A.1: Log-Spacing of Order Statistics
  • proof
  • ...and 3 more