Abstract
As automation advances in manufacturing, the demand for precise and sophisticated defect detection technologies grows. Existing vision models for defect recognition methods are insufficient for handling the complexities and variations of defects in contemporary manufacturing settings. These models especially struggle in scenarios involving limited or imbalanced defect data. In this work, we introduce MemoryMamba, a novel memory-augmented state space model (SSM), designed to overcome the limitations of existing defect recognition models. MemoryMamba integrates the state space model with the memory augmentation mechanism, enabling the system to maintain and retrieve essential defect-specific information in training. Its architecture is designed to capture dependencies and intricate defect characteristics, which are crucial for effective defect detection. In the experiments, MemoryMamba was evaluated across four industrial datasets with diverse defect types and complexities. The model consistently outperformed other methods, demonstrating its capability to adapt to various defect recognition scenarios.
Introduction
In modern manufacturing, identifying surface defects like cracks or scratches is critical for quality control. While deep learning has automated much of this process, two major hurdles remain: data scarcity and the trade-off between complexity and efficiency. Industrial defects are rare by definition, leading to "long-tailed" datasets where models struggle to learn from limited samples. Furthermore, while Convolutional Neural Networks (CNNs) often miss long-range dependencies, Vision Transformers (ViTs) provide global context but suffer from high computational costs.
MemoryMamba addresses these gaps by bringing the efficiency of State Space Models (SSMs) to industrial defect recognition. By integrating a dual-grained memory-augmentation mechanism, the model can "remember" and retrieve historical defect patterns, allowing it to significantly outperform standard architectures—especially in data-scarce or imbalanced manufacturing environments.
Architecture and Methodology
The MemoryMamba architecture follows a hierarchical structure similar to modern vision backbones but replaces standard layers with specialized Mem-SSM Blocks.
The Mem-SSM Block and Memory Augmentation
The core innovation lies in the integration of memory encoding within the SSM framework. The system consists of three main components designed to capture and leverage prototypical defect information:
- Dual-Grained Memory Encoding: The model maintains two distinct memory networks. The Coarse-Grained network focuses on high-level class distinctions using contrastive learning to separate defect categories. The Fine-Grained network captures intricate, subtle characteristics using Mutual Information Maximization to ensure the memory captures detailed features essential for distinguishing similar-looking defects.
- 2D Selective Scan Module: Based on the Mamba (SSM) architecture, this allows the model to achieve a global receptive field with linear computational complexity, providing the efficiency required for real-time deployment.
- Fusion Module: This acts as a retrieval engine, calculating the similarity between current image features and stored memory vectors to integrate historical knowledge back into the feature map.
Experimental Evaluation
The researchers evaluated MemoryMamba on four diverse industrial benchmarks:
- Aluminum: Surface defects (4 categories).
- GC10: Metallic surface defects (10 categories).
- MT (Magnetic Tile): Defects in magnetic tiles (6 categories).
- NEU (Northeastern University): Hot-rolled steel strip defects (6 categories).
Key Insights
- Memory as a Prior: Unlike standard models that may lose specific sample nuances during weight updates, MemoryMamba explicitly stores defect "prototypes," acting as a powerful inductive bias for generalization.
- Hierarchical Retrieval: By splitting memory into coarse and fine grains, the model mimics human expertise—first identifying the general type of problem and then looking for specific, minute details.
- Synergy of Components: Ablation studies revealed that the coarse and fine memory components work synergistically; removing both caused a disproportionately larger failure than removing either one individually.
Results
MemoryMamba consistently outperformed established architectures like ResNet, DeiT, Swin Transformer, and the original VMamba across Accuracy, Precision, Recall, and F1 Score.
- NEU Dataset: Achieved a near-perfect 99% accuracy, significantly outperforming the baseline VMamba-B (94%) and ResNet152 (94%).
- Aluminum Dataset: Reached 75% accuracy, a substantial jump over the 65% achieved by the next best model (VMamba-B).
- Efficiency: By leveraging the SSM backbone, the model maintains the computational efficiency necessary for factory-floor deployment without the heavy overhead of traditional Transformers.
Conclusion
MemoryMamba demonstrates that integrating memory augmentation with State Space Models provides a robust solution for industrial defect recognition. While the current work focuses on classification, future research may explore extending this memory-augmented approach to defect localization (segmentation) and handling "open-set" recognition for previously unseen defect types.
Summary updated