Source-linked AI summary

Industrial Anomaly Detection with Domain Shift: A Real-world Dataset and Masked Multi-scale Reconstruction

Zilong Zhang, Zhibin Zhao, Xingwu Zhang, Chuang Sun, Xuefeng Chen

arXiv:2304.02216v2cs.CV

TL;DR

Existing IAD datasets overlook shifts between training and test normal-sample domains. The paper introduces the AeBAD blade dataset and masked multi-scale reconstruction (MMR); MMR outperforms SOTA methods on AeBAD and is competitive on MVTec AD.

  • Problem

    Existing IAD datasets overlook domain shifts between training and test sets, leaving performance under more complex real-world conditions uncertain.

    Source: §2.1 · p. 3
  • Method

    MMR reconstructs multi-scale features from masked inputs to enhance inference of causality among patches in normal samples.

    Source: §4.1 · p. 8, §8 · p. 15
  • Results

    MMR outperforms SOTA methods on AeBAD and is competitive with them on MVTec AD.

    Source: §1 · p. 3
  • Takeaways & Limitations

    The work points IAD evaluation toward domain-shift conditions closer to real-world industrial scenarios.

    Source: §8 · p. 15

    MMR’s two base models and memory-intensive causal module constrain practical use; its throughput is inferior to ReverseDistillation.

    Source: §7 · p. 14

Abstract

from arXiv · show

Industrial anomaly detection (IAD) is crucial for automating industrial quality inspection. The diversity of the datasets is the foundation for developing comprehensive IAD algorithms. Existing IAD datasets focus on the diversity of data categories, overlooking the diversity of domains within the same data category. In this paper, to bridge this gap, we propose the Aero-engine Blade Anomaly Detection (AeBAD) dataset, consisting of two sub-datasets: the single-blade dataset and the video anomaly detection dataset of blades. Compared to existing datasets, AeBAD has the following two characteristics: 1.) The target samples are not aligned and at different scales. 2.) There is a domain shift between the distribution of normal samples in the test set and the training set, where the domain shifts are mainly caused by the changes in illumination and view. Based on this dataset, we observe that current state-of-the-art (SOTA) IAD methods exhibit limitations when the domain of normal samples in the test set undergoes a shift. To address this issue, we propose a novel method called masked multi-scale reconstruction (MMR), which enhances the model's capacity to deduce causality among patches in normal samples by a masked reconstruction task. MMR achieves superior performance compared to SOTA methods on the AeBAD dataset. Furthermore, MMR achieves competitive performance with SOTA methods to detect the anomalies of different types on the MVTec AD dataset. Code and dataset are available at https://github.com/zhangzilongc/MMR.

1. Introduction

The paper addresses the gap between real-world blade inspection and IAD datasets that underrepresent variation in scale, alignment, and normal-sample domains. It introduces AeBAD and masked multi-scale reconstruction (MMR), reporting strong AeBAD performance and competitive MVTec AD results.

1. Introduction

  • Because abnormal samples are difficult to collect, IAD is typically one-class, while existing datasets largely use aligned samples at consistent scales.The paper questions whether methods succeed under more complex real-world conditions.Source: §1 · p. 1
  • AeBAD contains single-blade images and blade videos, with unaligned, differently scaled samples and normal-sample domain shifts mainly from illumination and view changes.The paper presents it as the first IAD dataset to account for domain shifts, to the authors’ knowledge.Source: §1 · pp. 2–3
  • Synthetic-anomaly methods falter on unaligned, differently scaled samples, while shifted normal test domains raise normal-region scores across methods and produce many false positives.The authors associate the latter with mismatches between training and test normal-sample features in methods that model the training distribution.Source: §1 · p. 2
  • MMR reconstructs multi-scale features of full images from masked inputs, aiming to improve the model’s inference of causality among patches in normal samples.The method avoids synthetic anomalies and completely hides masked parts rather than sharing their features with visible parts.Source: §1 · pp. 2–3
  • MMR achieves superior performance to SOTA methods on AeBAD and competitive performance on MVTec AD.The reported comparison also describes reduced false positives and boosted anomaly detection performance on AeBAD.Source: §1 · p. 3

2. Related Work

The review covers IAD datasets and one-class methods, then highlights domain shift as a dataset gap and distinguishes MMR’s multi-scale, fully hidden-mask reconstruction from related approaches.

2. Related Work

  • The review covers IAD datasets and one-class IAD methods, while excluding methods and datasets for semantic anomalies.Source: §2 · p. 3, §2.2 · p. 3

2.1. Datasets

  • Existing IAD datasets such as MVTec AD, VisA, and MVTec LOCO AD overlook train–test domain shift, while AeBAD includes shifts in view and illumination.The review notes that MVTec AD objects are roughly aligned.Source: §2.1 · p. 3

