Attention Modules Improve Image-Level Anomaly Detection for Industrial Inspection: A DifferNet Case Study

André Luiz Vieira e Silva, Francisco Simões, Danny Kowerko, Tobias Schlosser, Felipe Battisti, Veronica TeichriebWACV 2024

TL;DR

This paper introduces AttentDifferNet, a novel approach that enhances anomaly detection in industrial settings by integrating attention modules into the DifferNet framework. By enabling the model to better focus on relevant features, AttentDifferNet achieves state-of-the-art results on challenging "in-the-wild" industrial inspection datasets and improves performance on controlled benchmarks.

What Problem Does This Paper Address?

Automated visual inspection is crucial for industries like manufacturing and power delivery, but it's often hampered by the scarcity of defective samples needed to train deep learning models. This rarity, coupled with the high cost of misclassification, drives the need for unsupervised or semi-supervised anomaly detection methods. While existing methods like DifferNet show promise, they can struggle to effectively isolate defects from complex backgrounds, especially in "in-the-wild" scenarios where lighting, perspective, and clutter vary significantly. This paper aims to bridge this gap by improving the ability of anomaly detection models to focus on critical features, even in challenging, uncontrolled environments.

Methods

The core of this work is the integration of attention modules into the DifferNet framework. DifferNet itself is an unsupervised anomaly detection method that uses a convolutional neural network (CNN) backbone (specifically, a modified AlexNet) to extract features from normal (flawless) images. These features are then mapped to a latent space using a normalizing flow model, which learns the probability distribution of normal features. Anomalous images, having features with a low likelihood in this learned distribution, are then flagged.

The novelty here lies in enhancing DifferNet's feature extraction backbone by incorporating attention blocks. The authors experimented with two popular attention mechanisms:

  • Squeeze-and-Excitation Networks (SENet): This module adaptively recalibrates channel-wise feature responses by explicitly modeling inter-channel dependencies.
  • Convolutional Block Attention Module (CBAM): This module combines both channel and spatial attention, allowing the network to focus on both "what" and "where" to look in an image.

These attention modules are strategically placed within the CNN backbone (as shown in Figure 2), allowing them to learn to emphasize important features and suppress irrelevant ones at different levels of the network. The resulting enhanced model is named AttentDifferNet.

Datasets

The paper evaluates AttentDifferNet on three industrial inspection datasets:

  • InsPLAD-fault: This is an "in-the-wild" dataset featuring images of power line components captured by drones. It presents significant challenges due to variations in perspective, scale, lighting, and background. This dataset is highlighted as a key benchmark for real-world industrial anomaly detection.
  • MVTec AD: A widely used, popular benchmark for unsupervised anomaly detection, featuring objects and textures captured under controlled conditions.
  • Semiconductor Wafer Dataset: This dataset focuses on visual inspection of semiconductor wafers, also captured in controlled environments, but includes real-world defects.

Key Insights and Ideas

  • Attention is crucial for "in-the-wild" inspection: The primary hypothesis, strongly supported by the results, is that attention mechanisms significantly improve anomaly detection performance in uncontrolled, real-world scenarios by helping models focus on relevant objects and ignore distracting backgrounds.
  • Modular attention is effective: The paper demonstrates that popular, off-the-shelf attention modules (SENet and CBAM) can be easily integrated into existing state-of-the-art anomaly detection frameworks like DifferNet, leading to substantial improvements without requiring complex architectural redesigns.
  • Layer-specific attention benefits: The ablation study suggests that the placement of attention blocks within the network matters, with attention in deeper layers potentially having a greater impact on performance.
  • Controlled environments still benefit: While the focus was on "in-the-wild" scenarios, AttentDifferNet also shows improved or comparable performance on controlled datasets like MVTec AD and Semiconductor Wafer, indicating that attention is beneficial across different inspection conditions.

Key Results

  • State-of-the-art on InsPLAD-fault: AttentDifferNet (specifically the SENet variant) achieved state-of-the-art performance on the InsPLAD-fault dataset, demonstrating its effectiveness in challenging real-world conditions. The overall AUROC for AttentDifferNet (SENet) on this dataset was 94.34%, compared to DifferNet's 92.46%.
  • Improved performance on MVTec AD: AttentDifferNet (CBAM) achieved the highest overall AUROC (96.97%) among DifferNet variations on the MVTec AD dataset, outperforming the baseline DifferNet (94.69%). It also achieved state-of-the-art in the Screw category.
  • Consistent improvements: Across all three datasets, AttentDifferNet consistently outperformed the standard DifferNet, with an average improvement of 1.77 ± 0.25 percentage points in overall AUROC.
  • Qualitative improvements: Grad-CAM visualizations confirmed that AttentDifferNet (SENet) focuses more effectively on the object of interest in "in-the-wild" images, reducing background interference. In controlled environments, it showed a tendency to focus more directly on the defect itself.

Limitations and Future Work

  • Pixel-level annotations: The study focused solely on image-level anomaly detection and did not utilize pixel-level annotations, which could potentially lead to more precise localization. The authors suggest that attention modules could be beneficial for pixel-level analysis in the future.
  • Backbone choice: While AlexNet was used as the backbone for DifferNet and AttentDifferNet, other modern backbones (like ResNet) were used for comparison with other methods, suggesting potential for further improvements with different architectures.
  • Generalizability: While the paper shows strong results across different datasets, further investigation into the generalizability of AttentDifferNet to a wider range of industrial inspection tasks and defect types would be valuable.
  • Computational cost: While attention modules are generally efficient, their integration might introduce a slight increase in computational cost, which could be a consideration for real-time applications.

Summary updated

BibTeX
@inproceedings{silva2024attention,
  author = {André Luiz Vieira e Silva and Francisco Simões and Danny Kowerko and Tobias Schlosser and Felipe Battisti and Veronica Teichrieb},
  title = {{Attention Modules Improve Image-Level Anomaly Detection for Industrial Inspection: A DifferNet Case Study}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2024},
}
Figure