# Rail-STrans: A Rail Surface Defect Segmentation Method Based on Improved Swin Transformer
## 4 Conclusions  
This study presents Rail-STrans, an encoder-decoder model based on an improved Swin Transformer network, to address the challenges of intelligent segmentation of surface defects on high-speed rail in complex scenarios. The proposed method is effective for the problem posed by non-equilibrium small datasets characterized by diversity and scale variability. The effectiveness of Rail-STrans is verified through a series of experiments and comparisons with other classical semantic segmentation methods. To begin with, we addressed the challenge of a limited black-and-white rail dataset by creating a larger and more diverse dataset of rail surface defects through field photography, data labeling, and data expansion. This approach not only provides ample data resources for future research but also ensures the adequacy and accuracy of model training. Secondly, we incorporated two Local Perception Modules (LPMs) into the Swin Transformer coding network. This enhancement allows for the acquisition of local contextual information, thereby improving segmentation accuracy. Our experimental results clearly demonstrate this improvement. Additionally, we integrated the Multiscale Feature Fusion Module (MFFM) into the decoding network. This module combines the feature information of defects at different scales during the decoding process, resulting in a significant improvement in the accuracy of multiscale defect segmentation. Additionally, we incorporated the Spatial Detail Extraction Module (SDEM) into the decoding network to preserve spatial detail information, further enhancing the segmentation accuracy of small-scale defects. Finally, we conducted ablation experiments to verify the function and role of each module. Our method outperforms other classical state-of-the-art networks in terms of mAcc, mDice coefficients, and FPS. It is a comprehensive improvement over other networks. Our research addresses the challenges of small datasets and variable defect scales in intelligent surface defect detection on high-speed rail. Additionally, we propose a new and effective semantic segmentation  
Figure 14: The visual segmentation results of different models. (**a**) Original picture; (**b**) deeplabV3+; (**c**) segnext_mscan; (**d**) U-Net; (**e**) swin_upernet; (**f**) SegFormer; (**g**) Mask R-CNN+; (**h**) Rail-STrans.  
method. These findings have significant implications for high-speed rail maintenance and related research.  
Conceptualization, C.S. and H.L.; methodology, C.S.; software, C.S.; validation, C.S.; formal analysis, C.S. and H.L.; resources, Y.H. and Z.M.; data curation, Y.H. and C.S.; writing--original draft preparation, C.S.; writing--review and editing, C.S. and H.L.; visualization, C.S.; project administration, H.L. All authors have read and agreed to the published version of the manuscript.  
This research was funded by the National Natural Science Foundation of China, grant number 62262021, and the Key Project of Science and Technology Research of the Jiangxi Department of Education, grant number GJJ200603.  
Not applicable.  
The authors declare no conflicts of interest.