AnomalyControl: Learning Cross-modal Semantic Features for Controllable Anomaly Synthesis

Shidan He, Lei Liu, Shen ZhaoarXiv 2024 · DOI

Introduction

In industrial inspection and medical imaging, the scarcity of "abnormal" data—such as cracks, stains, or structural failures—poses a significant challenge for training robust anomaly detection models. While "normal" data is abundant, capturing every possible defect is often prohibitively expensive or impossible. AnomalyControl addresses this by synthesizing highly realistic and controllable anomalies through the fusion of cross-modal semantic features, specifically combining text and image prompts.

AnomalyControl synthesizes defects by combining normal images with text and image reference prompts.

Existing AI-driven synthesis methods often fall short. Text-only methods struggle with the fine-grained physical details of defects, while image-based methods frequently fail to isolate the anomaly from the background or material of the reference image. This results in synthetic defects that appear as "stickers" rather than integrated textures. AnomalyControl overcomes these limitations by "zooming in" on specific defect patterns to generate high-quality training data.

Methodology

AnomalyControl is built upon a pre-trained Stable Diffusion model, enhanced by three core innovations designed to capture and inject defect-specific features.

The AnomalyControl architecture featuring Cross-modal Semantic Modeling (CSM) and Anomaly-Semantic Enhanced Attention (ASEA).

1. Cross-modal Semantic Modeling (CSM)

CSM processes "non-matching pairs"—for instance, an image of a hole in wood paired with the text "this is an image with a hole." By utilizing a frozen Vision-Language Model (VLM), it blends these inputs to extract a high-level semantic representation of the anomaly.

2. Anomaly-Semantic Enhanced Attention (ASEA)

ASEA is the framework's "secret sauce." While standard VLMs attend to the entire image, ASEA employs a trainable guidance variable to focus the model's attention specifically on the defect region within the reference image. This ensures the model learns the "essence" of the anomaly (e.g., a "hole") independently of its original context (e.g., "wood").

3. Semantic Guided Adapter (SGA)

The SGA module injects these refined features into the diffusion process using a decoupled cross-attention mechanism. This allows the model to maintain the appearance of the target object while seamlessly integrating the new anomaly features. Notably, this system is "plug-and-play," requiring only the training of lightweight adapters rather than the entire diffusion model.

Key Insights and Results

A major advantage of AnomalyControl is its ability to handle "non-matching" references. A visual pattern like "rust" from a metal plate can be successfully synthesized onto a "plastic toy," demonstrating true semantic understanding. The authors found that iterative refinement of the attention map (ASEA) was more effective for capturing realistic details than simply increasing model scale.

The framework was evaluated on major benchmarks including MVTec AD, MPDD, and ViSA. Key results include:

  • State-of-the-Art Synthesis: Achieved an Inception Score (IS) of 1.84 on MVTec AD, outperforming previous leaders.
  • Superior Realism: Scored 0.35 in human-like perceptual tests (IC-LPIPS), indicating high diversity and realism.
  • Downstream Performance: When used to augment training sets for detection models like DRAEM, it reached a 99.5% AUC-P on MVTec AD, setting a new performance ceiling.

Conclusion and Future Work

AnomalyControl provides a powerful tool for generating synthetic training data for rare or unseen defect types. While the ASEA module introduces some iterative overhead and the system depends on the underlying VLM's quality, the results demonstrate a significant leap in controllable anomaly synthesis. Future research may extend this framework to 3D synthesis or video-based inspection to address temporal consistency in dynamic environments.

Summary updated

BibTeX
@misc{he2024anomalycontrol,
  author = {Shidan He and Lei Liu and Shen Zhao},
  title = {{AnomalyControl: Learning Cross-modal Semantic Features for Controllable Anomaly Synthesis}},
  year = {2024},
  eprint = {2412.06510},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2412.06510},
}
Figure