Authors: Aggelos Psiris, Yannis Panagakis, Maria Vakalopoulou, Georgios Th. Papadopoulos
Organizations: Harokopio University of Athens, Athens, Greece · National and Kapodistrian University of Athens, Athens, Greece · Archimedes, Athena Research Center, Athens, Greece · CentraleSupelec, University Paris Saclay, Paris, France
Few-Shot Industrial Visual Anomaly Detection (FS-IVAD) comprises a critical task in modern manufacturing settings, where automated product inspection systems need to identify rare defects using only a handful of normal/defect-free training samples. In this context, the current study introduces a novel reconstruction-based approach termed GATE-AD. In particular, the proposed framework relies on the employment of a masked, representation-aligned Graph Attention Network (GAT) encoding scheme to learn robust appearance patterns of normal samples. By leveraging dense, patch-level, visual feature tokens as graph nodes, the model employs stacked self-attentional layers to adaptively encode complex, irregular, non-Euclidean, local relations. The graph is enhanced with a representation alignment component grounded on a learnable, latent space, where high reconstruction residual areas (i.e., defects) are assessed using a Scaled Cosine Error (SCE) objective function. Extensive comparative evaluation on the MVTec AD, VisA, and MPDD industrial defect detection benchmarks demonstrates that GATE-AD achieves state-of-the-art performance across the 1- to 8-shot settings, combining the highest detection accuracy (increase up to 1.8% in image AUROC in the 8-shot case in MPDD) with the lowest per-image inference latency (at least 25.05% faster), compared to the best-performing literature methods. In order to facilitate reproducibility and further research, the source code of GATE-AD is available at https://github.com/gthpapadopoulos/GATE-AD.
Figures & tables
Figure 1: General architecture of the proposed masked, representation-aligned GAT encoding scheme for FS-IVAD.
Method
MVTec AD
VisA
MPDD
Image
Pixel
Image
Pixel
Image
Pixel
AUROC
mAP
AUROC
PRO
AUROC
mAP
AUROC
PRO
AUROC
mAP
AUROC
PRO
1-shot
SPADE [ 4 ] (arXiv’20)
82.9 ± 2.6
91.7 ± 1.2
92.0 ± 0.3
85.7 ± 0.7
80.7 ± 5.0
82.3 ± 4.3
96.2 ± 0.4
85.7 ± 1.1
-
-
-
-
PatchCore [ 23 ] (CVPR’22)
83.4 ± 3.0
92.2 ± 1.5
92.0 ± 1.0
79.7 ± 2.0
79.9 ± 2.9
82.8 ± 2.3
95.4 ± 0.6
80.5 ± 2.5
-
-
-
-
GraphCore [ 30 ] (ICLR’23)
89.9
-
95.6
-
-
-
-
-
84.7
-
95.2
-
Table 1: FS-IVAD detection results on the MVTec AD, VisA, and MPDD benchmarks. Methods with an asterisk (*) use the standardized sample selection process (Seed: 0 ).
Figure 2: Indicative 1 -shot defect detection results. GATE-AD localizes more accurately and robustly defects, across multiple pose, placement, and abnormality type settings.
MVTec AD
VisA
MPDD
Shot–Method
I-AUROC
P-AUROC
I-AUROC
P-AUROC
I-AUROC
P-AUROC
1-shot
GATE-AD
97.7 ± 0.2
96.3 ± 0.1
93.5 ± 0.2
97.7 ± 0.1
84.3 ± 1.1
97.4 ± 0.2
GATE-AD (GCN)
97.3 ± 0.2
95.9 ± 0.2
92.7 ± 0.4
97.4 ± 0.1
82.1 ± 0.9
95.7 ± 0.1
TE
97.1 ± 0.2
95.7 ± 0.1
93.4 ± 0.2
97.5 ± 0.1
82.4 ± 0.9
96.3 ± 0.1
GATE-AD w/o RA
94.1 ± 0.5
95.1 ± 0.1
80.5 ± 0.3
96.0 ± 0.2
55.7 ± 1.1
94.4 ± 0.4
Table 2: FS-IVAD ablation study on the MVTec AD, VisA, and MPDD benchmarks.
Figure 3: FS-IVAD detection performance (image-level AUROC) versus per-image inference time (ms), under the 1 -shot setting on the MVTec AD benchmark.
Appendix figures & tables18 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 4: Effect of the input image resolution on the MVTec AD and VisA benchmarks.
Figure 5: Effect of the backbone on the MVTec AD, VisA, and MPDD benchmarks.
Figure 6: Effect of the number of last transformer layers on the MVTec and VisA benchmarks.
Figure 7: Effect of the number of attentional layers on the MVTec AD and VisA benchmarks.
Figure 8: Effect of the cardinality of the GAT layers on the MVTec AD and VisA benchmarks.
Figure 9: Effect of the cardinality of the latent representation on the MVTec AD and VisA benchmarks.
Figure 10: Effect of the objective function on the MVTec AD and VisA benchmarks.
Figure 11: Effect of the masking ratio on the MVTec and VisA benchmarks.
Figure 12: Effect of the dropout rate ablation on the MVTec and VisA benchmarks.
Figure 13: Effect of the anomalous patches ratio on the MVTec AD and VisA benchmarks.
Object
1-shot
2-shot
4-shot
8-shot
GATE-AD
AnomalyDINO
GATE-AD
AnomalyDINO
GATE-AD
AnomalyDINO
GATE-AD
AnomalyDINO
Image AUROC (%)
Bottle
100.0 ± 0.0
99.7 ± 0.2
99.8 ± 0.1
99.9 ± 0.1
100.0 ± 0.0
99.9 ± 0.1
100.0 ± 0.0
100.0 ± 0.0
Cable
94.7 ± 0.1
92.7 ± 0.8
95.5 ± 0.1
92.4 ± 1.1
94.3 ± 0.1
93.8 ± 0.9
95.0 ± 0.4
95.2 ± 0.3
Capsule
93.1 ± 0.1
90.2 ± 5.5
94.3 ± 0.7
89.2 ± 7.9
95.0 ± 0.9
95.8 ± 0.5
95.8 ± 0.8
95.6 ± 0.5
Carpet
99.8 ± 0.0
100.0 ± 0.0
99.9 ± 0.0
100.0 ± 0.0
99.8 ± 0.0
100.0 ± 0.0
99.9 ± 0.0
100.0 ± 0.0
Appendix
Table 3: FS-IVAD object-level detection results for GATE-AD and AnomalyDINO on the MVTec AD benchmark. Both methods use the standardized sample selection process (Seed: 0 ).
Object
1-shot
2-shot
4-shot
8-shot
GATE-AD
AnomalyDINO
GATE-AD
AnomalyDINO
GATE-AD
AnomalyDINO
GATE-AD
AnomalyDINO
Image AUROC (%)
Candle
97.8 ± 0.4
87.9 ± 0.3
97.6 ± 0.3
89.4 ± 3.0
97.5 ± 0.3
91.3 ± 2.9
97.7 ± 0.2
93.5 ± 1.2
Capsules
99.3 ± 0.3
98.4 ± 0.5
99.5 ± 0.2
98.9 ± 0.1
99.6 ± 0.2
99.2 ± 0.1
99.6 ± 0.2
99.2 ± 0.1
Cashew
95.5 ± 0.4
86.1 ± 3.6
96.1 ± 0.2
89.4 ± 3.8
98.7 ± 0.2
94.5 ± 0.7
98.6 ± 0.2
95.3 ± 0.6
Chewing gum
98.8 ± 0.2
98.0 ± 0.4
99.1 ± 0.1
98.6 ± 0.4
99.3 ± 0.1
98.8 ± 0.2
99.4 ± 0.1
98.8 ± 0.2
Appendix
Table 4: FS-IVAD object-level detection results for GATE-AD and AnomalyDINO on the VisA benchmark. Both methods use the standardized sample selection process (Seed: 0 ).
Object
1-shot
2-shot
4-shot
8-shot
GATE-AD
AnomalyDINO
GATE-AD
AnomalyDINO
GATE-AD
AnomalyDINO
GATE-AD
AnomalyDINO
Image AUROC (%)
Bracket black
83.7 ± 3.0
51.0 ± 6.5
83.4 ± 2.0
59.4 ± 8.0
80.9 ± 2.0
64.2 ± 8.1
85.7 ± 0.6
69.5 ± 2.7
Bracket brown
49.7 ± 1.9
52.0 ± 4.6
51.7 ± 1.3
56.8 ± 4.4
56.1 ± 2.1
58.6 ± 1.2
57.0 ± 2.0
61.3 ± 2.8
Bracket white
80.8 ± 3.3
70.8 ± 2.3
81.1 ± 2.2
72.0 ± 2.8
81.0 ± 1.9
65.7 ± 16.7
93.3 ± 1.7
72.5 ± 20.1
Connector
93.8 ± 1.0
80.6 ± 4.1
91.8 ± 0.8
83.1 ± 3.8
89.4 ± 1.0
83.7 ± 1.7
93.6 ± 1.3
87.9 ± 3.1
Appendix
Table 5: FS-IVAD object-level detection results for GATE-AD and AnomalyDINO on the MPDD benchmark. Both methods use the standardized sample selection process (Seed: 0 ).
Figure 14: Indicative 1 -shot defect detection results on the MVTec AD benchmark.
Figure 15: Indicative 1 -shot defect detection results on the VisA benchmark.
Figure 16: Indicative 1 -shot defect detection results on the MPDD benchmark.
Figure 17: Indicative examples of defect detection failure cases across the MVTec AD, VisA, and MPDD benchmarks.
MVTec AD
VisA
MPDD
Method
Training
Inference
Training
Inference
Training
Inference
GATE-AD
6.7 ± 0.9
0.03 ± 0.00
7.8 ± 0.9
0.04 ± 0.00
4.8 ± 0.6
0.03 ± 0.00
GATE-AD (GCN)
9.0 ± 3.5
0.03 ± 0.00
10.4 ± 3.4
0.04 ± 0.00
4.4 ± 0.3
0.03 ± 0.00
TE
62.9 ± 16.1
0.04 ± 0.00
83.1 ± 23.4
0.06 ± 0.00
46.6 ± 10.0
0.05 ± 0.00
GATE-AD w/o RA
25.4 ± 4.0
0.04 ± 0.00
28.4 ± 3.9
0.05 ± 0.00
14.8 ± 0.3
0.04 ± 0.00
GATE-AD AE
16.1 ± 6.5
0.04 ± 0.00
19.0 ± 6.7
0.05 ± 0.00
18.6 ± 1.3
0.04 ± 0.00
Appendix
Table 6: Per-image training and inference time (ms) on the MVTec AD, VisA, and MPDD benchmarks.