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.