Introduction
Unsupervised anomaly detection is a critical task in computer vision, particularly for industrial quality control and video surveillance. The goal is to identify regions in an image that deviate from "normal" patterns without having seen specific anomalies during the training phase. This paper introduces the Multi-scale Memories and Attention Autoencoder (MMAE), a novel framework that enhances traditional autoencoders by incorporating multiple memory banks at varying resolutions.
The Challenge of Generalization
The standard approach to unsupervised detection involves training an Autoencoder (AE) to reconstruct normal data. The hypothesis is that the model will fail to reconstruct anomalous regions, allowing for detection via reconstruction error. However, deep AEs often suffer from a "generalization problem": they are frequently too effective at reconstructing anomalies because those defects share low-level visual patterns (like edges or colors) with normal data. While previous work like MemAE introduced a memory bank to constrain the latent space, it operated at a single scale, failing to capture anomalies that manifest at different spatial resolutions—from tiny scratches to large missing components.
Methodology
MMAE addresses these limitations through three key architectural innovations:
- Multi-Scale Memories: The architecture employs $K$ parallel encoders ($E_1, ..., E_K$). The input image $x$ is processed at multiple resolutions (e.g., from $16\times16$ to $256\times256$). Each scale has a dedicated memory bank $M_i$ containing prototypical normal features specific to that resolution.
- Memory Addressing with Hard Shrinkage: Encoded features act as queries to retrieve the most similar normal prototypes from the memory. A "hard shrinkage" operation is applied to the addressing weights to ensure that only the most relevant "normal" features are used, effectively filtering out anomalous signals and preventing the model from blending too many features.
- Multi-Scale Attention Fuser: The retrieved features from all scales are merged using an attention-based fuser. This allows the model to intelligently weigh information from different resolutions before the final decoder $D$ produces the reconstructed image $\hat{x}$.
The "Eraser" Effect
By forcing the reconstruction to use only stored normal prototypes, MMAE acts as a feature-level filter. When an anomalous feature (such as a crack) is encountered, the memory returns the closest normal equivalent (a smooth surface). This "erases" the anomaly in the reconstruction, leading to a high reconstruction error at the site of the defect, which facilitates precise localization.
Experimental Results
The researchers evaluated MMAE on the MVTec AD dataset, a benchmark for industrial inspection containing 15 categories of objects and textures with over 70 types of real-world defects. They also tested on video datasets (UCSD-Ped2, CUHK Avenue, and ShanghaiTech) using 3D convolutions to handle spatio-temporal anomalies.
Quantitative Performance
MMAE demonstrated superior performance in anomaly localization. On the MVTec AD benchmark, it achieved high Per-Region Overlap (PRO) scores across various object categories, significantly outperforming standard VAEs and GAN-based methods. For instance, it reached a PRO score of 0.948 on the "Toothbrush" category and 0.923 on "Hazelnut."
In video anomaly detection, MMAE achieved an AUC of 0.949 on UCSD-Ped2, surpassing the original single-scale MemAE (0.941). Qualitative analysis further confirmed that MMAE produces sharper and more accurate anomaly maps compared to the blurry outputs of traditional autoencoders.
Conclusion and Future Work
MMAE effectively leverages multi-scale representations to improve unsupervised anomaly detection. The use of memory banks as a physical bottleneck prevents the model from learning anomalous patterns. While highly effective for objects, the model shows some limitations on complex textures (like "Grid" or "Tile") where a fixed number of memory slots (set to 60 in experiments) may be insufficient. Future research into dynamic memory allocation could further enhance the robustness of this approach across diverse visual domains.
Summary updated