Organizations: Department of Engineering, University of Fukui, 3-9-1 Bunkyo, Fukui-city, 910-8507, Japan · Graduate School of Science and Engineering, University of Toyama, 3190 Gofuku, Toyama-city, 930-8555, Japan · Faculty of Engineering, University of Fukui, 3-9-1 Bunkyo, Fukui-city, 910-8507, Japan · Faculty of Engineering, University of Toyama, 3190 Gofuku, Toyama-city, 930-8555, Japan
Logical anomaly detection in industrial inspection remains challenging due to variations in visual appearance (e.g., background clutter, illumination shift, and blur), which often distract vision-centric detectors from identifying rule-level violations. However, existing benchmarks rarely provide controlled settings where logical states are fixed while such nuisance factors vary. To address this gap, we introduce VID-AD, a dataset for logical anomaly detection under vision-induced distraction. It comprises 10 manufacturing scenarios and five capture conditions, totaling 50 one-class tasks and 10,395 images. Each scenario is defined by two logical constraints selected from quantity, length, type, placement, and relation, with anomalies including both single-constraint and combined violations. We further propose a language-based anomaly detection framework that relies solely on text descriptions generated from normal images. Using contrastive learning with positive texts and contradiction-based negative texts synthesized from these descriptions, our method learns embeddings that capture logical attributes rather than low-level features. Extensive experiments demonstrate consistent improvements over baselines across the evaluated settings. The dataset is available at: https://github.com/nkthiroto/VID-AD.
Figures & tables
Figure 1: Example results from the Tools scenario in VID-AD. The top row (green border) shows a Normal Sample, and the bottom row (blue border) shows a Logical Anomaly where a screw is missing. From left to right, we present the Input Image, Anomaly Map, and Detected Anomaly, where red highlighted areas indicate regions classified as anomalous based on a detection threshold. EfficientAD [ 3 ] produces strong anomaly responses even for the Normal Sample, resulting in false positives; it also fails to clearly localize the missing screw in the Logical Anomaly case.
Figure 2: Overview of VID-AD. Columns correspond to the 10 manufacturing scenarios ( Sticks , Fruits , Tools , Cookies , Tapes , Stationery , Ropes , Blocks , Dishes , Balls ), with two representative images shown for each scenario. The first five rows correspond to the five capture conditions: White BG (default), Cable BG, Mesh BG, Blurry CD, and Low-light CD (BG: background, CD: condition). The bottom row shows logical anomaly examples for each scenario, with red boxes highlighting the anomalous regions. Each scenario is defined by a pair of logical constraints, as indicated beneath each scenario name (abbreviations: Q = Quantity, L = Length, T = Type, P = Placement, R = Relation). Each cell in the first five rows represents a one-class benchmark task defined by a scenario and a capture condition, yielding 50 tasks in total (10 scenarios × five capture conditions).
Dataset
Tasks
Image Number
VID
Anomaly Type
Normal
Anomaly
All
Structure Anomaly
Logical Anomaly
MVTec AD [ 7 ]
15
4,096
1,258
5,354
✗
✓
✗
VisA [ 47 ]
12
9,621
1,200
10,821
✗
✓
✗
Real-IAD [ 41 ]
30
99,721
51,329
151,050
✗
✓
✗
RAD [ 10 ]
4
1,144
1,224
2,368
✓
✓
✗
MVTec LOCO AD [ 6 ]
5
2,347
993
3,340
✗
✓
✓
Table 1: Comparison of VID-AD with representative anomaly detection datasets for industrial visual inspection. Tasks denotes the number of independent one-class benchmark tasks. VID indicates whether the dataset systematically introduces controlled low-level visual variations (background, illumination, blur) as separate evaluation settings while preserving the underlying logical or structural state. ✓: Satisfied. ✗: Unsatisfied.
Scenario
Aspects
Normal rule (one line)
Typical anomaly patterns (keywords)
Sticks
Q+L
Two long blue sticks and one short red stick are present.
missing/extra; long ↔ short
Fruits
Q+T
Three oranges and two kiwifruits are present.
missing/extra; wrong fruit type
Tools
Q+P
Two bolts, two washers, and two nuts are present and placed in the Left/Middle/Right bins, respectively.
missing/extra; wrong bin
Cookies
Q+R
Two yellow cookies are on the square dish and one black cookie is on the round dish.
missing/extra; wrong dish–cookie pairing
Tapes
L+T
A long green tape and a short red tape are present (length judged by the relative length of the two tapes).
long/short/similar mismatch; wrong color type
Stationery
L+P
Left bin contains a long black pencil and a long blue eraser; right bin contains a short red pencil and a short red eraser, with the eraser placed left of the pencil within each bin.
length mismatch; wrong bin/order
Table 2: Ten scenarios in VID-AD. Each scenario is defined by a pair of logical aspects and summarized with a one-line normal rule and representative anomaly patterns. Abbreviations: Q = Quantity, L = Length, T = Type, P = Placement, R = Relation; a pair such as Q+L indicates that anomalies are defined by violating either (or both) of the two aspects.
Scenario
Aspects
# Train Normal
# Test Normal
# Test Anomaly
# Single-A
# Single-B
# Dual
Sticks
Q+L
50
50
104
48
48
8
Fruits
Q+T
50
50
100
48
44
8
Tools
Q+P
50
50
110
52
50
8
Cookies
Q+R
50
50
106
50
50
6
Tapes
L+T
50
50
110
50
50
10
Stationery
L+P
50
50
110
50
50
10
Table 3: Per-scenario statistics of VID-AD reported per capture condition (i.e., per one-class task). For each scenario, we report the one-class split (train normal, test normal, test anomaly) and the anomaly breakdown into single-aspect and dual-aspect violations. Single-A and Single-B denote violations of the first and second aspect in the scenario definition, respectively (e.g., for Q+L, Single-A indicates Quantity and Single-B indicates Length).
Figure 3: Pipeline of the proposed unsupervised logical anomaly detector. For each image, a frozen Vision-Language Model (VLM) generates a single logic-focused text conditioned on a scenario-specific text prompt. During training, one contradictory negative text is synthesized from each positive text in a text-only manner, and a text encoder (BERT) is fine-tuned via contrastive learning, where dropout-augmented embeddings form the anchor–positive pair and synthesized texts serve as negatives. During inference, the test text is embedded by the fine-tuned encoder and compared with the set of training embeddings. The final normality score is computed by distance-based k- nearest-neighbor aggregation ( k=5 ), where larger values indicate more normal samples.
Method
White BG
Cable BG
Mesh BG
Low-light CD
Blurry CD
Mean ± Std
EfficientAD [ 3 ]
0.526
0.602
0.608
0.479
0.480
0.539 ± 0.057
PatchCore [ 32 ]
0.404
0.450
0.480
0.469
0.420
0.445 ± 0.029
PaDiM [ 13 ]
0.348
0.354
0.428
0.354
0.403
0.378 ± 0.032
VAE [ 1 ]
0.448
0.494
0.454
0.472
0.393
0.452 ± 0.034
AnoGAN [ 34 ]
0.489
0.548
0.492
0.474
0.468
0.494 ± 0.028
CSAD [ 19 ]
0.693
0.624
0.641
0.694
0.657
0.662 ± 0.028
Table 4: Condition-wise image-level AUROC on VID-AD (mean over 10 scenarios for each capture condition). BG: background, CD: condition. Mean ± Std denotes the mean and standard deviation across capture-condition averages.
Figure 4: Qualitative anomaly maps of CSAD on the Cookies scenario under five capture conditions. Columns correspond to White BG, Cable BG, Mesh BG, Low-light CD, and Blurry CD. Rows show, from top to bottom: a normal sample, its anomaly map, a logical anomaly, and its anomaly map. CSAD’s anomaly responses vary substantially with the capture condition, often highlighting background patterns or low-level appearance variations (e.g., repetitive textures in Mesh BG or contrast degradation in Low-light CD) in addition to the relevant objects, illustrating the impact of vision-induced distraction on pixel-level localization.
Scenario
Sticks
Fruits
Tools
Cookies
Tapes
Stationery
Ropes
Blocks
Dishes
Balls
EfficientAD [ 3 ]
0.164
0.032
0.087
0.176
0.028
0.148
0.048
0.050
0.098
0.142
PatchCore [ 32 ]
0.062
0.115
0.128
0.098
0.167
0.133
0.063
0.159
0.022
0.152
PaDiM [ 13 ]
0.039
0.025
0.025
0.005
0.102
0.058
0.047
0.072
0.065
0.106
VAE [ 1 ]
0.071
0.059
0.112
0.085
0.034
0.106
0.130
0.172
0.017
0.100
AnoGAN [ 34 ]
0.149
0.050
0.116
0.111
0.077
0.171
0.110
0.049
0.074
0.172
CSAD [ 19 ]
0.047
0.037
0.052
0.143
0.028
0.232
0.142
0.090
0.038
0.228
Table 5: Scenario-wise sensitivity measured as the standard deviation of AUROC across the five capture conditions for each scenario and method. The smallest standard deviation is highlighted in bold .
Figure 5: Scenario-wise sensitivity of the proposed method across capture conditions on VID-AD. For each scenario, dots show the AUROC under each of the five capture conditions (see legend), the vertical bar indicates the min–max range, and the diamond marker denotes the mean across conditions.
Scenario
Condition
Image
Positive text
Correct
Fruits
White BG
There are three oranges and two kiwis. The total number of items is five.
✓
Cable BG
Same as White BG.
✓
Mesh BG
Same as White BG.
✓
Low-light CD
Same as White BG.
✓
Blurry CD
Same as White BG.
✓
Sticks
White BG
There are three objects in the image. One is a red cylinder, and two are blue rectangles. The shorter blue rectangle is compared to the longer blue rectangle.
✗
Table 6: Qualitative examples of VLM-generated positive texts under vision-induced distraction. We contrast a stable scenario ( Fruits ) and a challenging scenario ( Sticks ), selected based on scenario-wise mean AUROC and condition-wise variability. For brevity, when the generated text is identical across conditions, we show it once and denote the remaining cells as “Same as White BG.” Correct indicates whether the generated text preserves the rule-relevant attributes of the scenario, based on our attribute checklist (e.g., quantity/type for Fruits and quantity/relative length for Sticks ).
VLM
White BG
Cable BG
Mesh BG
Low-light CD
Blurry CD
Mean ± Std
Qwen2 7B [ 38 ]
0.825
0.811
0.848
0.842
0.826
0.831 ± 0.013
Llama3.2 11B [ 27 ]
0.853
0.835
0.861
0.769
0.793
0.822 ± 0.036
LLaVA 13B [ 26 ]
0.741
0.680
0.739
0.689
0.655
0.701 ± 0.034
Table 7: Ablation on the choice of the Vision-Language Model (VLM) used for generating one positive text description per image and one corresponding negative text per positive example. For compactness, we use abbreviations in the table: Qwen2 7B = Qwen2-7B-Instruct, Llama3.2 11B = Llama-3.2-11B-Vision-Instruct, and LLaVA 13B = LLaVA-v1.5-13B. Results are reported as mean AUROC over the 10 scenarios under each capture condition. Mean ± Std denotes the mean and standard deviation across capture-condition averages.
Detectors of logical anomalies, such as missing, extra or wrongly combined parts, usually score a test image by its distance from normal (good) images. They achieve near-perfect image-level AUROC on standard industrial anomaly detection benchmarks such as MVTec LOCO, but their robustness to changes in capture conditions remains largely unexamined. Under a heterogeneous perturbation protocol in which each test image is randomly kept unaltered or subjected to a brightness reduction or a zoom-out transformation, the normal-reference methods we tested lose 9.7 to 34.1 AUROC points, and two of the strongest, CSAD and SALAD, fall from 97.7% and 96.4% to 68.1% and 62.3%. We propose a framework in which a classifier, trained on normal images and on synthetic anomalies, scores a test image without comparing it with normal data. From a short description of each product, a language model derives anomaly types and editing instructions, an image editor applies them to normal images, and the classifier learns to separate the edited images from automatically discovered normal sub-modes. With its full training recipe, the framework reaches 94.9% AUROC on clean images, 1.5 to 2.8 points below SALAD and CSAD, and 94.1% under the perturbation protocol. Trained without brightness or zoom-out augmentation, so that neither test perturbation occurs in training, it still reaches 92.5% (93.2% clean). These results suggest that clean benchmark scores can hide a strong sensitivity to capture conditions, and that learning the decision from both normal images and rule violations may reduce it.
Ufuk Efe, Alptekin Temizel
Graduate School of Informatics, Middle East Technical University, Üniversiteler Mahallesi, Dumlupınar Bulvarı No:1, Ankara, 06800, Türkiye
Visual anomaly detection is a fundamental task in industrial automation. While existing approaches have achieved notable progress in identifying structural defects, the detection of logical anomalies remains relatively underexplored. In practice, structural and logical anomalies frequently co-occur in industrial workflows. Therefore, a solution capable of detecting both structural and logical anomalies is crucial for advancing comprehensive anomaly detection research. To address this limitation, we propose a unified framework, termed UniSLAD, which jointly addresses logical and structural anomalies without additional training, enabling a practical solution for dynamic industrial environments. First, we introduce a dual-feature extractor that synergistically integrates a Convolutional Neural Network (CNN) backbone for local texture perception with a Transformer backbone for global contextual reasoning, yielding richer and more comprehensive representations. Building on this foundation, we design dual-granularity feature representation modules. At the patch level, memory banks enhanced by the Mahalanobis Transform (MT) preserve representative features and support more discriminative anomaly scoring. At the image level, distribution maps are aggregated using Lower-Upper Mean (LUM) and Power Mean Pooling (PMP), yielding a more robust global representation than conventional average pooling. Extensive experiments on the two industrial benchmarks demonstrate that UniSLAD achieves competitive performance in comprehensive anomaly detection, achieving 99.4% and 93.1%, respectively. Furthermore, ablation studies verify the individual contributions and effectiveness of each proposed component.
Few-shot anomaly detection (FSAD) has recently benefited from vision-language models such as CLIP, which enable anomaly de?tection by aligning visual features with text descriptions of normal and abnormal states. However, existing methods typically rely on static text prompts that are applied uniformly across the entire feature hierarchy and spatial dimensions. This rigid global-to-local matching fails to capture the highly localized and scale-dependent physical variations of industrial defects. To address this, we propose DriftAD, a FSAD framework built on three key modules. First, an Anomaly Signal Amplification (ASA) module enhances subtle defect signals through spatial and frequency branches before text-visual matching. Second, Visually-Guided Text Drift (VGTD) dynamically transforms frozen CLIP text embeddings, steering them into layer?wise, spatially-adaptive anomaly descriptors conditioned on local visual context at each encoder depth. Third, Drift-Guided Spatial Gating (DGSG) uses the drifted abnormal descriptor as a spatial probe to selectively enhance anomaly-relevant visual features. Addi?tionally, a drift separation loss prevents representational collapse of the drifted descriptors, and a gate supervision loss enforces spatially discriminative gating in DGSG. Extensive experiments on MVTec?AD and VisA demonstrate state-of-the-art performance across all 1-, 2-, and 4-shot settings on both image-level and pixel-level metrics. Code is available at https://github.com/wenyang001/DriftAD.
Wenyang Liu, Tianyi Liu, Dongshuo Zhang +2
Nanyang Technological University Singapore · Huazhong University of Science and Technology, Wuhan, China