Manuscript Offprint

arXiv:2610.18295

Robust Logical Anomaly Detection under Capture Shifts via Synthetic Anomalies

Ufuk Efe, Alptekin Temizel

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.

Keywords: anomaly detection, logical anomalies, robustness, distribution shift, synthetic anomalies, image editing, industrial inspection

∗^{*}Corresponding author.

Email addresses: ufuk.efe@metu.edu.tr (Ufuk Efe), atemizel@metu.edu.tr (Alptekin Temizel)

1. Introduction

Figure

Figure 1: Clean and heterogeneous AUROC. Five-category mean image-level logical AUROC on MVTec LOCO for clean test images and under the heterogeneous perturbation protocol, in which each test image is randomly kept unaltered or subjected to a brightness reduction or a zoom-out transformation. Our two variants are shown in blue: Ours (full recipe) and Ours (no overlap), which is trained without brightness or zoom-out augmentation and is therefore used to assess robustness. AnomalyCLIP (below the dashed line), a zero-shot method that uses no normal reference, is near chance level even on clean images.

Visual anomaly detection is essential for automated quality control in manufacturing (Lin et al., 2025). Because defective products are rare and diverse, most detectors are trained exclusively on normal images, without access to real anomalies (Lin et al., 2025; Bergmann et al., 2022). We study logical anomalies, such as missing, extra or wrongly combined parts, rather than structural defects such as scratches. On MVTec LOCO (Bergmann et al., 2022), the standard benchmark for this task, the best methods, such as CSAD (Hsieh and Lai, 2024) and SALAD (Fučka et al., 2025), reach near-perfect image-level area under the ROC curve (AUROC). Although both also train on synthetic anomalies, their score still depends on how far a test image lies from normal data; we call such methods normal-reference methods. These benchmark results, however, come from images taken under controlled capture conditions.

On a production line, illumination and camera position do not always remain constant (Baitieva et al., 2025). Robustness to such capture shifts has been benchmarked mainly for structural defects (Cao et al., 2023; Pemula et al., 2025; Heckler-Kram et al., 2026). We evaluate logical anomaly detectors on MVTec LOCO under a heterogeneous perturbation protocol (Section 3.6). Each test image is assigned at random to one of seven conditions, unperturbed or with a brightness reduction or a zoom-out at one of three strengths, and a single AUROC is computed over the mixed test set. Under this protocol, the normal-reference methods we tested lose 9.7 to 34.1 AUROC points, and

CSAD and SALAD fall to 68.1% and 62.3% (Fig. 1). Since neither perturbation alters the logical content of an image, this drop originates in how the detectors score the perturbed images.

A likely reason for this drop is that normal-reference detectors compare a test image with normal data taken under one lighting and one camera position. A darker image or a smaller object may then be scored as anomalous even when every part is correct; indeed, under both perturbations, many normal test images score above the median clean anomaly (Fig. 5). This reading suggests learning the decision instead as a contrast between normal images and rule violations seen under the same capture conditions, so that a capture change moves both sides alike. Our framework differs from CSAD and SALAD not in using synthetic anomalies but in this test-time decision, which is fully discriminative: the classifier scores a test image without comparing it with normal data. Learning this contrast, however, needs rule violations, and real ones are rarely available.

Our framework therefore creates these rule violations as synthetic anomalies from a description of the product, so that, like the normal-reference methods, it needs no real anomaly during training. First, a person writes a short description of each category. From it, a language model proposes anomaly types, rule violations that could occur in the category, and writes an editing prompt for each; an image editor then applies one prompt to each normal training image. The edited images are then manually reviewed, assisted by a vision-language model, and only valid anomalies are retained. Normal sub-mode discovery, a simple automatic step, assigns each distinct group of normal images its own class, and the classifier is trained to distinguish these normal sub-modes from the anomaly types. Similar generate-then-train pipelines exist for structural defects (Sun et al., 2025; Fučka et al., 2026a; Hu et al., 2026); for logical anomalies, ComGEN (Tong et al., 2025) generates anomalies with a diffusion model but keeps a normal-reference decision. In summary, our contributions are threefold:

  1. We show that brightness reduction and zoom-out, applied at random to the test images of MVTec LOCO, reduce the AUROC of the normal-reference methods we tested by 9.7 to 34.1 points, a loss of 38.2% to 73.5% of their performance above chance (Section 3.6).

  2. We propose a framework in which a classifier, trained on normal images and on synthetic anomalies derived from a short description of each category, scores a test image without comparing it with normal data.

  3. 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 same perturbations; trained without brightness or zoom-out augmentation, it still reaches 92.5% (93.2% clean).

References (53)