Abstract
Industrial Anomaly Detection (IAD) aims to determine whether a product image contains defects and to localize anomalous regions. Since real anomalies are scarce, diverse, and difficult to acquire, many IAD methods rely on synthetic anomalies for training. However, localization performance heavily depends on how well synthetic anomalies align with real-world defects. To address this challenge, this study proposes MARC (Marking Anomaly Regions with Constraints), a vision-only, self-supervised framework for pixel-level industrial anomaly localization. MARC generates synthetic anomalies and corresponding masks for training and introduces Class-Aware Look-Twice Feature Matching (CA-LTFM), which leverages global class semantics from a pretrained image encoder and combines multi-level patch features with learnable anchors to construct anomaly and normal prototypes for patch-to-prototype matching. Classification loss, segmentation loss, and disentanglement loss are jointly optimized to enable anomaly classification, localization, and anomaly/normal feature separation. Experiments on the MVTec-AD and VisA datasets demonstrate that MARC achieves improved synthetic-to-real transferability and more consistent performance between anomaly classification and localization than existing VLM-based approaches. While class-aware prototype matching and prototype disentanglement provide more transferable anomaly representations under fully synthetic training settings, the results further show that the synthetic-to-real domain gap remains a key challenge.
1. Introduction
Recent studies have explored anomaly analysis in diverse application domains, including image tampering localization, multimedia security, industrial monitoring, and multimodal anomaly diagnosis [1,2,3]. Industrial anomaly detection (IAD), meanwhile, focuses on identifying and localizing manufacturing defects in industrial products using visual inspection images. Traditional manual visual inspection is easily affected by fatigue, lighting conditions, and differences in experience. Handcrafted feature-based automatic optical inspection commonly uses edge, texture, and frequency-domain information, such as Canny edge detection [4], GLCM [5], and Fourier analysis [6]. These methods require task-specific adjustment when applied to different materials, products, or imaging conditions [7]. Alternatively, deep learning-based detection and segmentation models, such as the YOLO [8] series and Mask R-CNN [9], can learn texture and structural representations from data, reducing additional feature engineering. However, deep learning relies heavily on training data. Real anomalies in industrial scenarios are usually scarce, unpredictable, and relatively difficult to collect, making it difficult to construct a complete supervised dataset that covers all defect types.
To address the above challenge, reconstruction-based approaches such as Caps-ViT [10] attempt to detect anomalies without requiring synthetic anomaly generation. Alternatively, self-supervised industrial anomaly detection methods synthesize virtual defects from normal images [11,12]. Common approaches include CutPaste [13], Natural Synthetic Anomalies (NSA) [14], and methods that generate defective regions using random textures or noise masks. However, when pasted boundaries, external textures, or mask locations do not match the distribution of real defects, the model may learn synthetic artifacts, resulting in a synthetic-to-real domain gap [15,16].
Recently, the success of large language models (LLMs) has inspired the adoption of vision-language models (VLMs) for IAD to improve semantic understanding and explainability [17,18,19]. VLMs extend anomaly understanding and reasoning capabilities, but pixel-level localization still relies on visual features, and LLMs also increase deployment costs.
Existing methods suffer from two limitations. First, synthetic anomalies may not transfer well to real defects. Second, normal and anomaly representations are often insufficiently separated, leading to ambiguous localization responses. To address these limitations, this work develops a vision-only industrial anomaly detection framework that does not rely on LLM inference and improves both image-level classification and pixel-level localization. We adopt an anomaly synthesis approach, designing the whole framework in a self-supervised manner. Furthermore, we compare different anomaly synthesis methods under this unified architecture and analyze their transferability by examining the performance gap between synthetic validation data and real-anomaly test data. The main contributions are summarized as follows:
- We propose MARC, a vision-only industrial anomaly detection framework that learns class-aware anomaly and normal prototypes from synthetic training data. MARC performs anomaly classification and localization through visual prototype matching without relying on large language models.
- We introduce the Class-Aware Look-Twice Feature Matching (CA-LTFM), an extension of the LTFM component in Anomaly-OV [18]. CA-LTFM incorporates global class-level semantic embeddings into prototype generation and jointly optimizes segmentation supervision and prototype disentanglement. These additions improve prototype discriminability while introducing only a small number of additional trainable parameters beyond the frozen visual encoder.
- We investigate the effect of different anomaly synthesis strategies on prototype-based industrial anomaly detection and provide an empirical analysis of their synthetic-to-real transferability.
The remainder of this paper is organized as follows. Section 2 reviews related work on industrial anomaly detection, anomaly synthesis strategies, and the challenges of synthetic-to-real transferability. Section 3 describes the proposed MARC framework and the CA-LTFM module. Section 4 presents the experimental setup, ablation studies, and performance evaluation. Finally, Section 5 concludes the paper and discusses future research directions.
2. Related Work
2.1. Industrial Anomaly Detection Methods
Existing IAD methods can be broadly categorized into reconstruction-based, embedding-based, and vision-language-based approaches. Reconstruction-based methods assume that anomalous regions are difficult to reconstruct and localize defects based on the difference between the input and reconstructed image. Representative methods include RIAD [20], Skip-GANomaly [21], MemAE [22], and AnoDDPM [23]. However, overgeneralization may allow anomalous regions to be reconstructed correctly, while complex textures may cause false alarms in normal regions. Feature-embedding methods use ImageNet-pretrained networks [24] to establish the normal feature distribution. For example, PatchCore [25] uses a memory bank and nearest-neighbor distance to detect anomalies, while STFPM [26] detects deviations through teacher–student feature differences. These methods provide strong feature representations but remain affected by pretrained-domain bias, feature resolution, and memory cost.
More recently, VLMs such as CLIP [27], WinCLIP [28], APRIL-GAN [29], AnomalyGPT [17], and Anomaly-OV [18] have been used for zero- and few-shot anomaly detection, where text semantics assist anomaly judgment. These methods differ in how they combine global semantic information with local visual features. WinCLIP and APRIL-GAN construct normal and anomalous references using text prompts and generate anomaly scores through patch-level visual–text similarity. Anomaly-OV [18] further introduces Look-Twice Feature Matching (LTFM), which uses visual information to generate normal and anomaly representations and matches them with multi-level patch features to reinforce representations from suspicious regions. This design allows the model to consider both object-level semantics and local defect information. In another direction, AA-CLIP [30] addresses the limited separation between normal and anomalous text features in the original CLIP by introducing the disentanglement loss and using the resulting representations to guide patch-level feature alignment. Fine-grained defects, however, often lack clear textual descriptions, and pixel-level localization still requires additional patch-level matching or a decoder.
2.2. Anomaly Synthesis
Anomaly synthesis creates labeled virtual defects from normal images and affects not only the appearance of the generated samples but also the discriminative cues learned by the model. CutPaste [13] generates spatial irregularities through patch-level cutting and pasting. NSA [14] uses Poisson image editing [31] to smooth boundaries. TDAD [32] uses Perlin noise, DTD textures [33], and multiscale foreground masks to avoid generating anomaly regions in the background. RealNet [34] uses Strength-controllable Diffusion Anomaly Synthesis to generate anomaly textures with controllable strength that are closer to natural distributions. AnoStyler [35] applies text-guided local style transfer to improve semantic consistency. FLASH [16] introduces a paradigm to efficiently produce diverse synthetic defects for industrial anomaly detection. The main differences among these methods lie in anomaly shape, texture source, foreground constraints, blending strategy, and anomaly strength. Synthetic anomalies with obvious boundaries, fixed textures, or high-contrast regions may enable rapid convergence, but they may also cause the model to rely on synthesis-specific low-level cues rather than the structural and semantic characteristics of real defects. In contrast, synthesis strategies with foreground constraints, natural blending, and controllable anomaly strength can reduce visible pasting artifacts and improve the realism of generated defects. Although synthetic data can provide pixel-level masks, model generalization depends on whether the synthetic distribution sufficiently covers real defects, rather than only on whether the synthetic samples are easy to distinguish. Therefore, synthesis methods should not be evaluated solely on synthetic validation data; their performance degradation on real-anomaly test data should also be examined to determine whether the generated samples truly improve generalization to real defects.
2.3. Summary
Reconstruction-based methods identify anomalies through reconstruction errors, while feature-embedding methods compare test features with learned normal representations. More recent VLMs further introduce semantic information to improve anomaly recognition under zero- or few-shot settings. Meanwhile, anomaly synthesis provides scalable training samples and pixel-level masks when real defects are scarce. Existing studies indicate that multi-level feature matching, pixel-level supervision, foreground-aware synthesis, and explicit separation between normal and anomalous representations can improve anomaly localization and classification [36,37]. However, several challenges remain. Synthetic anomalies may contain method-specific textures, boundaries, or spatial patterns that differ from real defects, causing models to perform well on synthetic validation data but degrade on real-anomaly test data. In addition, fine-grained defects may not be adequately represented by text prototypes or low-resolution patch features, while large pretrained models introduce substantial computational costs. Hence, improving synthetic-to-real transfer, feature separability, localization precision, and deployment efficiency remain important for industrial anomaly detection.
3. Proposed Method
3.1. Overall Architecture
MARC is a vision-only industrial anomaly detection framework, as shown in Figure 1. During training, synthetic anomalous images and their corresponding anomaly masks are generated from normal images. Both normal and anomalous images are fed into a frozen image encoder to extract patch features from Layers 8, 16, 24, and 32, together with the global class embedding. After being projected through linear adapters, the features from each layer are processed by CA-LTFM to generate layer-wise anomaly maps, which are then averaged to produce a fused anomaly map. The fused anomaly map receives pixel-level supervision through the segmentation loss and is also used as spatial attention to weight the final patch features. The weighted features are then processed by pooling and a lightweight classifier to output the image-level anomaly probability.
Figure 1.
Overall architecture of MARC. The frozen visual encoder provides multi-level patch features and a global class embedding. CA-LTFM generates an anomaly map that supports both pixel-level localization and image-level classification.
3.2. Image Encoder and Class-Aware Look-Twice Feature Matching (CA-LTFM)
In this work, an embedding refers to a feature representation extracted by the image encoder, whereas a prototype refers to a class-aware reference representation generated by conditioning learnable anchors on the global class embedding and used for patch-to-prototype matching. The image encoder, ImageBind-Huge, used in this study is the same encoder used in AnomalyGPT [17]. Patch tokens from four intermediate layers are extracted to preserve both local texture information and high-level structural semantics. Features from shallower layers are more sensitive to edges, colors, and subtle texture variations. Such features are suitable for detecting local defects such as scratches, cracks, and surface contamination. Deeper features contain more complete object structures and category-level semantics, which are useful for identifying missing components, shape deformation, and structural inconsistency. Generating anomaly maps from multiple feature levels reduces the bias of relying on a single feature scale and improves adaptation to defects with different sizes and appearances. The global class embedding from the final layer summarizes the category and overall appearance of the input image.
Unlike the original LTFM, which constructs a global representation by aggregating final-layer patch tokens , CA-LTFM uses the class embedding from the pretrained image encoder as the semantic reference for prototype generation. Because patch aggregation is derived directly from local visual features, it can be disproportionately influenced by synthesized defects and may encode synthesis-specific characteristics. On the other hand, the class embedding is learned from large-scale pretraining and captures object-level semantic information from the entire image, making it less sensitive to local synthetic perturbations. With this approach, anomaly and normal prototypes are conditioned on class-level semantics, which improves their transferability to real anomalies.
For the i-th CA-LTFM block, the global class embedding is first linearly projected and then concatenated with the learnable anomaly anchor e+ and normal anchor e−, respectively. Two independent MLPs are then used to generate the corresponding class-aware anomaly/normal prototypes and :
where Linear(⋅) denotes a linear projection layer that maps the global class embedding to the target feature space, ∘ denotes feature concatenation, and MLPi(⋅) denotes the multilayer perceptron in the i-th CA-LTFM block, which further transforms the fused features.
Each patch is then compared with the two prototypes using cosine similarity, and a temperature-scaled softmax function converts the similarities into anomaly probabilities. Because industrial defects usually occupy only a small portion of an image, directly averaging all patch features may dilute the representation of small anomalies. To address this, the anomaly maps from the four layers are averaged and upscaled to the input resolution:
where ⟨ , ⟩ denotes cosine similarity and τ is the temperature parameter, which is set to 0.01 in this study.
In the proposed design, the fused anomaly map serves not only as the localization output but also as spatial attention for image-level classification. Specifically, it is multiplied by the final patch features to obtain , so that regions with high anomaly responses contribute more strongly to the classification result, while low-response background regions are suppressed. Global average pooling and a linear classifier are then applied to obtain the image-level prediction :
where ⊙ denotes element-wise multiplication, C(⋅) consists of global average pooling and a linear layer, and σ(⋅) denotes the sigmoid function. In this way, the classification branch uses the spatial information learned by the localization branch, linking image-level anomaly prediction with pixel-level localization rather than treating them as two independent outputs.
3.3. Classification and Segmentation Objectives
The model is jointly supervised at the image and pixel levels. For image-level anomaly prediction, binary cross-entropy loss is applied to distinguish normal and anomalous images:
where y denotes the ground-truth image label and is the predicted anomaly probability.
For pixel-level localization, the fused anomaly map m is supervised by the synthetic anomaly mask M. Following AnomalyGPT [10], focal loss and Dice loss are combined:
Lseg = Lfocal(m, M) + LDice(m, M).
Focal loss reduces the influence of dominant normal pixels and emphasizes difficult anomalous pixels, while Dice loss directly improves the overlap between the predicted anomaly region and the ground-truth mask. Together, these losses provide the spatial supervision required for CA-LTFM to produce anomaly maps aligned with defect regions. However, pixel-level supervision alone does not explicitly constrain the relationship between the normal and anomaly prototypes in the feature space. Thus, an additional prototype disentanglement objective is introduced in the following subsection.
3.4. Prototype Disentanglement
A key component of the proposed method is the explicit separation of normal and anomaly prototypes. Recent studies have explored disentangled representation learning to improve anomaly discrimination [38,39]. Although the two prototypes are generated from different learnable anchors, they are both conditioned on the same global class embedding. Without additional constraints, they may remain highly correlated in the feature space and respond to similar patch patterns. In this case, the cosine-similarity comparison in CA-LTFM becomes less discriminative, causing ambiguous anomaly probabilities, diffuse responses around object boundaries, or false activation in normal regions.
To reduce this semantic entanglement, this study introduces the disentanglement loss inspired by AA-CLIP [30]. For each CA-LTFM layer, the cosine similarity between the anomaly prototype and the normal prototype is minimized:
where ⟨ , ⟩ denotes cosine similarity and n is the number of CA-LTFM blocks. Minimizing the absolute cosine similarity encourages the two prototypes to become approximately orthogonal. This enlarges their angular separation and provides a clearer feature-space decision direction for patch-to-prototype matching.
Unlike the segmentation loss, which constrains where anomaly responses should appear, the disentanglement loss constrains how normal and anomalous semantics should be represented. The two objectives play complementary roles: segmentation supervision aligns the anomaly map with the defect mask, whereas prototype disentanglement reduces overlap between normal and anomaly representations. As a result, patch features are less likely to obtain similar responses from both prototypes, leading to more concentrated anomaly activation and fewer false-positive regions.
Figure 2 illustrates the effect of the disentanglement loss on prototype separation and anomaly localization. Without the constraint, the normal and anomaly prototypes may retain high similarity. After the loss is introduced, their cosine similarity is reduced, which decreases false activation in normal regions and makes the responses in anomalous regions more concentrated. More qualitative results are provided in Section 4.4, where the complete objective improves Pixel AUROC and fixed-threshold accuracy compared with objectives that do not jointly use segmentation and prototype separation.
Figure 2.
Effect of prototype disentanglement. From left to right: ground-truth mask, anomaly prediction with the disentanglement loss, and anomaly prediction without the disentanglement loss. Red indicates a higher anomaly similarity, while blue indicates a lower anomaly similarity.
The complete training objective is defined as:
where α and β control the contributions of pixel-level supervision and prototype disentanglement, respectively. Both are set to 0.1 in this study.
Ltotal = Lcls + αLseg + βLdis,
4. Experiments
4.1. Datasets and Settings
This study uses MVTec-AD [40] and VisA [41] for evaluation. MVTec-AD contains 15 object and texture categories. VisA contains 12 categories with more complex object arrangements and structures. The training and validation sets use normal images and synthetic anomalies generated from them. The test set uses the official normal images and real anomalies to directly evaluate synthetic-to-real generalization. Since the original VisA test set only contains anomalous samples, we randomly held out an equal number of normal samples from the original training split and used them only for test-set construction. All images are resized to 224 × 224. The model is trained for 10 epochs with a learning rate of 5 × 10−4 on an NVIDIA RTX 5090 GPU (NVIDIA Corporation, Santa Clara, CA, USA). Only the visual encoder remains frozen during training. Results presented without a standard deviation correspond to a single run, whereas results reported as mean ± standard deviation are averaged over five independent runs.
Image-level detection is evaluated using Image AUROC, Accuracy, Precision, Recall, and F1-score. Pixel-level localization is evaluated using Pixel AUROC. AUROC measures ranking ability across different thresholds, while Accuracy and F1-score reflect practical classification performance under a fixed threshold according to the best F1-score on the validation set and fixed for all experiments. The threshold for image anomaly is 0.4, whereas the threshold for pixel anomaly is 0.2.
4.2. Implementation and Computational Cost
Table 1 depicts the computational cost of MARC, excluding the anomaly synthesis process. As shown in Table 1, the complete model contains approximately 1.21 billion parameters and requires about 168.16 GMACs, or 336.48 GFLOPs, for a single-image forward pass. The frozen image encoder accounts for 99.60% of the computation. The proposed trainable modules contain approximately 8.27 million parameters and require 675.81 MMACs, accounting for about 0.40% of the total computation. Note that ImageBind-Huge was adopted because it is also used by AnomalyGPT so that a fair comparison can be conducted.
Table 1.
Model parameters and computational cost for a single-image forward pass.
4.3. Anomaly Synthesis Comparison
To investigate the influence of anomaly synthesis on model generalization, we evaluate MARC using multiple synthesis strategies, including NSA, RealNet, AnoStyler, and TDAD. The qualitative and quantitative comparisons are provided in Figure 3 and Table 2 respectively. Note that the TDAD method is re-implemented in this study since the original study does not provide source code. The real-anomaly test set is used only for evaluation and analysis, and its performance is not used to guide subsequent methodological decisions. Although some methods produce visually plausible defects, the observed validation-to-test performance degradation in Table 2 indicates that visual realism alone does not guarantee effective synthetic-to-real transfer. Most methods achieve high scores on the synthetic validation set, but the degree of performance degradation on the real-anomaly test set differs greatly. On MVTec-AD, the decreases in Image AUROC from the synthetic validation set to the real-anomaly test set for NSA, RealNet, AnoStyler, and TDAD are 22.19%, 13.66%, 22.39%, and 31.33%, respectively. RealNet shows the smallest decrease, whereas AnoStyler drops from 100.00% on the validation set to 77.61% on the test set. This suggests that highly distinguishable synthetic anomalies do not necessarily provide transferable representations of real defects. NSA shows conservative behavior with high Precision and low Recall. TDAD avoids background anomalies, but its Perlin noise-based masks and manually designed augmentations still limit defect diversity. RealNet and AnoStyler exhibit complementary strengths across different evaluation metrics. While RealNet achieves superior performance on some metrics, AnoStyler performs better on others, suggesting that neither synthesis strategy consistently dominates across all evaluation criteria. The results suggest that factors beyond visual appearance, such as feature distribution alignment and anomaly diversity, may influence generalization to real anomalies.
Figure 3.
Qualitative comparison of four synthesis methods. The first row is the synthesized images; the second row is the corresponding anomaly masks. RealNet generates defects with more natural blending, whereas AnoStyler generates anomalous regions with small artifacts. The anomaly mask generated by TDAD is smooth, but the visual defects are less observable.
Table 2.
Results of different anomaly synthesis methods on the synthetic validation and real test sets. Bold text indicates the best results.
4.4. Ablation Studies
In this subsection, we conduct a series of ablation studies to evaluate the effectiveness of the proposed design choices, including the use of class embedding versus aggregating patch embedding for prototype generation, the impact of the disentanglement loss, and the balance between the segmentation and disentanglement loss. Results are presented in Table 3, Table 4 and Table 5. Regarding semantic representation, both the class embedding and patch embedding aggregation strategies perform well on the validation set, but the class embedding direct method achieves better Image AUROC, Pixel AUROC, Accuracy, F1-score, and Recall on the real-anomaly test set. Although patch embedding aggregation reaches 98.36% in Precision, its Recall is only 47.00%, suggesting that the aggregated representation may be overly influenced by local synthetic features and thus produces conservative predictions. The results support our hypothesis that patch aggregation is more easily influenced by local synthetic anomalies, whereas the class embedding provides a more stable object-level semantic reference. As shown in Table 4, the positive and negative prototypes become nearly orthogonal after applying the disentanglement loss. This result suggests that the disentanglement loss effectively encourages the separation of anomaly and normal representations.
Table 3.
Ablation results for using global class embedding and patch embedding aggregation on MVTec-AD. Bold text indicates the best results.
Table 4.
Ablation results of the prototype cosine similarity values by employing disentangle loss and without employing it. Results are reported as mean ± standard deviation over five random seeds.
Table 5.
Ablation results of different weight combinations on α and β.
Table 5 depicts the parameter analysis of the loss weights α and β. Among the evaluated settings, the best performance is achieved when α = 0.1 and β = 0.1. However, the performance differences across the four configurations are relatively small. This suggests that MARC is not particularly sensitive to these hyperparameters within the evaluated range.
Another experiment is to validate the performance of combining different loss functions. In Table 6, using BCE alone allows the model to learn image-level ranking, but Pixel AUROC remains low, indicating that the anomaly map does not obtain effective spatial alignment. Adding the segmentation loss greatly improves Pixel AUROC, confirming that focal and Dice mask supervision are the main sources of localization ability. Adding the disentanglement loss alone does not provide pixel-level supervision, but it adjusts the geometric relationship between normal and anomaly prototypes. The complete model achieves both higher Pixel AUROC and fixed-threshold Accuracy, showing that the disentanglement loss can reduce false activation in normal regions and improve overall stability when used together with segmentation supervision.
Table 6.
Ablation results for different loss combinations. Bold text indicates the best results.
4.5. Comparison with State-of-the-Art Methods
The proposed method is compared with two VLMs, AnomalyGPT [17], and Anomaly-OV [18]. For all experiments in this comparison, RealNet and AnoStyler are included as representative anomaly synthesis methods with different synthetic-to-real transfer characteristics. Results are shown in Table 7. AnomalyGPT performs anomaly classification using the full model. On the other hand, Anomaly-OV has two stages: the first stage uses an anomaly expert for anomaly recognition and localization, and the second stage is an LLM for generating explanations. Therefore, this study only uses the first stage in Anomaly-OV (termed Anomaly-OV Stage-1) for comparison. To maintain the same synthetic-data condition, Anomaly-OV Stage-1 was trained using RealNet synthetic data.
Table 7.
Comparison with VLM-based methods and performance reference from representative vision-only methods.
On the MVTec-AD test set, AnomalyGPT achieves an Image AUROC of 89.97% and a Pixel AUROC of 89.55%, which are higher than the 86.27% and 85.87% obtained by the proposed method. This indicates that AnomalyGPT provides better anomaly ranking across different thresholds. However, the proposed method achieves an Accuracy of 79.03% and an F1-score of 79.49%, exceeding the 70.44% and 72.12% of AnomalyGPT. Its Recall also increases from 59.66% to 71.92%. These results show that although the proposed method has slightly lower AUROC values, it detects more real anomalies and provides a more stable balance between Precision and Recall.
Anomaly-OV Stage-1 achieves very high image-level classification results on the MVTec-AD validation set. However, its Image AUROC decreases to 63.78% on the test set, while its Pixel AUROC is only 46.09%, with both F1-score and Recall equal to 0. This large gap indicates that the model can effectively recognize RealNet synthetic anomalies but has difficulty transferring the learned features to real anomalies. Its anomaly maps also show limited alignment with real defective regions. In comparison, although the proposed method still shows a performance drop from the validation set to the test set, it retains better classification and localization ability whether using RealNet or AnoStyler as the synthesis method.
On the VisA test set, all methods achieve very high Image AUROC, indicating that the model can identify anomalous images very well. However, although Anomaly-OV Stage-1 achieves an Image AUROC of 99.90% and an Accuracy of 88.82%, its Pixel AUROC is only 15.67%. This suggests that its strong image-level judgment does not translate into reliable localization of anomalous regions. Comparatively, the proposed method achieves a Pixel AUROC of 95.20% and 85.11% on two synthesis methods, showing that MARC maintains stable image-level classification and pixel-level localization performance across both datasets while remaining competitive with existing VLM-based approaches.
In addition, several vision-only approaches, such as Dinomaly [42] and GLASS [11], report Image AUROC values exceeding 99.3%. However, these results were obtained under different training and evaluation settings, making direct quantitative comparison with MARC difficult. Thus, their performance is discussed qualitatively rather than included in the primary comparison. Unlike these methods, MARC aims to investigate anomaly localization and synthetic-to-real transferability under a fully synthetic training setting.
To further investigate category-wise performance, Table 8 and Table 9 present the per-category metrics using five random seeds on both datasets. MARC performs consistently across most categories, although categories with subtle texture defects, such as Pcb1 and Macaron1, remain challenging.
Table 8.
Per-category results of MARC on MVTec-AD. Results are reported as mean ± standard deviation over five random seeds.
Table 9.
Per-category results of MARC on VisA. Results are reported as mean ± standard deviation over five random seeds.
4.6. Anomaly Localization Analysis
Figure 4 illustrates the localization results among different methods. As shown in Figure 4, MARC generally localizes real defects more accurately and preserves clearer defect boundaries. AnomalyGPT [17] detects anomalies in some cases but produces more scattered high-response regions. Anomaly-OV Stage-1 often produces false activations in the normal background or non-defective object regions.
Figure 4.
Qualitative comparison of anomaly heatmaps from different models on the real-anomaly test set. From left to right: input image, ground-truth mask, MARC, AnomalyGPT, and Anomaly-OV Stage-1. Red indicates a higher anomaly similarity, while blue indicates a lower anomaly similarity.
However, MARC may still miss or over-identify very small, fragmented defects or defects that are highly similar to normal textures. This indicates that although multi-level feature fusion improves scale adaptation, the model still struggles to localize such defects because their features are almost unobservable on small feature maps.
5. Conclusions
The proposed vision-only framework, MARC, uses CA-LTFM to combine a global class embedding with multi-level patch features, producing a class-aware anomaly map for both pixel-level localization and image-level classification. Compared with patch token aggregation, the class embedding provides a more stable global semantic reference, especially when the model is trained on synthetic anomalies and tested on real anomalies.
The results show that class-aware prototype matching and prototype disentanglement provide a stable mechanism for bridging global semantics and pixel-level localization. Among the evaluated synthesis strategies, both RealNet and AnoStyler exhibit stable synthetic-to-real transfer, with neither method consistently dominating across all evaluation metrics. The focal and Dice losses adopted from AnomalyGPT significantly improve the alignment between the anomaly map and the ground-truth mask. The disentanglement loss inspired by AA-CLIP reduces the correlation between normal and anomaly prototypes, allowing the complete model to achieve a better balance between classification and localization. MARC obtains excellent image-level performance on VisA and outperforms the two large-model baselines on MVTec-AD.
This study is still limited by its reliance on a large visual backbone and fully synthetic anomaly training. On MVTec-AD, Recall remains lower than Precision, indicating that small or low-contrast defects may still be missed. The validation-to-test gap across different synthesis methods also shows that the domain gap has not been fully resolved. In addition, the MVTec-AD and VisA datasets contain a limited number of product categories and are collected under relatively controlled imaging conditions. Therefore, scalability, generalization to unseen anomaly types, and robustness to imaging variations require further evaluation. Moreover, MARC currently relies on a relatively large visual backbone, which may limit deployment on resource-constrained industrial devices. Future work will explore more lightweight backbone architectures, weighted anomaly-map aggregation strategies, and the impact of image resolution. We will also investigate semi-supervised adaptation techniques that leverage a small number of real anomaly samples to improve synthetic-to-real transferability and cross-scenario generalization.
Author Contributions
The authors confirm contribution to the paper as follows: Conceptualization, T.-W.L., C.-C.Y. and Hsu-Yung Chang; methodology, T.-W.L. and C.-C.Y.; software, T.-W.L.; validation, T.-W.L. and C.-C.Y.; formal analysis, C.-C.Y. and H.-Y.C.; investigation, T.-W.L.; resources, C.-C.Y.; data curation, T.-W.L.; writing—original draft preparation, T.-W.L.; writing—review and editing, C.-C.Y. and H.-Y.C.; visualization, T.-W.L.; supervision, C.-C.Y.; project administration, C.-C.Y.; funding acquisition, C.-C.Y. All authors have read and agreed to the published version of the manuscript.
Funding
This research was funded by the National Science and Technology Council under grant number NSTC 114-2221-E-033-015-MY3.
Data Availability Statement
The data that support the findings of this study are openly available in the MVTec AD dataset at https://www.mvtec.com/research-teaching/datasets/mvtec-ad/downloads (accessed on 15 September 2026) and VisA at https://github.com/amazon-science/spot-diff (accessed on 15 September 2026). Source code is available at https://github.com/cyculab618/MARC (accessed on 15 September 2026).
Conflicts of Interest
The authors declare no conflicts of interest.
References
- Ouyang, X.; Zhang, Y.; Hua, L.; Yin, Y. AF-TAD: Transformer-Based Anomaly Detection for Aircraft Fuel Systems. Aerospace 2025, 12, 1066. [Google Scholar] [CrossRef] [Scilit]
- Zhang, W.; Xin, R.; Chen, P.; Li, X.; Bian, A.; Zhao, Y.; Zhao, Z. MODIFy: A multi-modal anomaly diagnosis framework with diffusion-enhanced adaptive fusion in microservices. J. Syst. Softw. 2026, 237, 112844. [Google Scholar] [CrossRef] [Scilit]
- Wang, Y.; Cao, G.; Lou, Z.; Zhu, H. Transferable Adversarial Attack on Image Tampering Localization. arXiv 2023, arXiv:2309.10243. [Google Scholar]
- Canny, J. A Computational Approach to Edge Detection. IEEE Trans. Pattern Anal. Mach. Intell. 1986, PAMI-8, 679–698. [Google Scholar] [CrossRef] [Scilit]
- Haralick, R.M.; Shanmugam, K.; Dinstein, I.H. Textural Features for Image Classification. IEEE Trans. Syst. Man. Cybern. 1973, SMC-3, 610–621. [Google Scholar] [CrossRef] [Scilit]
- Chi-Ho, C.; Pang, G.K.H. Fabric defect detection by Fourier analysis. IEEE Trans. Ind. Appl. 2000, 36, 1267–1276. [Google Scholar] [CrossRef] [Scilit]
- Czimmermann, T.; Ciuti, G.; Milazzo, M.; Chiurazzi, M.; Roccella, S.; Oddo, C.M.; Dario, P. Visual-Based Defect Detection and Classification Approaches for Industrial Applications—A SURVEY. Sensors 2020, 20, 1459. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Wang, C.-Y.; Yeh, I.-H.; Mark Liao, H.-Y. (Eds.) Yolov9: Learning what you want to learn using programmable gradient information. In European Conference on Computer Vision; Springer: Cham, Switzerland, 2024. [Google Scholar]
- He, K.; Gkioxari, G.; Dollár, P.; Girshick, R. (Eds.) Mask r-cnn. In Proceedings of the IEEE International Conference on Computer Vision; IEEE: New York, NY, USA, 2017. [Google Scholar]
- Onorato, G.; Tarantelli, K.; Guida, A.; Schiavella, C.; Amerini, I. Caps-ViT: A synthetic-free capsule vision Transformer for reconstruction based anomaly detection and localization. Image Vis. Comput. 2026, 176, 106204. [Google Scholar] [CrossRef] [Scilit]
- Chen, Q.; Luo, H.; Lv, C.; Zhang, Z. (Eds.) A unified anomaly synthesis strategy with gradient ascent for industrial anomaly detection and localization. In European Conference on Computer Vision; Springer: Cham, Switzerland, 2024. [Google Scholar]
- Jiao, Y.; Zhang, Z.; Li, Z.; Li, Z.; Li, X.; Liu, J. A Robust Coverless Image-Synthesized Video Steganography Based on Asymmetric Structure. J. Vis. Commun. Image Represent. 2024, 104, 104303. [Google Scholar] [CrossRef] [Scilit]
- Li, C.-L.; Sohn, K.; Yoon, J.; Pfister, T. (Eds.) Cutpaste: Self-supervised learning for anomaly detection and localization. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition; IEEE: New York, NY, USA, 2021. [Google Scholar]
- Schlüter, H.M.; Tan, J.; Hou, B.; Kainz, B. (Eds.) Natural synthetic anomalies for self-supervised anomaly detection and localization. In European Conference on Computer Vision; Springer: Cham, Switzerland, 2022. [Google Scholar]
- Kang, S.; Park, H.; Lee, Y.; Lee, H.; Jeong, M.; Park, Y.; Lee, I.; Yi, J. Anomaly Detection by Effectively Leveraging Synthetic Images. arXiv 2025, arXiv:251223227. [Google Scholar]
- Das, A.K.; Gangireddy, R.; Vaidya, A.; Akcay, S. FLASH: A “Generate Once, Synthesize Many” Framework for Synthetic Anomaly Generation in Industrial Anomaly Detection. arXiv 2026. [Google Scholar] [CrossRef] [Scilit]
- Gu, Z.; Zhu, B.; Zhu, G.; Chen, Y.; Tang, M.; Wang, J. (Eds.) Anomalygpt: Detecting industrial anomalies using large vision-language models. In Proceedings of the AAAI Conference on Artificial Intelligence; AAAI Press: Washington, DC, USA, 2024. [Google Scholar]
- Xu, J.; Lo, S.-Y.; Safaei, B.; Patel, V.M.; Dwivedi, I. (Eds.) Towards zero-shot anomaly detection and reasoning with multimodal large language models. In Proceedings of the Computer Vision and Pattern Recognition Conference; IEEE: New York, NY, USA, 2025. [Google Scholar]
- Ergin, O.; Güçlü, E.; Aydın, İ.; Akın, E. Enhancing PatchCore with Dynamic Scaling and Vision–Language Models for Explainable Industrial Defect Inspection. Appl. Sci. 2026, 16, 7096. [Google Scholar] [CrossRef] [Scilit]
- Zavrtanik, V.; Kristan, M.; Skočaj, D. Reconstruction by inpainting for visual anomaly detection. Pattern Recognit. 2021, 112, 107706. [Google Scholar] [CrossRef] [Scilit]
- Akçay, S.; Atapour-Abarghouei, A.; Breckon, T.P. Skip-ganomaly: Skip connected and adversarially trained encoder-decoder anomaly detection. arXiv 2019, arXiv:190108954. [Google Scholar]
- Gong, D.; Liu, L.; Le, V.; Saha, B.; Mansour, M.R.; Venkatesh, S.; Hengel, A.V.D. (Eds.) Memorizing normality to detect anomaly: Memory-augmented deep autoencoder for unsupervised anomaly detection. In Proceedings of the IEEE/CVF International Conference on Computer Vision; IEEE: New York, NY, USA, 2019. [Google Scholar]
- Wyatt, J.; Leach, A.; Schmon, S.M.; Willcocks, C.G. (Eds.) Anoddpm: Anomaly detection with denoising diffusion probabilistic models using simplex noise. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition; IEEE: New York, NY, USA, 2022. [Google Scholar]
- Deng, J.; Dong, W.; Socher, R.; Li, L.-J.; Li, K.; Fei-Fei, L. (Eds.) Imagenet: A Large-scale Hierarchical Image Database. In Proceedings of the 2009 IEEE Conference on Computer Vision and Pattern Recognition; IEEE: New York, NY, USA, 2009. [Google Scholar]
- Roth, K.; Pemula, L.; Zepeda, J.; Schölkopf, B.; Brox, T.; Gehler, P. (Eds.) Towards total recall in industrial anomaly detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition; IEEE: New York, NY, USA, 2022. [Google Scholar]
- Wang, G.; Han, S.; Ding, E.; Huang, D. Student-teacher feature pyramid matching for anomaly detection. arXiv 2021, arXiv:210304257. [Google Scholar]
- Radford, A.; Kim, J.W.; Hallacy, C.; Ramesh, A.; Goh, G.; Agarwal, S.; Sastry, G.; Askell, A.; Mishkin, P.; Clark, J.; et al. (Eds.) Learning transferable visual models from natural language supervision. In Proceedings of the 38th International Conference on Machine Learning; PMLR: Cambridge, MA, USA, 2021. [Google Scholar]
- Jeong, J.; Zou, Y.; Kim, T.; Zhang, D.; Ravichandran, A.; Dabeer, O. (Eds.) Winclip: Zero-/few-shot anomaly classification and segmentation. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition; IEEE: New York, NY, USA, 2023. [Google Scholar]
- Chen, X.; Han, Y.; Zhang, J. April-gan: A zero-/few-shot anomaly classification and segmentation method for cvpr 2023 vand workshop challenge tracks 1&2: 1st place on zero-shot ad and 4th place on few-shot ad. arXiv 2023, arXiv:230517382. [Google Scholar]
- Ma, W.; Zhang, X.; Yao, Q.; Tang, F.; Wu, C.; Li, Y.; Yan, R.; Jiang, Z.; Zhou, S.K. (Eds.) Aa-clip: Enhancing zero-shot anomaly detection via anomaly-aware clip. In Proceedings of the Computer Vision and Pattern Recognition Conference; IEEE: New York, NY, USA, 2025. [Google Scholar]
- Pérez, P.; Gangnet, M.; Blake, A. Poisson image editing. In Proceedings of the ACM SIGGRAPH 2003 Papers; ACM: New York, NY, USA, 2003. [Google Scholar]
- Wei, C.; Han, H.; Xia, Y.; Ji, Z. TDAD: Self-supervised industrial anomaly detection with a two-stage diffusion model. Comput. Ind. 2025, 164, 104192. [Google Scholar] [CrossRef] [Scilit]
- Cimpoi, M.; Maji, S.; Kokkinos, I.; Mohamed, S.; Vedaldi, A. (Eds.) Describing Textures in the Wild. In Proceedings of the 2014 IEEE Conference on Computer Vision and Pattern Recognition, Columbus, OH, USA, 23–28 June 2014. [Google Scholar]
- Zhang, X.; Xu, M.; Zhou, X. (Eds.) Realnet: A feature selection network with realistic synthetic anomaly for anomaly detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition; IEEE: New York, NY, USA, 2024. [Google Scholar]
- So, Y.; Kang, S. (Eds.) Anostyler: Text-driven localized anomaly generation via lightweight style transfer. In Proceedings of the AAAI Conference on Artificial Intelligence; AAAI Press: Washington, DC, USA, 2026. [Google Scholar]
- Ma, B.; Jia, T.; Wang, H.; Chen, D. Meta-TIP: An Unsupervised End-to-End Fusion Network for Multi-Dataset Style-Adaptive Threat Image Projection. IEEE Trans. Image Process. 2025, 34, 8317–8331. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Yang, J.; Cao, J.; Duan, C. Towards Realistic Industrial Anomaly Detection: MADE-Net Framework and ManuDefect-21 Benchmark. Appl. Sci. 2025, 15, 10885. [Google Scholar] [CrossRef] [Scilit]
- Li, L.; Han, Z. RRS-AR: Restricted random sampling and attraction–rejection contrastive learning for industrial image anomaly detection. Measurement 2026, 262, 120125. [Google Scholar] [CrossRef] [Scilit]
- Luo, H.; Xi, W. DARL: Diffusion-augmented representation learning via disentangled contrastive pre-training for industrial anomaly detection. Neurocomputing 2026, 702, 134572. [Google Scholar] [CrossRef] [Scilit]
- Bergmann, P.; Fauser, M.; Sattlegger, D.; Steger, C. MVTec AD—A Comprehensive Real-World Dataset for Unsupervised Anomaly Detection. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), Long Beach, CA, USA, 15–20 June 2019. [Google Scholar]
- Zou, Y.; Jeong, J.; Pemula, L.; Zhang, D.; Dabeer, O. (Eds.) Spot-the-difference self-supervised pre-training for anomaly detection and segmentation. In European Conference on Computer Vision; Springer: Cham, Switzerland, 2022. [Google Scholar]
- Guo, J.; Lu, S.; Zhang, W.; Chen, F.; Li, H.; Liao, H. (Eds.) Dinomaly: The less is more philosophy in multi-class unsupervised anomaly detection. In Proceedings of the Computer Vision and Pattern Recognition Conference; IEEE: New York, NY, USA, 2025. [Google Scholar]
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license.





