Attention-guided few-shot learning for metal surface defect classification
摘要
In the era of industrial transformation and intelligent manufacturing, ensuring the surface quality of metal materials is crucial for maintaining component performance and system reliability. Although deep learning-based visual inspection has shown promise in automating defect detection, existing methods heavily rely on large-scale labeled data, which are often scarce and costly to obtain in industrial settings. Furthermore, the high inter-class similarity and variability of metal surface textures pose additional challenges to robust defect classification under low-data regimes. To address these issues, we propose an attention-guided few-shot learning framework specifically tailored for metal surface defect classification. Our method comprises two key components. First, we design a Dual-Branch Attention Module to enhance feature extraction by explicitly modeling both channel-wise dependencies and spatial saliency. This module leverages lightweight convolutional operations to highlight discriminative regions and mitigate feature degradation due to limited training data. Second, we introduce a Cross-Set Guided Attention mechanism to improve semantic alignment between support and query samples. By employing scaled dot-product attention, the model dynamically adjusts feature representations based on cross-sample correlations, thereby enabling fine-grained discrimination of visually similar defect types. Extensive experiments conducted on benchmark metal defect datasets demonstrate that our framework significantly outperforms existing few-shot learning baselines in both classification accuracy and generalization capability. The proposed method provides a practical and efficient solution for real-time industrial quality inspection in data-scarce scenarios.