LogicAL: Towards logical anomaly synthesis for unsupervised anomaly localization

Ying ZhaoWorkshops @ CVPR 2024 · DOI · arXiv

Abstract

In industrial quality control, unsupervised anomaly localization is a critical task. While existing methods excel at identifying structural defects like scratches or stains, they often fail to detect "logical" anomalies—scenarios where individual components are flawless but their arrangement or quantity is incorrect. LogicAL is a novel framework that bridges this gap by synthesizing photo-realistic logical anomalies through edge manipulation and GAN-based image generation. By training on these synthetic defects, the model learns the underlying geometric and logical constraints of a scene, setting new state-of-the-art benchmarks on the MVTecLOCO and MVTecAD datasets.

Introduction

Industrial anomaly detection typically relies on "anomaly synthesis" to train models in the absence of real-world defect data. However, traditional synthesis techniques like CutPaste or Draem primarily focus on structural anomalies. These methods often introduce obvious pixel artifacts or unnatural boundaries, which allow models to take "shortcuts" by detecting splicing artifacts rather than understanding the object's logic.

LogicAL addresses logical anomalies, such as a breakfast box missing a component or a bag containing the wrong type of hardware. These defects are challenging because every part of the image appears locally normal; the error lies in the global context. LogicAL shifts the synthesis process from the pixel domain to the edge domain to capture these high-level relationships more effectively.

Methodology

The LogicAL framework consists of two primary stages: Anomaly Synthesis and Anomaly Localization.

1. Anomaly Synthesis

Instead of direct pixel manipulation, LogicAL operates on edge maps extracted via a pre-trained detector (PiDiNet). This approach treats edges as the "language" of geometry, stripping away distracting textures. The system applies three core strategies to these maps:

  • Remove: Deletes edges to simulate missing components.
  • Replace: Swaps edges with those from other samples to simulate incorrect parts.
  • Merge: Combines edges to create complex, multi-defect scenarios.

To ensure the synthesized anomalies are photo-realistic and free of telltale artifacts, an Edge-to-Image Generator (based on pix2pixHD and DeepSIM) renders the modified edge maps back into the image domain. This forces the localization model to learn actual object features rather than simple image-editing signatures.

2. Anomaly Localization

The localization network uses a reconstruction-based architecture that attempts to "fix" anomalous inputs. A key innovation is the inclusion of an edge reconstruction branch, which acts as a spatial prior, forcing the network to pay close attention to the structural layout and boundaries of objects.

The LogicAL framework: Anomaly Synthesis via edge manipulation and Anomaly Localization via reconstruction.

Key Results and Insights

LogicAL was evaluated on several industry-standard benchmarks, demonstrating superior performance in localizing subtle logical discrepancies:

  • MVTecLOCO: LogicAL achieved 69.7 pixel AU-sPRO, significantly outperforming the previous state-of-the-art (SLSG at 67.3). It showed particular strength in the "Logical" sub-category.
  • MVTecAD: The model reached a mean 98.3 pixel AU-ROC, proving that focusing on logical synthesis does not compromise the ability to detect traditional structural defects.
  • Qualitative Success: Visualizations confirm the model's sensitivity to subtle errors, such as misplaced imprints on electronic components or incorrect fill levels in bottles, even when the components themselves appear normal.
Qualitative localization results on MVTecLOCO and MVTecAD datasets.

Conclusion

LogicAL demonstrates that edges are a powerful medium for representing the underlying logic of industrial assemblies. By combining edge manipulation with high-fidelity GAN-based rendering, the framework provides a robust way to train models for complex, real-world inspection tasks. Future work may explore more intricate logical constraints, such as functional relationships or orientation-based rules, to further enhance the model's reasoning capabilities.

Summary updated

BibTeX
@inproceedings{zhao2024logical,
  author = {Ying Zhao},
  title = {{LogicAL: Towards logical anomaly synthesis for unsupervised anomaly localization}},
  booktitle = {Workshops @ CVPR},
  year = {2024},
  doi = {10.1109/cvprw63382.2024.00406},
}
Figure