Abstract
The detection of train track fasteners is an important task to ensure the safe, reliable, and long-term stable operation of the railway system. Under the high stress and dynamic loads during train operation, track fasteners play a crucial role in maintaining the alignment and structural integrity of the tracks. However, traditional manual inspection methods are time-consuming, labor-intensive, and error-prone, while existing defect-detection algorithms often have the problem of low accuracy. To address these challenges, an improved YOLOv8n algorithm named MGSF-YOLO for high-precision detection of train track fastener defects is proposed. Firstly, an attention mechanism MSAM that combines MSCA and CBAM is proposed. MSAM adaptively adjusts the feature dimensions of different channels and the attention intensity at spatial positions through convolution kernels of various scales. This allows the model to focus on key features and regions and simultaneously enhances information extraction by exploiting the correlations between channels, thereby improving the model’s detection performance. Secondly, GSConv is used to replace Conv. This not only reduces the number of model parameters and computational cost but also improves the model’s detection accuracy. Then, an SPPFPool module that integrates average pooling and max pooling is proposed. This module aggregates the edge, background, and contextual information of the entire image, alleviates the impact of image scale changes, enhances the model’s adaptability to inputs of different sizes, effectively reduces false positives and false negatives, and improves the detection accuracy. Finally, the FocalerIoU loss function is introduced to replace the original CIoU loss function, which improves the regression accuracy and accelerates the model’s convergence speed. Experimental results show that compared with YOLOv8n, MGSF-YOLO has achieved performance improvements. The number of model parameters has decreased by 12.2%, and the computational amount has been reduced by 6.1%. Without sacrificing the detection speed, the mean average precision (mAP) has also increased by 2.6%. On the coco128 dataset, the publicly available NEU-DET dataset, and the real-world fastener dataset collected from the Roboflow website, the mAP of MGSF-YOLO has increased by 1.6%, 2.4%, and 3.6%, respectively, compared to YOLOv8n. Compared with other models, MGSF-YOLO reaches the highest mAP value, fully demonstrating its superior generalization ability and detection accuracy. It provides a reliable solution for the detection of railway fastener defects.


































