Component-aware Unsupervised Logical Anomaly Generation for Industrial Anomaly Detection

Xuan Tong, Yang Chang, Qing Zhao, Jiawen Yu, Boyang Wang, Junxiong Lin, Yuxuan Lin, Xinji Mai, Haoran Wang, Zeng Tao, Yan Wang, Wenqiang Zhang · DOI

Abstract

Industrial visual anomaly detection (VAD) is critical for quality control but suffers from a scarcity of real-world defect data. While existing methods can generate structural anomalies (e.g., scratches), they struggle with "logical" anomalies—violations of layout or quantity rules. We present ComGEN, an unsupervised framework that generates realistic logical anomalies by disentangling images into individual components using multi-token text embeddings. By editing these components and utilizing cross-attention maps for precise mask generation, ComGEN creates high-quality synthetic training data. Our approach achieves state-of-the-art performance, reaching 91.2% AUROC on the MVTecLOCO dataset without requiring any real anomaly samples.

Introduction

Deep learning models for industrial inspection are often hindered by the rarity of defects. Traditional data augmentation like "cut-and-paste" often produces unrealistic artifacts, leading to high false-positive rates. Furthermore, standard generative models excel at structural defects but fail to capture logical inconsistencies, such as a missing item in a multi-component assembly. Many current state-of-the-art generators also require "few-shot" real anomaly samples, which are not always available. ComGEN addresses these issues by generating realistic, logical anomalies in a completely unsupervised manner.

Comparison of ComGEN with existing anomaly generation methods. ComGEN produces more realistic logical anomalies (row 1) and structural anomalies (row 2) compared to CutPaste and GAN/Diffusion baselines.

Methodology

The ComGEN framework consists of three main stages:

1. Multi-Component Learning (MCL)

To understand the compositional nature of industrial scenes, ComGEN learns unique text embeddings for individual components (e.g., "meal-box," "fruits"). This disentanglement allows the model to associate specific pixel regions with semantic concepts.

2. Anomaly Generation & Editing

Once components are learned, anomalies are generated via:

  • Prompt Modifications (PM): Removing specific text tokens to force the diffusion model to omit components.
  • Low-density Sampling (LS): Sampling from the edges of the data manifold to create statistically plausible but anomalous variations.

3. Mask Generation

Training a detector requires ground-truth masks. ComGEN employs Reference Neighbor Association (RNA) to find the closest "normal" image in a memory bank. It then uses Residual Mapping (RM) to compare cross-attention maps between the generated anomalous image and its normal neighbor, pinpointing the exact location of the defect.

Overview of the ComGEN framework, illustrating Multi-Component Learning, Anomaly Generation, and the Segmentation Network training process.

Results and Discussion

ComGEN was evaluated on MVTecLOCO, MVTecAD, and a real-world Diesel Engine dataset.

  • State-of-the-Art Performance: ComGEN achieved a 91.2% AUROC on MVTecLOCO, outperforming both unsupervised and few-shot competitors.
  • Real-World Utility: In a diesel engine manufacturing scenario, ComGEN-generated data improved detection accuracy by 10.0% AUROC.
  • Diversity and Realism: Qualitative analysis shows that ComGEN avoids the color and shape distortions common in vanilla diffusion models by grounding the generation process in learned component vocabularies.

Conclusion

ComGEN demonstrates that logical anomalies can be effectively modeled as compositional layout problems. By leveraging cross-attention maps for unsupervised mask generation, the framework provides a robust pipeline for industrial quality control. Future work will focus on optimizing inference speeds for large memory banks and extending the logic to more complex functional relationships between parts.

Summary updated

BibTeX
@inproceedings{tong2025component,
  author = {Xuan Tong and Yang Chang and Qing Zhao and Jiawen Yu and Boyang Wang and Junxiong Lin and Yuxuan Lin and Xinji Mai and Haoran Wang and Zeng Tao and Yan Wang and Wenqiang Zhang},
  title = {{Component-aware Unsupervised Logical Anomaly Generation for Industrial Anomaly Detection}},
  booktitle = {IEEE International Conference on Robotics and Automation},
  year = {2025},
  doi = {10.1109/icra55743.2025.11127296},
}
Figure