Introduction
Surface Defect Detection (SDD) is a fundamental task in automated industrial quality control. Detecting defects such as hairline cracks or faint scratches is challenging because these features are often extremely small, elongated, and visually indistinguishable from the background material. Traditional methods, primarily based on Fully Convolutional Networks (FCNs), rely on static filters that lack the adaptability required for diverse defect morphologies. While recent query-based Transformers offer more dynamic processing, they typically operate solely in the spatial domain, struggling to separate subtle defects from complex, cluttered backgrounds.
To address these limitations, the authors propose WPFormer, a novel query-based Transformer that leverages both spatial and frequency domain information. By integrating wavelet transforms and prototype learning, WPFormer enhances the model's ability to capture fine-grained edge details while effectively filtering out background noise.
Proposed Methodology: The Dual-Domain Transformer (D2T)
The primary innovation of WPFormer is the Dual-Domain Transformer (D2T) decoder. Unlike standard decoders that process features in a single domain, the D2T decoder employs two parallel branches to refine queries using multi-scale image features.
Wavelet-enhanced Cross-Attention (WCA)
The WCA module operates in the frequency domain. It utilizes a Haar wavelet transform to decompose image features into low-frequency (structural) and high-frequency (detail/edge) components. A Multi-Scale Context Module (MSCM) is then employed to suppress background noise and amplify high-frequency signals. This focus on frequency is a "breakthrough point" for detecting "weak" defects; while a scratch might blend into the background spatially, its sharp edges produce a distinct high-frequency signature.
Prototype-guided Cross-Attention (PCA)
In the spatial domain, the PCA module addresses the computational redundancy and noise inherent in full pairwise attention. It uses a Prototype Learning Unit (PLU) to cluster image features into a compact set of semantically meaningful "prototypes" representing either "defect" or "background." By performing attention on these prototypes rather than every individual pixel, the model filters out redundant background information and focuses on the most discriminative clusters.
The overall architecture utilizes a PVTv2 backbone and a Feature Pyramid Network (FPN) to extract multi-scale features, which are then passed into the D2T decoder to generate final segmentation results.
Experimental Evaluation
WPFormer was evaluated on three diverse and challenging public datasets: ESDIs-SOD (strip steel defects), CrackSeg9k (multi-surface cracks), and ZJU-Leaper (fabric defects).
Key Results
WPFormer achieved state-of-the-art (SOTA) performance, outperforming 17 recent methods, including Mask2Former and SINetV2.
- Quantitative Performance: On average across the three datasets, WPFormer improved the Mean Absolute Error ($M$) by 12.14% and the weighted F-measure ($F^w_\beta$) by 2.88% compared to Mask2Former.
- Qualitative Analysis: Visual results demonstrate that WPFormer excels at identifying extremely thin cracks and ignoring background distractions like oil spots or intricate fabric patterns that often lead to false positives in other models.
Conclusion
WPFormer introduces a robust dual-domain approach to surface defect detection. By combining frequency-domain wavelet enhancement with spatial-domain prototype learning, it overcomes the limitations of static convolutions and spatial-only transformers. Future work will focus on optimizing the computational overhead of these dual-domain operations to meet the strict latency requirements of high-speed industrial manufacturing lines.
Summary updated