# Rail-STrans: A Rail Surface Defect Segmentation Method Based on Improved Swin Transformer
## 3 Results
### Experimental Results and Analysis  
#### 3.2.1 Ablation Experiments  
This paper conducts a series of ablation experiments to demonstrate the effectiveness of the proposed algorithm. The experiments verify the important role that each module plays in the algorithm's improvement, including the LPM, MFFM, and SDEM modules. Table 1 presents the experimental results for each module and their respective combinations. The data table lists various network configurations and their corresponding evaluation metrics, such as Params Size, mAcc (mean accuracy), mDice (mean dice coefficient), background accuracy, defect accuracy, background dice, and defect dice. The original swin_upernet is an encoder with Swin Transformer as the backbone network and UPerNet [48] as the encoder-decoder network. The ablation experiment results demonstrate the significance of the MFFM (Multiscale Feature Fusion Module), SDEM (Spatial Detail Extraction Module), and LPM (Local Perception Module). By replacing the decoding network in the original swin_upernet with the SDEM and MFFM and forming an encoder-decoder semantic segmentation network \begin{table}
\begin{tabular}{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/\%** \\ **Coefficient/\%** \\ \end{tabular} } & \multirow{2}{*}{
\begin{tabular}{c} **Defect Dice** \\ **Coefficient/\%** \\ \end{tabular} } \\ \hline swin\_upernet & 701 & 85.04 & 72.31 & 99.27 & 70.81 & 99.55 & 45.07 \\ \hline swin\_upernet & \multirow{2}{*}{701} & \multirow{2}{*}{85.13} & \multirow{2}{*}{84.36} & \multirow{2}{*}{99.44} & \multirow{2}{*}{70.82} & \multirow{2}{*}{99.62} & \multirow{2}{*}{69.10} \\ + LPM & & & & & & & \\ \hline Swin Transformer & \multirow{2}{*}{508} & \multirow{2}{*}{87.56} & \multirow{2}{*}{87.41} & \multirow{2}{*}{99.45} & \multirow{2}{*}{75.67} & \multirow{2}{*}{99.54} & \multirow{2}{*}{75.28} \\ + SDEM & & & & & & & \\ \hline Swin Transformer & \multirow{2}{*}{556} & \multirow{2}{*}{86.44} & \multirow{2}{*}{85.11} & \multirow{2}{*}{99.43} & \multirow{2}{*}{73.45} & \multirow{2}{*}{99.56} & \multirow{2}{*}{70.66} \\ + MFFM & & & & & & & \\ \hline Swin Transformer + & \multirow{2}{*}{508} & \multirow{2}{*}{88.02} & \multirow{2}{*}{87.56} & \multirow{2}{*}{99.51} & \multirow{2}{*}{76.53} & \multirow{2}{*}{99.64} & \multirow{2}{*}{75.48} \\ LPM + SDEM & & & & & & & \\ \hline Swin Transformer + & \multirow{2}{*}{357} & \multirow{2}{*}{88.54} & \multirow{2}{*}{88.32} & \multirow{2}{*}{99.52} & \multirow{2}{*}{77.56} & \multirow{2}{*}{99.58} & \multirow{2}{*}{77.06} \\ MFFM + SDEM & & & & & & & \\ \hline Swin Transformer + & \multirow{2}{*}{556} & \multirow{2}{*}{86.98} & \multirow{2}{*}{87.62} & \multirow{2}{*}{99.32} & \multirow{2}{*}{74.64} & \multirow{2}{*}{99.63} & \multirow{2}{*}{75.61} \\ LPM + MFFM & & & & & & & \\ \hline Rail-STrans & 357 & 90.1 & 89.5 & 99.42 & 80.78 & 99.54 & 79.46 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Results of the comparison of ablation experiment modules. Figure 11: The training curve of loss function. with the Swin Transformer network alone, the model size can be effectively reduced while improving the mAcc and mDice coefficients. The MFFM is a feature fusion module that aids the model in capturing features at various scales. This is essential for semantic segmentation tasks that necessitate precise identification and localization of defect boundaries in an image. The data show that Swin Transformer + MFFM enhances mAcc from 85.04% to 86.44% compared to the base swin_upernet. Additionally, it significantly improves the defect dice coefficients from 45.07% to 70.66%. This suggests that the MFFM has a positive impact on the model's performance, particularly in capturing details.