Source-linked AI summary

Focus and Supplement: Dual-Enhanced Vision Transformer for Multi-Class Anomaly Classification

Xurui Li, Enjie Xu, Chenzhou Li, Shilei Zeng, Dayou Huang, Tianyi Ma, Yu Zhou

arXiv:2609.33353v1cs.CV

TL;DR

Multi-class anomaly classification is challenged by noisy or incomplete representations and unknown anomaly classes. MACO combines anomaly-focused and auxiliary-token representations with class-number estimation, achieving state-of-the-art performance on MVTec AD and MTD under known and unknown class-number settings.

  • Problem

    Multi-class anomaly classification is challenging because anomaly representations can be noisy or incomplete and real-world production may contain unknown anomaly types.

    Source: §1 · p. 1
  • Method

    MACO combines soft-focused attention and auxiliary classification tokens in DE-ViT with correlation-based class-number estimation using labeled-class prototypes.

    Source: §1 · pp. 1–2
  • Results

    MACO achieves state-of-the-art performance on MVTec AD and MTD under known and unknown class-number settings, with an 11.2% NMI gain on MTD in the unknown-number setting.

    Source: §1 · p. 2, §6 · p. 7
  • Takeaways & Limitations

    MACO estimates class number with lower overhead while addressing multi-class anomaly classification on MVTec AD and MTD.

    Source: §6 · p. 7

    The evaluation is framed around two settings: the novel class number is known a priori or unknown.

    Source: Problem Definition · p. 2

Abstract

from arXiv · show

Multi-class anomaly classification in industrial vision remains challenging due to noisy/incomplete anomaly representations and the unknown number of anomaly classes. To overcome this, we propose MACO, a novel multi-class anomaly classification framework that learns comprehensive representations and dynamically estimates class number without prior knowledge. First, a soft-focus attention uses anomaly maps to concentrate on relevant abnormal regions, while suppressing background noise. Second, auxiliary classification ([A-CLS]) tokens complement the [CLS] token. They collectively attend to diverse anomaly sub-regions, yielding more holistic and discriminative features. These [A-CLS] tokens are also effective across more tasks and domains. To infer the class number, we propose Correlation-based Number Estimation strategy. It computes the average correlation among labeled classes and transfers its separability cue to the unlabeled set. Experiments on MVTec AD and MTD datasets demonstrate our superiority. Under known class number, MACO improves ARI by 6.5% and $\textbf{16.3%}$ on both datasets, respectively. In the more challenging unknown number scenario, it achieves an $\textbf{11.2%}$ NMI gain on MTD and outperforms existing number estimation strategies by $\textbf{24.1%}$ UPS on MVTec AD. Code will be released at https://github.com/HUST-SLOW/MACO.

1 Introduction

Industrial anomaly inspection needs fine-grained anomaly classes for applications such as root-cause analysis and process optimization, but existing methods face noisy or incomplete representations and often require a preset class count. MACO combines enhanced anomaly representations with class-number estimation and reports gains on MVTec AD and MTD.

1 Introduction

  • Industrial anomaly classification distinguishes fine-grained anomaly classes, supporting applications such as root-cause analysis and process optimization.The task is especially challenging when anomaly types are unknown in real-world production.Source: §1 · p. 1
  • MACO addresses noisy and incomplete anomaly representations and unknown class counts with enhanced features and a Correlation-based Number Estimation strategy.The strategy computes average correlations among labeled classes and transfers their separability cue to the unlabeled set.Source: §1 · p. 1
  • 6.5% and 16.3% ARI improvements are reported with a known class number, respectively, and the unknown-number setting yields an 11.2% NMI gain on MTD.For class-number estimation, MACO improves UPS by 24.1% and 40% on the two datasets.Source: §1 · p. 2
  • DE-ViT combines soft-focused attention with Auxiliary Classification Tokens to extract discriminative, comprehensive anomaly representations.The tokens collectively attend to diverse abnormal sub-regions, complementing the [CLS] token.Source: §1 · p. 2

2 Related Work

Related work covers clustering- and Novel Class Discovery-based approaches to multi-class anomaly classification, limitations of single-token ViT representations, and strategies for estimating unknown class counts.

2.1 Multi-class Anomaly Classification

  • Clustering approaches use anomaly-weighted feature aggregation or select high-scoring patch features, while NCD methods have shifted toward one-stage use of labeled and unlabeled data.Industrial approaches include mask-guided attention, which requires binarizing anomaly maps and can propagate missed detections into misclassification.Source: Clustering-based methods · p. 2, NCD-based methods · p. 2

2.2 [CLS] token of vision transformer

  • Auxiliary Classification Tokens supplement the [CLS] token with anomaly-specific cues to represent diverse anomaly patterns more comprehensively.The cited discussion says [CLS] can overfit dominant features and overlook subtle inter-anomaly distinctions.Source: §2.2 · p. 2

2.3 Estimating the class number

  • Existing class-number estimators use clustering metrics, split-and-merge procedures, candidate refinement, protoscores, or labeled-class accuracy, often at substantial computational cost.MACO instead uses labeled-class prototypes to estimate inter-prototype gaps among unlabeled classes.Source: §2.3 · p. 2

