# Rail-STrans: A Rail Surface Defect Segmentation Method Based on Improved Swin Transformer
## 3 Results
### Experimental Results and Analysis
#### 3.2.2 Comparison Experiments  
To evaluate the effectiveness of the improved algorithm, this paper compares it with other models, including deeplabv3+ [49], segnext_mscan [50], U-Net, Swin Transformer, SegFormer [51], and Mask R-CNN+ [22], which were trained on the same dataset. The results of the comparison are presented in Table 2.  
To analyze the advantages of Rail-STrans, we compare the performance of Rail-STrans with other networks on several metrics. Based on the data in Table 2, Rail-STrans shows advantages in the following aspects:  
* Model size: The model size of Rail-STrans is 357 M, which is slightly larger than deeplabV3+, larger than segnext_mscan, U-Net, and swin_u \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline \multirow{2}{*}{**Model**} & \multirow{2}{*}{\begin{tabular}{c} **Model** \\ **Size/M** \\ \end{tabular} } & \multirow{2}{*}{**mAcc/\%**} & \multirow{2}{*}{\begin{tabular}{c} **mDice** \\ **Coefficient/\%** \\ \end{tabular} } & \multirow{2}{*}{\begin{tabular}{c} **Background** \\ **Acc/\%** \\ \end{tabular} } & \multirow{2}{*}{\begin{tabular}{c} **Defect** \\ **Acc/\%** \\ \end{tabular} } & \multirow{2}{*}{\
\begin{tabular}{c} **Background** \\ **Decic** \\ **Coefficient/\%** \\ \end{tabular} } & \multirow{2}{*}{
\begin{tabular}{c} **Defect** \\ **Coefficient/\%** \\ \end{tabular} } & \multirow{2}{*}{**FPS**} \\ \hline deeplabV3+ & 340 & 68.96 & 72.79 & 99.48 & 38.44 & 99.15 & 46.43 & 30.56 \\ \hline segnext\_mscan & 150 & 84.54 & 70.21 & 99.37 & 69.7 & 99.59 & 40.84 & 35.43 \\ \hline U-Net & 118 & 53.4 & 55.72 & 96.54 & 10.26 & 96.21 & 15.32 & 39.36 \\ \hline swin\_upernet & 701 & 86.76 & 81.21 & 98.82 & 74.69 & 99.17 & 63.26 & 33.87 \\ \hline SegFormer & 961 & 80.96 & 83.27 & 99.55 & 62.37 & 99.42 & 67.12 & 16.31 \\ \hline Mask R-CNN+ & 225 & 87.37 & 86.66 & 99.85 & 74.87 & 99.44 & 73.88 & 39.01 \\ \hline Rail-STrans & 357 & 90.1 & 89.5 & 99.42 & 80.78 & 99.54 & 79.46 & 37.83 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Results of comparative experiments. Figure 12: Partial picture display of ablation experiments. (**a**) Original picture; (**b**) swin_upernet; (c) swin_upernet + LPM; (**d**) Swin Transformer + SDEM; (**e**) Swin Transformer + MFFM; (**f**) Swin Transformer + LPM + SDEM; (**g**) Swin Transformer + MFFM + SDEM; (**h**) Swin Transformer + LPM + MFFM; (**i**) Rail-STrans. than SegFormer. The model size of Rail-STrans is moderate, which is larger than some lightweight networks, such as U-Net, but much smaller than SegFormer, which is much smaller, suggesting that it has some model compression advantages while maintaining high performance. * mAcc (mean accuracy): Rail-STrans has the highest average accuracy of 90.1%, which means it has the best overall classification performance. * mDice (mean dice) coefficient: Rail-STrans also has the highest average dice coefficient of 89.5%, indicating that it outperforms the other networks in terms of pixel-level segmentation accuracy. * Defect accuracy and defect dice coefficient: In terms of defect segmentation, Rail-STrans has a defect accuracy of 80.78% and a defect dice coefficient of 79.46%, which is also relatively good and sometimes second only to SegFormer. * Background accuracy and background dice coefficient: Rail-STrans performs very well in background classification and segmentation, with a background accuracy of 99.42% and a background dice coefficient of 99.54%, both of which are the highest among all networks. * FPS (Frames Per Second): Although Rail-STrans does not have the highest FPS, it is still able to provide processing speeds in excess of 37 FPS, which is acceptable for many real-time applications. Figure 13 shows the combined data of deeplabv3+, segnext_mscan, U-Net, Swin Transformer, SegFormer, and Mask R-CNN+ in terms of mAcc, mDice coefficient, FPS, and so on. It can be seen that Rail-STrans shows significant advantages in several key performance metrics, especially in average accuracy and average dice coefficient, as well as in the accuracy of background classification and segmentation.