## 3 Proposed Method
### DRST-Net Dual-Branch Encoder  
CNNs are good at extracting local features, but they struggle to capture global information. On the other hand, Transformers are capable of modeling global dependencies, but they fall short in capturing fine details and local features. Therefore, a single encoder has limitations when handling complex tasks, as it cannot optimally process both detailed and comprehensive information simultaneously. Inspired by combining CNN and transformer models [20; 29; 30; 36], we propose a parallel encoder network structure that integrates ResNet50 and Swin Transformer to overcome the limitations of a single encoder. Specifically, in the Swin Transformer encoder branch, the input welding image \(Input\in\mathbb{R}^{H\times W\times 3}\) is passed through a linear embedding layer to transform it into fixed-size image patches, \(Input_{patch}\in\mathbb{R}^{4\times 4\times 3}\), ensuring no overlap between the patches. Figure 1: Dual-branch network architecture of DRST-Net: (**a**) The first image represents the initial processing in the Swin Transformer branch. (**b**) The second image shows the input for the ResNet branch. (**c**) The third image illustrates the final output results. The input image with dimensions \(H\times W\times 3\) is processed through two parallel branches. Where class denotes the number of classes, \(H\) denotes the height, \(W\) denotes the width, and \(C\) denotes the number of channels. The Swin Transformer encoding process consists of three stages. In the first stage, global information is extracted, resulting in the feature map \(F_{1}\in\mathbb{R}^{\frac{H}{4}\times\frac{W}{8}\times C}\). In the second stage, the patch size is reduced to 2, yielding the feature map \(F_{2}\in\mathbb{R}^{\frac{H}{8}\times\frac{W}{8}\times 2C}\), and a patch merging layer is applied for further processing. In the third stage, hierarchical feature extraction is introduced, producing the feature map \(F_{3}\in\mathbb{R}^{\frac{H}{16}\times\frac{W}{16}\times 4C}\). This stage performs downsampling operations at 4x, 8x, and 16x, enhancing the generation of multi-scale features and expanding the receptive field, which improves the model's ability to represent image hierarchies. The description of the Swin Transformer encoder branch is given in Formulas (1)-(3). \[G_{Swin}^{a}=SL_{a}(Patch\_Embed_{a}(Input))\in\mathbb{R}^{\frac{H}{4}\times \frac{W}{4}\times C} \tag{1}\]  
\[G_{Swin}^{b}=SL_{b}(Patch\_Merging_{b}(G_{Swin}^{a}))\in\mathbb{R}^{\frac{H}{8 }\times\frac{W}{8}\times 2C} \tag{2}\]  
\[G_{Swin}^{c}=SL_{c}(Patch\_Merging_{c}(G_{Swin}^{b}))\in\mathbb{R}^{\frac{H}{ 16}\times\frac{W}{16}\times 4C} \tag{3}\]  
where \(Input\in\mathbb{R}^{H\times W\times 3}\) represents the input welding image with 3 channels. The operations \(Patch\_Embed_{a}(. )\) and \(Patch\_Merging_{n}(. )\) correspond to the linear embedding layers and patch merging layers in each of the three stages. These operations progressively reduce the spatial resolution and increase the number of channels. The patch embedding process converts the image into a sequence of embedded patches, and patch merging allows the model to combine and reduce these patches' spatial dimensions as the model goes deeper, improving both computational efficiency and model performance on high-level feature extraction. The features generated at each stage, \(G_{Swin}^{a}\), \(G_{Swin}^{b}\), \(G_{Swin}^{c}\), are used for deeper feature extraction and fusion. Specifically, \"\(a\)\", \"\(b\)\", and \"\(c\)\" denote different hierarchical stages in the Swin Transformer encoding process, where each stage progressively reduces the spatial resolution while increasing the feature dimension. Through this multi-stage process, the Swin Transformer gradually extracts and integrates complex features from the welding image.