2.2. Methods

  • One-class IAD methods use normal-pattern matching, synthetic-anomaly discrimination, or reconstruction; unlike related inpainting methods, MMR reconstructs multi-scale features and fully hides masked regions.Examples include PaDiM and PatchCore for matching, CutPaste and DRAEM for synthetic anomalies, and RIAD and InTra for masked inpainting.Source: §2.2 · pp. 3–5

3. Aero-engine Blade Anomaly Detection Dataset

AeBAD was designed to reflect blade-inspection conditions that existing datasets may not capture, including variation in view, illumination, scale, and alignment. Its evaluation highlights false positives and missed defects among current methods under these conditions.

3.1. Background and Significance

  • AeBAD addresses real inspection conditions in which blade images vary in view and illumination, motivating one-class anomaly detection under test-set domain shift.Blade images may come from unknown borehole locations, and blade samples are costly and infrequent.Source: §3.1 · p. 5

3.2. Description of The Dataset

  • AeBAD pairs single-blade images with multi-blade videos; its training set contains normal samples, while test sets contain normal and abnormal samples.The dataset includes breakdown, ablation, groove, and fracture defects.Source: §3.2 · pp. 5–6

3.3. Deficiencies of The Current Methods

  • Figure 5 contrasts these errors with MMR, which detects anomalies while reducing false positives under domain shift.Its heatmaps show PatchCore and ReverseDistillation misclassifying normal regions and DRAEM and NSA missing smaller defects.Source: Figure 5 · p. 6

3.2. Description of The Dataset

  • AeBAD-S varies scale, alignment, background, illumination, and view; its test categories isolate same-domain, background, illumination, and view conditions.AeBAD-V videos use test viewpoints different from the training viewpoints, with multiple blades in each image.Source: Figure 4 · p. 5, §3.2 · p. 6

3.3. Deficiencies of The Current Methods

  • Under domain shifts, synthetic-anomaly methods may miss defects, while matching methods may label normal regions abnormal, producing false negatives and false positives, respectively.The authors link these shortcomings to synthetic anomalies falling mainly in backgrounds of unaligned, differently scaled samples and to training–test normal-feature mismatch.Source: §3.3 · p. 7

4. Masked Multi-scales Reconstruction

MMR reconstructs multi-scale features from masked image patches and aligns them with features from a frozen encoder. Its masked prediction is intended to capture spatial dependencies among normal patches, while its feature-level reconstruction and masking design distinguish it from related methods.

4.1. Details of MMR

  • MMR masks image patches, encodes visible patches with a ViT, appends learned-in-training masked embeddings, and uses a simple FPN to produce multi-scale features aligned to a frozen encoder.The training objective minimizes the discrepancy between the two branches' multi-scale features.Source: §4.1 · pp. 7–8
  • At test time, MMR compares multi-scale features from the full image; it sums the upsampled scale maps into an anomaly map and uses that map's maximum as the image score.The frozen encoder can represent unseen anomalies, while the normal-trained masked branch reconstructs abnormal regions poorly.Source: §4.1 · pp. 8–9
  • Predicting masked patches from visible ones models conditional relationships among normal image parts, which the authors argue remain relatively stable under domain shifts.The frozen encoder supplies multi-scale target features, while the masked branch learns to recover them from normal training samples.Source: §4.1 · pp. 8–9

4.2. Relations between MMR and Current Methods

  • Unlike pixel-level inpainting, MMR reconstructs features at multiple scales; its masked regions are fully hidden, unlike RIAD and InTra, which share masked-part features.The paper also distinguishes MMR from MAE: MMR uses masking to model normal-sample spatial dependence and reconstructs features rather than pixels.Source: §4.2 · p. 9

4.3. Implementation Details

  • The implementation uses 16×16 patches, a 0.4 masking ratio, a ViT-B backbone, and a WideResNet50 frozen hierarchical encoder.Training uses AdamW for 200 epochs with batch size 16.Source: §4.3 · pp. 9–10

5. Experiments

The experiments compare MMR with recent state-of-the-art and related methods on AeBAD-S, AeBAD-V, and MVTec, using sample- and pixel-level anomaly detection metrics. They report MMR’s behavior under domain shifts and its competitive, but suboptimal pixel-level, MVTec results.

5.1. Datasets and Comparison Methods

  • The comparisons evaluate recent SOTA and related methods on AeBAD-S and AeBAD-V; sample-level detection uses AUROC, while pixel-level evaluation uses PRO and pixel-level AUROC.The comparison methods include PatchCore, ReverseDistillation, DRAEM, NSA, RIAD, and InTra.Source: §5.1 · p. 10, §5.2 · pp. 10, 12

