## 1 Introduction
[19] introduced a lightweight PCB defect detection model, light-PDD, which utilizes an improved cross-stage local structure for feature fusion. This model reduces the complexity, enhances the detection speed, and achieves high accuracy. Semantic segmentation involves partitioning an image into regions with different features, extracting regions of interest [20]. [PERSON] et al. [21] proposed an adaptive feature reconstruction network (AFRNet) consisting of a Siamese encoder with shared parameters and a symmetric feature reconstruction module. This significantly improves the segmentation accuracy of various benchmark models for defects on PCBs. [PERSON] et al. [22] proposed combining the similarity measurement of Siamese networks with encoder-decoder semantic segmentation networks to further enhance the segmentation capabilities for soldering defects on PCBs. Although both networks achieve high segmentation performance, their architectures require both template images and defect images as input, making the segmentation performance highly dependent on image matching, and the detection speed of the networks is relatively slow. Furthermore, the preparation of template images and defect images is tedious and requires high-level acquisition techniques. The UNet network proposed by [PERSON] et al. [23], which adopts a U-shaped encoder-decoder network structure, effectively utilizes the contextual information in images to enhance the segmentation accuracy and is widely applied in defect detection. [PERSON] et al. [24] introduced a multi-scale dynamic attention fusion UNet model (MDAF-UNet), providing an effective solution for the segmentation of defects in mobile phone backplanes. [PERSON] [25] proposed MCPAD-UNet for steel surface defect segmentation based on multi-scale cross-patch attention with dilated convolution. This model accurately identifies and segments defects in industrial processes, leveraging multi-scale contextual information to handle complex and subtle defects. In summary, the challenges in the segmentation of PCB soldering defects include small defect sizes, irregular contours, and significant interference due to background image similarity. In previous studies on PCB defect segmentation, most methods used template matching, such as in references [21; 22]. Although template matching can achieve satisfactory segmentation results, it requires both template images and defect images,which creates high data acquisition requirements and results in a slow segmentation speed. To address these issues, this paper proposes three critical improvements based on UNet. The UNet network structure only requires defect images for segmentation, and, after the improvements, the segmentation accuracy is enhanced and it meets the requirements regarding the real-time segmentation speed. First, we enhance the encoder's focus on the differences in features at different scales; second, we introduce a hybrid attention mechanism to reduce the background similarity interference and strengthen the ability to segment the contours of small soldering defects in images at various scales; third, we enhance the decoder's feature fusion capabilities. Under the condition of having only defect images, this paper achieves higher segmentation accuracy for PCB soldering defects while using a small number of model parameters and achieving a fast detection speed. The main contributions of this paper are as follows. 1. The encoder adopts a backbone network that varies in its attention to different scales, flexibly adjusting the degree of attention to differently scaled feature layers during the feature extraction stage. While maintaining an emphasis on shallower feature layers, it enhances the attention to deeper feature layers, thereby improving the overall model's ability to segment defect edges. 2. The dynamic hybrid attention module (DHAM) is proposed to replace the ordinary skip connections in the network.