Robust Logical Anomaly Detection under Capture Shifts via Synthetic Anomalies
Organizations: Graduate School of Informatics, Middle East Technical University, Üniversiteler Mahallesi, Dumlupınar Bulvarı No:1, Ankara, 06800, Türkiye
Abstract
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.
Figures & tables
| AnomalyAny, AnomalyVFM, MIRAGE | ComGEN | CSAD, SALAD | Ours | |
|---|---|---|---|---|
| Target anomalies | Structural | Logical and structural | Mainly logical | Logical |
| Knowledge source | Defect lists from an LLM or VLM | Component tokens learned from normal images | Components segmented in normal images | Written description of the category |
| Generation | Diffusion generation, inpainting or editing | Token removal and low-density sampling in a diffusion model | Hand-designed edits of components or maps | Instruction-based editing of normal images into anomaly types |
| Test-time decision | Detector trained on the synthetic data | Segmentation from differences to the nearest normal image | Fused scores, partly normal-reference | Classifier trained on normal images and synthetic anomalies; scores a test image without comparing it with normal data |
| Hetero- | Drop | Relative | |||
| Method | Reported | Clean | geneous | (points) | drop (%) |
| Ours (no overlap) | – | 93.2 | 92.5 | 0.7 | 1.6 |
| Ours (full recipe) | – | 94.9 | 94.1 | 0.8 | 1.8 |
| CSAD | 96.7 | 97.7 | 68.1 | 29.6 | 62.1 |
| SALAD a | 96.5 | 96.4 | 62.3 | 34.1 | 73.5 |
| LogSAD | 89.3 | 89.2 | 73.9 | 15.3 | 39.0 |
| Per- | Hetero- | Within-condition | Cross-condition | Worst | |||
| Method | Clean | condition | geneous | drop | drop | condition | |
| Ours (no overlap) | 93.2 | 92.8 | 92.5 | 0.4 | 0.3 | 91.0 | Z15 |
| Ours (full recipe) | 94.9 | 94.1 | 94.1 | 0.8 | 0.0 | 93.0 | Z15 |
| CSAD | 97.7 | 75.0 | 68.1 | 22.7 | 6.9 | 61.9 | Z15 |
| SALAD | 96.4 | 85.6 | 62.3 | 10.8 | 23.3 | 78.0 | B40 |
| LogSAD | 89.2 | 77.5 | 73.9 | 11.7 | 3.6 | 67.6 | Z10 |
| Variant | Clean | Heterogeneous |
|---|---|---|
| Ours (full recipe) | 94.9 | 94.1 |
| Without normal sub-mode discovery | 92.9 | 91.7 |
| Ours (no overlap): without test-overlapping augmentations | 93.2 | 92.5 |
Appendix figures & tables16 assets
Supplementary material from the paper’s appendix.
Appendix
| Good | Test | Synthetic | ||||||
|---|---|---|---|---|---|---|---|---|
| Category | Train | Val | Test | logical | Train | Val | Types | |
| Breakfast Box | 351 | 62 | 102 | 83 | 311 | 55 | 1 | 19 |
| Juice Bottle | 335 | 54 | 94 | 142 | 329 | 53 | 4 | 20 |
| Pushpins | 372 | 69 | 138 | 91 | 273 | 51 | 1 | 17 |
| Screw Bag | 360 | 60 | 122 | 137 | 258 | 45 | 1 | 17 |
| Splicing Connectors | 360 | 60 | 119 | 108 | 292 | 48 | 3 | 18 |
| Setting | Value |
|---|---|
| Backbone | ConvNeXt-L ( Liu et al., 2022 ) , DINOv3 LVD-1689M weights ( timm : convnext_large.dinov3_lvd1689m ; Siméoni et al., 2025 ) |
| Fine-tuning | full network, no frozen layers |
| Head | global average pooling, LayerNorm, linear layer |
| Outputs | normal sub-modes 20 anomaly types (21 outputs; Juice Bottle 24, Splicing Connectors 23); a type not used as a class keeps its output but has no training images |
| Input | resized to , ImageNet mean and standard deviation |
| Optimizer | AdamW ( Loshchilov and Hutter, 2019 ) , , , weight decay 0.05 |
| Block | Operators and ranges | |
|---|---|---|
| Flips and rotation | 0.5 each | horizontal flip, vertical flip, rotation by a multiple of |
| Zoom-out* | 0.3 | downscale by 0–15%, edge-replicate padding back to |
| Blur (one of) | 0.5 | Gaussian ( 1–5), defocus (radius 2–3), motion (kernel 3–7), zoom blur (factor up to 1.05) |
| Noise (one of) | 0.5 | per-pixel multiplicative noise (0.7–1.3), Gaussian noise (std 0.01–0.05), JPEG compression, downscaling by 0.5 |
| Photometric* (one of) | 0.5 | brightness ( to of the image mean) and contrast ( ), CLAHE (clip limit 1–4), random tone curve, sharpening |
| Color (one of) | 0.25 | emboss, posterize (4 bits) |
| ID | Anomaly type | Editing prompt |
|---|---|---|
| 1 | The tray is black. | Change the tray color to black. |
| 2 | The tray material is metal. | Change the tray material to metal. |
| 3 | The tray has three compartments. | Add a third compartment to the tray. |
| 4 | The left compartment is wider than the right compartment. | Resize the compartments so the left compartment is wider than the right compartment. |
| 5 | The left compartment contains two fruits. | Remove one fruit from the left compartment so it contains only two whole fruits. |
| 6 | The left compartment contains four fruits. | Add one extra whole fruit to the left compartment so it contains four whole fruits. |
| ID | Anomaly type | Editing prompt |
|---|---|---|
| 1 | Bottle is opaque. | Make the bottle opaque. |
| 2 | Bottle contains no juice (empty or water). | Remove the juice, leaving the bottle empty. |
| 3 | Liquid level is far below ‘nearly full’. | Lower the liquid level to well below nearly full. |
| 4 | Bottle is completely full with no headspace. | Fill the bottle to the brim, removing all headspace. |
| 5 | Headspace appears at the bottom or side. | Relocate the headspace to the bottom of the bottle. |
| 6 | Bottle has a cap attached. | Add a cap to the bottle. |
| ID | Anomaly type | Editing prompt |
|---|---|---|
| 1 | All compartments are empty; no pushpins are present in the box. | Remove all pushpins from every compartment so the entire box is empty. |
| 2 | The divider wall between two adjacent compartments is missing, merging them into one larger compartment. | Remove the divider wall between two adjacent compartments so they merge into one larger compartment. |
| 3 | The box has 15 compartments but they are not aligned into straight rows and columns. | Misalign the compartments so they are not in straight rows and columns. |
| 4 | One compartment contains no pushpin. | Remove the pushpin from one compartment leaving it empty. |
| 5 | Two compartments contain no pushpin. | Remove the pushpins from two compartments leaving them empty. |
| 6 | One compartment contains two pushpins. | Add an extra pushpin to one compartment so it contains two pushpins. |
| ID | Anomaly type | Editing prompt |
|---|---|---|
| 1 | The long screw is significantly longer than its standard length. | Make the long screw significantly longer than its standard length. |
| 2 | The long screw is significantly shorter than its standard length. | Make the long screw significantly shorter than its standard length. |
| 3 | The short screw is significantly shorter than its standard length. | Make the short screw significantly shorter than its standard length. |
| 4 | The plastic bag is torn open while all six required components remain inside it. | Tear the plastic bag open while keeping all six components inside the bag. |
| 5 | Both screws are significantly shorter than their standard lengths. | Make both screws significantly shorter than their standard lengths. |
| 6 | Exactly one nut is inside the bag. | Remove one nut so that exactly one nut remains inside the bag. |
| ID | Anomaly type | Editing prompt |
|---|---|---|
| 1 | Only one splicing connector is present. | Remove the right splicing connector so only one connector remains. |
| 2 | Two cables are present between the connectors. | Add a second cable connecting the two connectors. |
| 3 | No cable is present between the connectors. | Remove the cable so no cable is present between the connectors. |
| 4 | The cable is a color that is not used in normal samples. | Change the cable to a color that is not used in normal samples. |
| 5 | The two connectors are different types (different number of ports/levers). | Replace one connector with a connector that has a different number of ports/levers. |
| 6 | The cable color does not match the connector type. | Change the cable to a color that does not match the connector type. |
| Category | Candidate | Gates: silhouette / smallest cluster / ARI | Chosen |
|---|---|---|---|
| Juice Bottle | 4 | : 0.53 / 11% / 0.94 pass | 4 |
| Splicing Connectors | 4 | : 0.20 / 14% / 0.94 fail (silhouette); : 0.28 / 33% / 1.00 pass | 3 |
| Screw Bag | 2 | : 0.31 / 11% / 0.66 fail (ARI) | 1 |
| Breakfast Box | 1 | single candidate, no gate | 1 |
| Pushpins | 1 | single candidate, no gate | 1 |
| Method | Clean | B20 | B40 | B60 | Z5 | Z10 | Z15 |
|---|---|---|---|---|---|---|---|
| Ours (no overlap) | 93.2 | 93.2 | 93.4 | 93.8 | 92.8 | 92.4 | 91.0 |
| Ours (full recipe) | 94.9 | 94.8 | 94.7 | 94.4 | 94.1 | 93.6 | 93.0 |
| CSAD | 97.7 | 92.2 | 82.0 | 74.4 | 74.7 | 64.8 | 61.9 |
| SALAD | 96.4 | 89.4 | 78.0 | 80.8 | 94.7 | 87.3 | 83.4 |
| LogSAD | 89.2 | 87.5 | 84.0 | 80.0 | 75.7 | 67.6 | 70.5 |
| PatchCore | 75.4 | 75.4 | 74.3 | 72.7 | 67.2 | 62.8 | 57.3 |
| Breakfast Box | Juice Bottle | Pushpins | Screw Bag | Splicing Connectors | ||||||
| Method | Cl. | Het. | Cl. | Het. | Cl. | Het. | Cl. | Het. | Cl. | Het. |
| Ours (no overlap) | 92.8 | 93.3 | 92.7 | 92.3 | 99.5 | 99.0 | 91.3 | 90.1 | 89.5 | 87.8 |
| Ours (full recipe) | 97.1 | 96.4 | 97.0 | 96.4 | 100.0 | 99.8 | 90.1 | 87.7 | 90.3 | 90.2 |
| CSAD | 95.8 | 60.0 | 95.5 | 71.2 | 99.7 | 66.2 | 99.9 | 87.3 | 97.4 | 56.1 |
| SALAD | 92.3 | 61.0 | 99.8 | 66.0 | 100.0 | 68.0 | 94.0 | 60.4 | 96.1 | 55.8 |
| LogSAD | 97.1 | 70.4 | 94.6 | 81.7 | 84.0 | 82.7 | 79.9 | 62.5 | 90.2 | 72.4 |