## 2 Related Work
### Application of CNN and Transformer in Image Processing  
Before the application of CNNs in weld seam feature recognition, weld seam detection mainly relied on traditional image processing methods, such as edge detection [15], threshold segmentation [16], and morphological processing [17]. However, these methods functioned poorly in complex industrial environments, especially with noise interference and lighting changes. With the development of deep learning, CNNs have gradually become essential tools for weld seam recognition. Typical CNN architectures include convolutional layers, pooling layers, activation functions, fully connected layers, and deconvolution layers. These networks hierarchically extract feature representations, starting from low-level information and progressively capturing higher-level abstractions across each layer.  
CNN models, such as the U-Net architecture [18], are widely used in image processing. U-Net adopts an encoder-decoder symmetric structure, with skip connections to alleviate the information loss in deep networks. It performs well in both global semantic understanding and detail recognition. Improved versions of U-Net have further enhanced performance. For instance, U-Net++ improves feature consistency by optimizing skip connections [19], Attention U-Net introduces an attention mechanism to enhance the selection of key features [20], Res-UNet improves gradient flow in the U-Net architecture using residual connections [21], and Dense U-Net combines DenseNet's efficient feature propagation and reuse capabilities [22]. These improvements significantly increase model accuracy but typically come with higher computational costs. In contrast, ResNet50 [23] increases network depth moderately, maintaining high recognition performance while reducing computational complexity. Its powerful feature extraction ability captures multi-scale weld seam features. Therefore, we select ResNet50 as the CNN branch to ensure high recognition performance while optimizing computational resource usage.  
Early CNN-based deep learning methods extracted features using local convolutional kernels. However, due to the limitations of local receptive fields, these methods struggled to handle complex interferences in welding, such as noise, smoke, and spatter, resulting in limited performance. In contrast, the Transformer model [24] uses a self-attention mechanism to capture global features, showing higher performance and robustness in segmentation and recognition tasks in complex scenarios. Transformer models eliminate the sequential dependencies and local receptive field limitations of RNNs and CNNs, improving performance through parallel computation. They have achieved significant success in both natural language processing (NLP) and image processing. For example, Vision Transformer (ViT) [25] divides an image into a sequence of patches, enabling the adaptive modeling of global contextual information; DETR [26] unifies object detection and image segmentation into a sequence prediction task, simplifying traditional detection workflows through query mechanisms and self-attention. SegFormer [27], with its global modeling and lightweight decoder structure, maintains good recognition accuracy while reducing computational complexity. Additionally, Swin Transformer [28] captures cross-window global information using a window shifting strategy, providing multi-scale feature extraction capabilities. Given Swin Transformer's advantages in global modeling andcomputational efficiency, we choose it as the Transformer branch in this paper to enhance recognition performance.