NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

DMAD: Dual Memory Bank for Real-World Anomaly Detection

Jianlong Hu, Xu Chen, Zhenye Gan, Jinlong Peng, Shengchuan Zhang, Jiangning Zhang, Yabiao Wang, Chengjie Wang, Liujuan Cao, Rongrong JiarXiv 2024 · DOI

Abstract

Industrial surface defect detection often requires balancing model scalability with the ability to utilize limited annotated data. DMAD (Dual Memory Bank for Anomaly Detection) is a novel unified framework that addresses this by handling both unsupervised and semi-supervised anomaly detection across multiple object classes simultaneously. By maintaining separate memory banks for normal and abnormal patterns, the model learns a more precise decision boundary and leverages shared defect characteristics across different categories. DMAD achieves state-of-the-art performance on the VisA and MVTec-AD benchmarks, significantly outperforming previous unified models.

Introduction and Problem Formulation

In industrial manufacturing, detecting surface anomalies is a critical quality control step. Traditionally, this has been approached through two main paradigms: One-Class-One-Model, which trains a specific model for every product, and Unified Models, which use a single model for multiple object classes. While unified models are more storage-efficient, they typically rely on unsupervised learning from "normal" data, failing to effectively incorporate the few real-world anomaly examples that often become available over time.

Comparison of anomaly detection settings and the concept of cross-object defect learning.

As shown in Figure 3, existing unified models often ignore the potential for cross-object learning—the idea that a defect in one class (e.g., a scratch on chewing gum) can provide valuable information for detecting similar defects in another class (e.g., a cashew). DMAD bridges this gap by providing a mechanism to learn from these shared patterns in a semi-supervised manner.

The DMAD Framework

The DMAD architecture consists of three primary components designed to extract, store, and map features to anomaly scores.

The DMAD framework architecture, featuring the Patch Feature Encoder and Dual Memory Bank.

1. Patch Feature Encoder

Using a pre-trained WideResNet50 backbone, DMAD extracts local patch features. A critical innovation here is the Filter operation used during semi-supervised training. Since anomalous images are mostly composed of normal regions, the filter isolates the specific defective pixels based on ground-truth annotations, ensuring that only truly abnormal features enter the learning pipeline.

2. Dual Memory Bank ($M_D$)

The core of the system is the dual-bank structure:

  • Normal Bank ($M_n$): Stores a compressed set of prototypical normal feature patterns across all trained classes.
  • Abnormal Bank ($M_a$): In unsupervised settings, this bank is populated with pseudo-anomalies generated by fusing textures from the Describable Textures Dataset (DTD) with normal images. In semi-supervised settings, it incorporates real annotated anomalies. To combat data imbalance, an Anomaly Center Sampling strategy adds small perturbations to known anomalies, effectively expanding the bank's coverage.

3. Knowledge Enhancement & Mapping

For any input image patch, the model calculates its relationship to the nearest neighbors in both memory banks. This "knowledge"—derived from both distance metrics and cross-attention—is concatenated with the original feature and processed by a Multi-Layer Perceptron (MLP) to generate the final anomaly score.

Experimental Evaluation

DMAD was evaluated on the MVTec-AD and VisA datasets, which are standard benchmarks for industrial anomaly detection.

  • MVTec-AD: In a semi-supervised setting with only 10 annotated anomalies, DMAD achieved an Image-AUROC of 99.0 and a Pixel-AUROC of 98.2, setting a new record for unified models.
  • VisA: On this more complex dataset, DMAD showed dramatic improvements. In the unsupervised setting, it improved Average Precision (AP) by 42.9 points over the previous state-of-the-art (UniAD). In the 10-anomaly semi-supervised setting, it reached 94.9 AUROC.

Key Insights and Conclusion

A major finding of this research is the efficacy of Cross-Object Learning. The authors demonstrated that training on defects from one class significantly improves detection in unrelated classes, proving that defect patterns are often universal. Furthermore, the use of pixel-level filtering was shown to be essential; without it, the abnormal memory bank becomes polluted with normal features, degrading the decision boundary.

While DMAD requires pixel-level annotations for its filtering process—a potential hurdle for some industrial applications—it represents a significant step toward efficient, high-performance anomaly detection in real-world, multi-product environments.

Summary updated

BibTeX
@misc{hu2024dmad,
  author = {Jianlong Hu and Xu Chen and Zhenye Gan and Jinlong Peng and Shengchuan Zhang and Jiangning Zhang and Yabiao Wang and Chengjie Wang and Liujuan Cao and Rongrong Ji},
  title = {{DMAD: Dual Memory Bank for Real-World Anomaly Detection}},
  year = {2024},
  eprint = {2403.12362},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2403.12362},
}
Figure