5.2. Results

  • MMR reduces normal-region anomaly scores under domain shifts on AeBAD-S and AeBAD-V; on MVTec, it is competitive with SOTA methods but has suboptimal pixel-level performance.On AeBAD-V, MMR also detects multiple abnormal regions; on MVTec, the authors attribute weaker pixel-level performance partly to coarser abnormal masks.Source: §5.2 · pp. 10–12, Figure 9 · p. 11, Figure 10 · p. 12
  • On AeBAD-S, pre-trained methods are robust to background and illumination changes, while view changes increase false positives for most methods; MMR lowers normal-region scores versus PatchCore and ReverseDistillation.The comparison includes anomaly-map visualizations; PatchCore and ReverseDistillation have poor AUROC on the view subset despite PRO results close to MMR’s.Source: §5.2 · p. 10, Figure 9 · p. 11
  • On unaligned AeBAD-S images, synthetic-anomaly methods can perform poorly when anomalies fall on background regions, while DRAEM may label an entire blade anomalous under light or background changes.RIAD and InTra’s pixel-level reconstruction also produces larger errors on complex details.Source: §5.2 · pp. 10–11
  • MMR’s first part avoids an identical shortcut: its test-time output differs from the frozen pre-trained hierarchical encoder and can detect tiny defects.The authors point to the Figure 5 and Figure 9 visualizations as evidence.Source: §5.2 · p. 11
  • On AeBAD-V, PatchCore and ReverseDistillation produce more false positives and DRAEM and NSA more false negatives, whereas MMR reduces normal-region scores and detects multiple abnormal regions.The reported qualitative results include Figure 10 anomaly maps.Source: §5.2 · p. 11, Table 4 · p. 11, Figure 10 · p. 12
  • On MVTec, MMR achieves results competitive with SOTA methods for different anomaly types, but its performance is weaker than on AeBAD because MVTec’s test distribution matches training.The authors also cite coarser abnormal masks than PatchCore’s as a reason for suboptimal pixel-level performance.Source: §5.2 · p. 12

6. Ablation Study

The ablations use AeBAD-S to examine input masking form, masking ratio, pre-training, encoder choice, and multi-scale features. Their findings describe how these design choices relate to performance and reconstruction.

6.1. Form of Input

  • When masking ratio is held constant, inputs with q ≤ 8 perform poorly; q = 16 improves with larger units, but remains below proposed MMR at q = 16 because leakage persists.As the smallest unit continues to increase, performance improves, mean PRO increases substantially, mean AUROC shows basically no growth, and some reconstruction details worsen.Source: §6.1 · p. 13

6.2. Masking Ratio

  • Performance is highest at middle masking ratios and lower at both ends; a smaller optimum than masked autoencoders is needed to reconstruct details relevant to tiny defects.The authors explain that high masking leaves too few visible patches for whole-image inference, while low masking allows inference from surrounding regions.Source: §6.2 · p. 14, Figure 13 · p. 14

6.3. Tpye of Pre-training

  • Training ViT from scratch on normal samples can overfit and reduce generalization, while masked-autoencoder pre-training better matches the reconstruction task and transfers representations more effectively.The comparison is reported in Table 7.Source: §6.3 · p. 14, Table 7 · p. 14

6.4. Frozen Pre-trained Hierarchical Encoder

  • MMR also generalizes well when using a pre-trained ResNet 18 hierarchical encoder.The encoder comparison uses ImageNet 1K pre-training and is reported in Table 8.Source: §6.4 · p. 14, Table 8 · p. 14

6.5. Multi-scale Features

  • Intermediate-scale features are more conducive to defect detection, while features at other scales can complement them and improve performance.The scale comparison reports mean AUROC and mean PRO in Table 9.Source: §6.5 · p. 14, Table 9 · p. 14

7. Limitations and Future Works

The authors identify memory use and dataset scope as limitations, with future work directed toward a more compact model and broader anomaly-detection scenarios.

7. Limitations and Future Works

  • MMR requires a frozen pre-trained encoder and a separate trained model for inference, consuming substantial memory and limiting practical use.Its causal transformer-based module is also memory-intensive, and its throughput is inferior to ReverseDistillation.Source: §7 · p. 14
  • Future work will explore a convolution-based causal module integrated with the pre-trained model as a single model.Source: §7 · p. 14
  • The single-object blade dataset cannot fully show model anomaly-detection capability; the authors plan to explore more practical scenarios with more defect types.Source: §7 · pp. 14–15

8. Conclusion

AeBAD addresses domain shift in industrial anomaly detection, where current state-of-the-art methods show deficiencies when normal test samples shift. The paper proposes MMR, which improves performance across different domain shifts and is competitive for detecting varied anomaly types.

8. Conclusion

  • MMR improves performance on different domain shifts and is competitive in detecting various types of anomalies.The paper presents MMR as a method that enhances the model’s ability to infer causality among patches in normal samples.Source: §8 · p. 15
  • Current state-of-the-art methods show deficiencies when the domain of normal test samples shifts.Source: §8 · p. 15
  • AeBAD addresses domain shift, which existing datasets have not fully considered.Source: §8 · p. 15
Loading 2304.02216v2…