Feature Matching Driven Background Generalization Neural Networks for Surface Defect Segmentation
Abstract: In this paper, we address the challenge of background generalization in surface defect segmentation for surface-mounted device chips, particularly focusing on template-sample comparison algorithms. These algorithms often struggle with background features in templates and samples that exhibit spatial variations, including translation and rotation. The inherent spatial equivariance in CNN-based algorithms complicates the elimination of noise attributed to these spatial variations. To tackle this issue, we have developed the Background Generalization Network (BGNet). BGNet effectively reduces spatial variation noise by subtracting background features of samples and templates based on their matching relationships. It starts by extracting dense features rich in global and interactive information via a Siamese network, and then applies self- and cross-attention mechanisms from Transformers. The matching score is calculated based on feature similarity, with matching relations established using the Mutual Nearest Neighbor algorithm. These relations enable us to mitigate the noise caused by spatial variations and implement a multi-scale fusion of detailed and semantic information, leading to more accurate segmentation results. Our experiments on OCDs and PCBs datasets have shown that BGNet surpasses existing state-of-the-art methods in performance.