## 2 Basic Principles
### Swin Transformer  
The Swin Transformer neural network architecture is specifically designed for computer vision tasks, particularly image classification and object detection. In recent years, the Swin Transformer neural network has been widely applied in fields such as medicine, transportation, and fire prevention, improving the efficiency of identifying objects such as tumors, fires, and abnormal vehicles. However, its application in the field of signal recognition, especially in acoustic emission signal recognition, is relatively limited. Its overall architecture, as shown in Figure 1, consists of four stages, each containing similar repeating units. Firstly, the Patch Partition divides the input RGB (Red, Green, Blue) image of dimension H(High) \(\times\) W(Width) \(\times\) 3 into non-overlapping patches of equal size. Each patch is treated as a token and serves as the effective input sequence length for the Swin Transformer.  
The first stage consists of a Linear Embedding and a Swin Transformer Block. It projects the input sequence to an arbitrary dimension and conducts feature learning using the Swin Transformer Block. In the remaining three stages, Patch Merging is used instead of Linear Embedding. Its function is to improve sampling accuracy, i.e., to reduce the range of each token while increasing the number of channels. This allows the Swin Transformer Block to learn more features. After four stages of downsampling and feature learning, the classification results are finally output through global pooling and fully connected layers [34; 35].  
The structure of the Swin Transformer Block is illustrated in Figure 2. It mainly consists of LN (Layer Normalization), W-MSA (Window-based Multi-head Self-Attention), SW-MSA (Shifted Window-based Multi-head Self-Attention), MLP (Multi-Layer Perceptron), and residual connections.  
Generally, blocks within each stage comprise an even number of similar Swin Transformer Blocks. The main difference between Swin Transformer Blocks lies in whether SW-MSA or W-MSA is used. The input features are first normalized by LN, followed by feature learning using W-MSA or SW-MSA. Residuals are then computed, followed by normalization again. Finally, output features are obtained through MLP and residual calculations.  
Swin Transformer has several variants according to the differences in the number of Swin Transformer Blocks (B) in each stage, the number of heads (H) in the multi-head self-attention layer, and other parameters. In this paper, we utilized Swin T (Tiny), Swin S (Small), Swin B (Base), and Swin L (Large). The main structures corresponding to each model are summarized in Table 1.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Model** & **Swin T** & **Swin S** & **Swin B** & **Swin L** \\ \hline stage1 & 2B, 3H & 2B, 3H & 2B, 4H & 2B, 6H \\ stage2 & 2B, 6H & 2B, 6H & 2B, 8H & 2B, 12H \\ stage3 & 6B, 12H & 18B, 12H & 18B, 16H & 18B, 24H \\ stage4 & 2B, 24H & 2B, 24H & 2B, 32H & 2B, 48H \\ \hline \hline \end{tabular}
\end{table}
Table 1: Swin Transformer subspecies network architecture.  
Figure 1: Swin Transformer Network Architecture.  
Figure 2: Swin Transformer Block structure.