Data Availability
The data used to support the findings of this study is available from the corresponding author upon request.
References
Zhong H, Liu L, Wang J, Fu Q, Yi B (2022) A real-time railway fastener inspection method using the lightweight depth estimation network. Measurement 189:110613
Meng Y, Yang J, Liu S, Xu W, Chen G, Niu Z, Wang M, Deng T, Qin Y, Han M et al (2022) Nano-fiber based self-powered flexible vibration sensor for rail fasteners tightness safety detection. Nano Energy 102:107667
Hu Q, Fang F, Yuan R-J (2023) Fastener partial looseness identification of the ballastless track by a time-domain bayesian approach. Adv Struct Eng 26(10):1835–1846
Li S, Jin L, Jiang J, Wang H, Nan Q, Sun L (2022) Looseness identification of track fasteners based on ultra-weak FBG sensing technology and convolutional autoencoder network. Sensors 22(15):5653
Liu J, Huang Y, Zou Q, Tian M, Wang S, Zhao X, Dai P, Ren S (2019) Learning visual similarity for inspecting defective railway fasteners. IEEE Sens J 19(16):6844–6857
Qiang W, Bailin L, Yun H, Hong F (2018) An improved LBP feature for rail fastener identification. J Southwest Jiaotong Univ 53(5):893–899
Bai T, Yang J, Xu G, Yao D (2021) An optimized railway fastener detection method based on modified faster R-CNN. Measurement 182:109742
Ge X, Qin Y, Cao Z, Gao Y, Lian L, Bai J, Yu H (2023) A fine-grained method for detecting defects of track fasteners using rgb-d image. In: International Conference on Electrical and Information Technologies for Rail Transportation, Springer, pp 37–44
Aydin I, Sevi M, Salur MU, Akin E (2022) Defect classification of railway fasteners using image preprocessing and alightweight convolutional neural network. Turk J Electr Eng Comput Sci 30(3):891–907
Su S, Du S, Wei X, Lu X (2022) RFS-Net: railway track fastener segmentation network with shape guidance. IEEE Trans Circuits Syst Video Technol 33(3):1398–1412
Sohan M, Sai Ram T, Reddy R, Venkata C (2024) A review on yolov8 and its advancements. In: International Conference on Data Intelligence and Cognitive Informatics, Springer, pp 529–545
Wang L, Zang Q, Zhang K, Wu L (2024) A rail fastener defect detection algorithm based on improved yolov5. In: Proceedings of the Institution of Mechanical Engineers, Part F: Journal of Rail and Rapid Transit, 09544097241234380
Hou Q, Zhou D, Feng J (2021) Coordinate attention for efficient mobile network design. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp 13713–13722
Zhao Y, Ju Z, Sun T, Dong F, Li J, Yang R, Fu Q, Lian C, Shan P (2023) Tgc-yolov5: an enhanced yolov5 drone detection model based on transformer, gam & ca attention mechanism. Drones 7(7):446
Yang L, Zhang R-Y, Li L, Xie X (2021) Simam: a simple, parameter-free attention module for convolutional neural networks. In: International Conference on Machine Learning, PMLR, pp 11863–11874
Wang W, Dai J, Chen Z, Huang Z, Li Z, Zhu X, Hu X, Lu T, Lu L, Li H, et al (2023) Internimage: exploring large-scale vision foundation models with deformable convolutions. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp 14408–14419
Tang J, Lei J, Xu D, Ma F, Jia K, Zhang L (2021) Sa-convonet: sign-agnostic optimization of convolutional occupancy networks. In: Proceedings of the IEEE/CVF International Conference on Computer Vision, pp 6504–6513
Li J, Wen Y, He L (2023) Scconv: spatial and channel reconstruction convolution for feature redundancy. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp 6153–6162
Gupta C, Gill NS, Gulia P, Chatterjee JM (2023) A novel finetuned yolov6 transfer learning model for real-time object detection. J Real-Time Image Proc 20(3):42
Wang K, Wei Z (2022) Yolo v4 with hybrid dilated convolution attention module for object detection in the aerial dataset. Int J Remote Sens 43(4):1323–1344
Priya DK, Ramkumar M, Menaka D (2023) Rail fastener fault detection based on enhanced yolov7 model. In: 2023 International Conference on Circuit Power and Computing Technologies (ICCPCT), IEEE, pp 1681–1689
Wang C-Y, Yeh I-H, Mark Liao H-Y (2025) Yolov9: Learning what you want to learn using programmable gradient information. In: European Conference on Computer Vision, Springer, pp 1–21
Zhang Y-F, Ren W, Zhang Z, Jia Z, Wang L, Tan T (2022) Focal and efficient IOU loss for accurate bounding box regression. Neurocomputing 506:146–157
Zou H, Wang Z (2024) An enhanced object detection network for ship target detection in SAR images. J Supercomput 80:17377–17399
Guo M-H, Lu C-Z, Hou Q, Liu Z, Cheng M-M, Hu S-M (2022) Segnext: rethinking convolutional attention design for semantic segmentation. Adv Neural Inf Process Syst 35:1140–1156
Li H, Li J, Wei H, Liu Z, Zhan Z, Ren Q (2024) Slim-neck by gsconv: a lightweight-design for real-time detector architectures. J Real-Time Image Proc 21(3):62
Tian D, Yan X, Zhou D, Wang C, Zhang W (2024) Iv-yolo: a lightweight dual-branch object detection network. Sensors 24(19):6181
Cheng Z, Gao L, Wang Y, Deng Z, Tao Y (2024) Ec-yolo: effectual detection model for steel strip surface defects based on yolo-v5. IEEE Access 12:62765–62778
Fu J, Chen X, Lv Z (2022) Rail fastener status detection based on mobilenet-yolov4. Electronics 11(22):3677
Li X, Wang Q, Yang X, Wang K, Zhang H (2023) Track fastener defect detection model based on improved yolov5s. Sensors 23(14):6457
Li N, Wang M, Yang G, Li B, Yuan B, Xu S (2024) Dens-yolov6: a small object detection model for garbage detection on water surface. Multimed Tools Appl 83(18):55751–55771
Wang C-Y, Bochkovskiy A, Liao H-YM (2023) Yolov7: trainable bag-of-freebies sets new state-of-the-art for real-time object detectors. In: Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, pp 7464–7475
Liu J, Liu H, Chakraborty C, Yu K, Shao X, Ma Z (2021) Cascade learning embedded vision inspection of rail fastener by using a fault detection IoT vehicle. IEEE Internet Things J 10(4):3006–3017
Wang C-Y, Liao H-YM et al (2024) Yolov1 to yolov10: the fastest and most accurate real-time object detection systems. APSIPA Trans Signal Inf Process 13(1):1–13
Wang Z, Su Y, Kang F, Wang L, Lin Y, Wu Q, Li H, Cai Z (2025) Pc-yolo11s: a lightweight and effective feature extraction method for small target image detection. Sensors 25(2):348
Funding
This study was supported by the Key Laboratory Fund Project of National Defense Science and Technology (2022-JCJQ-L8-015-020), the Key Project of Scientific Research Project of Liaoning Provincial Department of Education (LJKZ0475), and the Innovation Support Program for High-level Talents of Dalian City (2022RJ03).
Author information
Authors and Affiliations
Contributions
All authors were involved in the conception and design of the algorithms, data collection and analysis was done by RHL, theoretical analysis and experiments were done by SWM and HNH, the first draft of the manuscript was written by SWM and HNH, and all authors have read and agreed to the published version of the manuscript.
Corresponding author
Ethics declarations
Conflict of interest
The authors declare no competing interests.
Ethical approval and informed consent
This article does not contain studies with human participants or animals. Statement of informed consent is not applicable since the manuscript does not contain any patient data.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Rights and permissions
Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.
About this article
Cite this article
Ma, S., Li, R. & Hu, H. Train track fastener defect detection algorithm based on MGSF-YOLO. J Supercomput 81, 494 (2025). https://doi.org/10.1007/s11227-025-07024-0
Accepted:
Published:
DOI: https://doi.org/10.1007/s11227-025-07024-0