3 Preliminary

The preliminary setup considers labeled anomaly images and unlabeled images containing novel anomalies, with the number of novel classes either known or unknown. It also outlines the NCD training framework and ViT self-attention used as methodological background.

3 Preliminary

  • The task categorizes unlabeled images into novel classes, under settings where the novel-class count is known a priori or unknown.The setup uses labeled anomaly images and an unlabeled set containing novel anomalies.Source: Problem Definition · p. 2
  • The described NCD framework combines supervised and self-supervised contrastive learning with ground-truth and pseudo-label classification losses, plus mean-entropy regularization.A teacher generates pseudo-labels for unlabeled images, while the student classifies all images.Source: Novel Class Discovery · pp. 2–3
  • ViT self-attention computes dependencies among patch tokens through an attention map.The framework pipeline then extracts anomaly features with DE-ViT, classifies them using a linear classifier with Orthogonal Weight Loss, and estimates an unavailable class count with Correlation-based Number Estimation.Source: Self-attention · p. 3, Figure 2 · p. 3

4 Method

MACO combines anomaly-focused features with a strategy for estimating unknown anomaly-class counts. Its DE-ViT uses focused attention and auxiliary tokens, while prototype-based losses and correlations support class separation and count estimation.

4 Method

  • The framework combines DE-ViT anomaly features, orthogonal weight loss, and correlation-based class-number estimation for multi-class anomaly classification.The Under-estimation Penalized Score evaluates estimated class counts with asymmetric penalties.Source: §4 · p. 3

4.1 Soft-focused Attention

  • Soft-focused attention uses anomaly maps to guide the [CLS] token toward likely anomaly regions, reducing background interference without discarding lower-probability regions.Unlike binary mask-guided attention, continuous maps can retain regions with potential anomalies.Source: §4.1 · pp. 3–4

4.2 Auxiliary Classification Tokens

  • Auxiliary [A-CLS] tokens complement [CLS] by attending to different anomaly regions, including missed regions, producing more complete representations.[ac1] tokens use anomaly-map guidance, while unguided [ac2] tokens can discover regions missed by the map.Source: §4.2 · pp. 4–5

4.3 Orthogonal Weight Loss

  • Orthogonal weight loss constrains classifier prototypes to remain separated in feature space, encouraging inter-class separation from a prototype perspective.The loss operates on classifier parameters; W represents prototypes for labeled and unlabeled classes.Source: §4.3 · p. 5

4.4 Correlation-based Number Estimation

  • Correlation-based Number Estimation transfers the average labeled-prototype correlation threshold to unlabeled prototypes to dynamically refine an initially overestimated class count.It selects prototypes by minimum maximum similarity to those already selected, stopping when that similarity exceeds the labeled-class threshold.Source: §4.4 · p. 5

4.5 Under-estimating Penalized Score

  • The Under-estimation Penalized Score assigns asymmetric penalties because underestimating classes can merge distinct anomaly types, while overestimation mainly increases manual verification.The desired score is 1 for an exact count, rises monotonically as an underestimate approaches the true count, and decreases monotonically for overestimates.Source: §4.5 · p. 6

5 Experiments

On MVTec AD and MTD, MACO is evaluated with known and unknown unlabeled class counts, and its attention, auxiliary-token, and loss components are ablated.

5.1 Experimental Setting

5.2 Comparison with the State-of-the-Arts

5.3 Ablation Study

  • Against mask-guided attention, soft-focus reduces binarization-error propagation; missed-detection rates reach 16.02% on MVTec AD and 40.46% on MTD, while ARI increases 2.6% and 18.3%, respectively.Source: Discussion of the soft-focus attention · p. 7
  • Using both [ac1] and [ac2] yields the best overall performance across most metrics, though [ac2] alone slightly improves some metrics when anomaly maps misguide [ac1].The tokens are also reported as applicable to other visual and non-visual tasks.Source: Table 4 · p. 7, Effectiveness of [A-CLS] tokens · p. 7
  • Soft-focused attention shifts [CLS] toward true-positive regions; guided [ca1] covers other true positives, while unguided [ca2] attends more to false negatives.The authors link this complementary coverage to visible and missed anomalies.Source: Table 5 · p. 7, Discussion of anomaly attention… · p. 7
  • The [A-CLS] tokens are also reported as applicable to other visual and non-visual tasks.Source: Effectiveness of [A-CLS] tokens · p. 7
  • On MTD, Lac improves F1 by 0.5% and Low raises ARI by 1.1%, while Low decreases NMI by 0.2%.The authors attribute the NMI decrease to reduced clustering flexibility when visually similar anomaly classes overlap.Source: Table 6 · p. 7, Effect of Lac and Low · p. 7

6 Conclusion

MACO addresses noisy and incomplete anomaly representations and unknown class counts with soft-focus attention, auxiliary classification tokens, and correlation-based number estimation. Experiments on MVTec AD and MTD show state-of-the-art performance with known and unknown class counts.

  • MACO addresses noisy and incomplete anomaly representations and unknown class counts using soft-focus attention, Auxiliary Classification Tokens, and Correlation-based Number Estimation.Source: §6 · p. 7
Loading 2609.33353v1…