Divide-and-Assemble: Learning Block-wise Memory for Unsupervised Anomaly Detection

Jinlei Hou, Yingying Zhang, Qiaoyong Zhong, Di Xie, Shiliang Pu, Hong Zhou

Abstract

Unsupervised anomaly detection typically relies on reconstruction error, yet deep autoencoders often generalize too effectively, reconstructing anomalies with high fidelity. This paper introduces the Divide-and-Assemble (DAAD) framework, which replaces pixel-wise reconstruction with a block-wise memory approach. By controlling the granularity of image division and assembly, the model is constrained to reconstruct inputs using only prototypical "normal" patterns. This approach, combined with adversarial learning in the DAAD+ variant, significantly widens the reconstruction error gap, leading to a 10.1% AUROC improvement over standard autoencoders on the MVTec AD benchmark.

Introduction

In unsupervised anomaly detection, models are trained exclusively on "normal" data with the expectation that they will fail to reconstruct unseen anomalies. However, standard Autoencoders (AEs) are often "too good" at generalizing, leading to low reconstruction errors even for anomalous regions. While previous work introduced memory modules to store normal patterns, these typically operated at a pixel-wise level. The authors argue that pixel-level memory is too fine-grained; individual pixels lack sufficient context, allowing the model to reconstruct almost any pattern by simply selecting the appropriate colors.

Methods: The Divide-and-Assemble Framework

The core of the proposed framework is the Block-wise Memory Module. Instead of processing individual pixels, the model divides feature maps into a grid of blocks. A memory bank stores prototypical "normal" block patterns learned during training. During the reconstruction phase, the model must "assemble" the output image using only these stored normal blocks.

Conceptual overview of the Divide-and-Assemble process showing how different block sizes (Small, Medium, Large) affect the ability to reconstruct normal vs. anomalous patterns.

Granularity Control

A key innovation is the discovery of "Goldilocks" granularity. The size of the blocks acts as a control for reconstruction capability. Small blocks (e.g., pixels) provide high reconstruction capability, making it too easy to reconstruct anomalies. Conversely, large blocks offer low reconstruction capability, making it difficult to reconstruct even normal samples accurately. The authors found that a "medium" block size maximizes the gap between normal and abnormal reconstruction errors.

Architecture

The DAAD framework integrates these memory modules into a U-Net-like architecture. Feature maps at various scales are passed through block-wise memory modules before being concatenated via skip connections to the decoder. This multi-scale approach ensures that both global structure and local details are captured within the memory constraints.

Detailed architecture of the DAAD framework, highlighting the Block-wise Memory Module and its integration into a multi-scale U-Net structure.

Adversarial Learning (DAAD+)

To detect subtle anomalies that might not significantly impact pixel-wise L2 loss, the authors introduced DAAD+. This version includes a discriminator that forces the model to match the semantic features of the input and the reconstruction. This adversarial component makes the detection of localized, fine-grained defects much more robust by focusing on semantic consistency rather than just pixel-level similarity.

Experimental Results

The researchers evaluated DAAD and DAAD+ across several benchmarks, including MVTec AD, MNIST, CIFAR10, and video datasets like UCSD Ped2.

  • MVTec AD Performance: DAAD+ achieved an image-level AUROC of 0.895, a 10.1% improvement over vanilla autoencoders. It outperformed many state-of-the-art reconstruction-based methods and even several feature-based methods that rely on external pre-trained datasets.
  • Video Datasets: Despite being designed for static images, the model achieved a competitive 0.941 AUROC on UCSD Ped2, demonstrating the robustness of the block-wise memory concept across different data types.

Conclusion

The Divide-and-Assemble framework addresses the over-generalization problem in anomaly detection by shifting from pixel-wise to block-wise memory. By empirically tuning the granularity of reconstruction, DAAD effectively prevents the model from accurately reconstructing anomalies. Future work may involve automating the selection of optimal block sizes and extending the framework with 3D convolutions for enhanced temporal modeling in video data.

Reference: Hou, J., et al. (2021). Divide-and-Assemble: Learning Block-wise Memory for Unsupervised Anomaly Detection. arXiv:2107.13118v1 [cs.CV].

Summary updated

BibTeX
@misc{hou2021divide,
  author = {Jinlei Hou and Yingying Zhang and Qiaoyong Zhong and Di Xie and Shiliang Pu and Hong Zhou},
  title = {{Divide-and-Assemble: Learning Block-wise Memory for Unsupervised Anomaly Detection}},
  year = {2021},
  eprint = {2107.13118},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2107.13118},
}
Figure