# Rail-STrans: A Rail Surface Defect Segmentation Method Based on Improved Swin Transformer
## 1 Introduction
[21] proposed a deep convolutional neural-network-based transfer learning (DCTL) approach to achieve effective damage identification in the health monitoring of sharp rail structures through affine transform data enhancement using a pre-trained Inception-ResNet-V2 model and a 1D signal-to-2D image conversion technique, and it showed higher performance than the traditional approach in the experiments. [PERSON] et al. [22] introduced a deep-learning-based multi-object detection system for the non-destructive assessment of railway components employing an enhanced YOLOv5 for localization and Mask R-CNN for defect segmentation on rail surfaces, complemented by a ResNet framework for fastener classification. Extensively tested on images from the Shijiazhuang-Taiyuan high-speed railway, the method demonstrates superior performance over other deep learning approaches, ensuring reliable detection of rail and fastener defects. Deep-learning-based detection methods can be categorized into three types: image classification (image level), target detection (region level), and semantic segmentation (pixel level). Among them, image classification methods cannot provide the exact location of defects. Although target detection methods can effectively detect the location information of the target, they cannot realize fine target segmentation or obtain the precise features of the target. However, semantic segmentation methods can accurately obtain the category features and location information of the target, which play a crucial role in assessing the health condition of HSR rails and making maintenance decisions. Therefore, the semantic segmentation method is the most effective method for rail surface defect detection. [PERSON] et al. [23] developed a fast and cost-effective method for rail surface defect detection using only a low-cost camera through deep learning and semantic segmentation techniques, achieving accuracy comparable to magnetic particle inspection, with the potential to further improve detection speed using high-frequency cameras. Aiming at the problems of small defects and an insufficient number of samples in the detection of rail surface defects, [PERSON] et al. [24] introduced a deformable convolution and attention mechanism in the FPN network to improve the model's ability to detect defects at different scales, and they utilized the migration learning strategy to perform the feature extraction in the new network architecture. Finally, they realized the effective classification of defects through the multimodal network structure. In designing the framework for a semantic segmentation network, [PERSON] et al. [25] proposed Fully Convolutional Networks (FCNs). The FCN replaces the last fully connected layer in a traditional convolutional neural network with an inverse convolutional layer, allowing for an 'end-to-end' semantic segmentation output. [PERSON] et al. [26] proposed the SegNet network architecture based on the FCN. The network employs a symmetric encoder-decoder structure and up-samples the input features based on the maximum pooling index stored in the corresponding encoder layer. This effectively reduces the loss of images' positional information and generates a dense feature map. [PERSON] et al. [27] proposed DeepLab network architecture based on the FCN and improved the accuracy of edge segmentation by introducing an atrous spatial pyramid pooling module to capture multiscale contextual semantic information. [PERSON] et al. [28] proposed a U-Net network architecture to bridge shallow and deep features through a kind of hopping connection, which effectively solves the problem of spatial information loss during FCN downsampling. To improve the segmentation accuracy of defects during the detection process, [PERSON] et al. [29] designed a multiscale feature pyramid and a multi-level feature fusion module based on the design idea of the feature pyramid.