Please wait a minute...
Journal of ZheJiang University (Engineering Science)  2025, Vol. 59 Issue (9): 1838-1845    DOI: 10.3785/j.issn.1008-973X.2025.09.007
    
Lightweight YOLOv5s-OCG rail sleeper crack detection algorithm
Chaoqun DONG1,2(),Zhan WANG1,Ping LIAO1,Shuai XIE1,2,Yujie RONG1,Jingsong ZHOU1
1. College of Mechanical and Intelligent Manufacturing, Chongqing University of Science and Technology, Chongqing 401331, China
2. Oil and Gas Equipment Research Institute, Chongqing University of Science and Technology, Chongqing 401331, China
Download: HTML     PDF(1980KB) HTML
Export: BibTeX | EndNote (RIS)      

Abstract  

An improved YOLOv5s sleeper crack target detection algorithm was proposed, in response to the safety hazards posed by the increasing number of crack defects in high-speed rail sleepers due to extended service life, as well as the issues of missed and false detections of surface fine cracks in high-speed rail sleepers. In the backbone network of the YOLOv5s algorithm, the full-dimensional dynamic convolution based on the multi-dimensional attention mechanism was used instead of the traditional convolution to enhance the overall feature extraction ability of the network and improve the detection accuracy of fine cracks. An improved lightweight C3 structure was proposed based on the ConvNeXt module and depth-separable convolution to compress the model volume and accelerate the convergence of the network to improve the detection efficiency. The scale-optimized weighted GFPN feature fusion network was used to solve the problem of detail feature loss in the sampling process of small targets at multiple scales. The improved YOLOv5s sleeper crack target detection algorithm could solve the problem of missed detection of fine cracks on the sleeper surface effectively. The experimental results showed that the parameter count of the improved algorithm model was decreased by 19.7%, the accuracy rate, recall rate and mean average precision were increased by 1.8, 2.4 and 4.2 percentage points respectively, and the detection speed was up to 96 frames per second. The results verify that the proposed lightweight YOLOv5s-OCG algorithm model provides an effective solution for the real-time detection of surface cracks on sleepers.



Key wordsrail sleeper crack detection      object detection      omni-dimensional dynamic convolution      lightweight structure      feature fusion network     
Received: 03 April 2024      Published: 25 August 2025
CLC:  TP 391.4  
Fund:  国家自然科学基金资助项目(5227041805);国家重点研发计划资助项目(2018YFB2002205);重庆市教委资助项目(KJQN202001538).
Cite this article:

Chaoqun DONG,Zhan WANG,Ping LIAO,Shuai XIE,Yujie RONG,Jingsong ZHOU. Lightweight YOLOv5s-OCG rail sleeper crack detection algorithm. Journal of ZheJiang University (Engineering Science), 2025, 59(9): 1838-1845.

URL:

https://www.zjujournals.com/eng/10.3785/j.issn.1008-973X.2025.09.007     OR     https://www.zjujournals.com/eng/Y2025/V59/I9/1838


轻量化YOLOv5s-OCG的轨枕裂纹检测算法

针对高铁轨枕运行年限增加导致裂纹缺陷增多的安全隐患,以及高铁轨枕表面裂纹漏检与误检问题,提出改进的YOLOv5s轨枕裂纹目标检测算法. 在YOLOv5s算法主干网络中使用基于多维注意力机制的全维动态卷积代替传统卷积,提升网络整体的特征提取能力以提高细小裂纹的检测精度;根据ConvNeXt模块和深度可分离卷积提出改进的轻量化C3结构,压缩模型体积和加速网络的收敛以提高检测效率;使用尺度优化的加权GFPN特征融合网络,解决小目标多尺度下采样过程中细节特征丢失的问题,改进的YOLOv5s轨枕裂纹目标检测算法能够有效改善轨枕表面细小裂纹漏检问题. 实验结果表明:改进后的算法模型参数量减少了19.7%,精确率、召回率、平均精度均值分别提高了1.8、2.4和4.2个百分点,检测速度达96帧/s. 结果表明,提出的轻量化YOLOv5s-OCG算法模型为轨枕表面裂纹的实时性检测提供了一种有效解决方案.


关键词: 轨枕裂纹检测,  目标检测,  全维动态卷积,  轻量化结构,  特征融合网络 
Fig.1 YOLOv5s-6.0 network structure
Fig.2 Schematic diagram of ODConv structure
Fig.3 Schematic diagram of C3 module
Fig.4 Schematic diagram of ConvNeXt structure
Fig.5 Schematic diagram of lightweight C3 structure
Fig.6 Feature fusion structure diagram with different scales
Fig.7 YOLOv5 feature fusion network structure diagram
配置项配置规格
CPUIntel(R) Xeon(R) CPU E5-2680 v4 @2.40 GHZ
GPUNVIDIA GeForce RTX3060(12 G)
内存30 G
操作系统Ubuntu18.04
深度学习框架Pytorch1.11.0、CUDA11.3
编程语言Python
Tab.1 Experimental hardware and software environment
Fig.8 Annotated example and dataset example
编号模型ODConvC3_LIGHTGFPNPrecision/%Recall/%mAP@0.5/%FPS/(帧·s?1)P/106
1YOLOv5s44.459.742.9947.03
2YOLOv5s-O45.161.144.9917.03
3YOLOv5s-C44.761.144.8985.55
4YOLOv5s-G45.861.846.2927.35
5YOLOv5s-OC45.661.445.7965.56
6YOLOv5s-OG45.561.946.5927.35
7YOLOv5s-CG45.961.846.3955.62
8YOLOv5s-OCG46.262.147.1965.64
Tab.2 Ablation experiment results of YOLOv5s basic experiment and improved module
ModelPrecision/%Recall/%mAP@0.5/%FPS/(帧·s?1)P/106
Faster-RCNN41.943.832.612137.10
SSD40.354.438.13126.23
CenterNet43.656.141.87032.62
RetinaNet41.154.840.06428.55
YOLOv342.559.741.9889.31
YOLOv5s44.459.742.9947.03
YOLOv7-tiny43.156.842.0896.03
YOLOv5s-GhostNet40.856.138.51073.71
YOLOv5s-shufflenetv240.153.536.21100.84
YOLOv5s-OCG46.262.147.1965.64
Tab.3 Comparison experimental results between classic algorithm models and lightweight models
Fig.9 Detection effect and heatmaps under conditions before and after algorithm improvement
[1]   李修文, 曾承志, 杨荣华, 等 轨道故障引发的轮轨冲击特征研究[J]. 城市轨道交通研究, 2022, 25 (1): 122- 126
LI Xiuwen, ZENG Chengzhi, YANG Ronghua, et al Research on the characteristics of wheel rail impact caused by rail fault[J]. Urban Mass Transit, 2022, 25 (1): 122- 126
[2]   侯学良, 单腾飞, 薛靖国 深度学习的目标检测典型算法及其应用现状分析[J]. 国外电子测量技术, 2022, 41 (6): 165- 174
HOU Xueliang, SHAN Tengfei, XUE Jingguo Analysis of typical target detection algorithm based on deep learning and its application status[J]. Foreign Electronic Measurement Technology, 2022, 41 (6): 165- 174
[3]   WANG Y, ZHANG K, WANG L, et al An improved YOLOv8 algorithm for rail surface defect detection[J]. IEEE Access, 2024, 12: 44984- 44997
doi: 10.1109/ACCESS.2024.3380009
[4]   GIRSHICK R, DONAHUE J, DARRELL T, et al. Rich feature hierarchies for accurate object detection and semantic segmentation [C]// IEEE Conference on Computer Vision and Pattern Recognition. Columbus: IEEE, 2014: 580–587.
[5]   REN S, HE K, GIRSHICK R, et al Faster R-CNN: towards real-time object detection with region proposal networks[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017, 39 (6): 1137- 1149
doi: 10.1109/TPAMI.2016.2577031
[6]   LIU W, DRAGOMIR A, DUMITRU E, et al. SSD: single shot multibox detector [C]// European Conference on Computer Vision. Cham: Springer, 2016: 21–37.
[7]   薛雅丽, 贺怡铭, 崔闪, 等 基于改进YOLOv5的SAR图像有向舰船目标检测算法[J]. 浙江大学学报: 工学版, 2025, 59 (2): 261- 268
XUE Yali, HE Yiming, CUI Shan, et al Oriented ship detection algorithm in SAR image based on improved YOLOv5[J]. Journal of Zhejiang University: Engineering Science, 2025, 59 (2): 261- 268
[8]   REDMON J, DIVVALA S, GIRSHICK R, et al. You only look once: unified, real-time object detection [C]// IEEE Conference on Computer Vision and Pattern Recognition. Las Vegas: IEEE, 2016: 779–788.
[9]   李鑫, 李香蓉, 汪诚, 等 基于改进YOLOv5的航空发动机表面缺陷检测模型[J]. 激光与光电子学进展, 2023, 60 (16): 304- 313
LI Xin, LI Xiangrong, WANG Cheng, et al Aero-engine surface defect detection model based on improved YOLOv5[J]. Laser & Optoelectronics Progress, 2023, 60 (16): 304- 313
[10]   汪沛洁, 谌雨章, 王诗琦, 等 基于改进YOLOv5的鱼群小目标检测优化算法[J]. 湖北大学学报: 自然科学版, 2024, 46 (1): 14- 24
WANG Peijie, CHEN Yuzhang, WANG Shiqi, et al Optimization algorithm of fish shoal small target detection based on improved YOLOv5[J]. Journal of Hubei University: Natural Science, 2024, 46 (1): 14- 24
[11]   王宏志, 宋明轩, 程超, 等 基于改进 YOLOv5 算法的道路目标检测方法[J]. 吉林大学学报: 工学版, 2024, (9): 2658- 2667
WANG Hongzhi, SONG Mingxuan, CHENG Chao, et al Road object detection method based on improved YOLOv5 algorithm[J]. Journal of Jilin University: Engineering and Technology Edition, 2024, (9): 2658- 2667
[12]   令雅莉, 杨桂芹, 张又元, 等 基于改进算法YOLOv5+的混凝土轨枕裂纹检测[J]. 铁道标准设计, 2024, 68 (4): 70- 77
LING Yali, YANG Guiqin, ZHANG Youyuan, et al Crack detection of concrete sleeper based on improved algorithm YOLOv5+[J]. Railway Standard Design, 2024, 68 (4): 70- 77
[13]   王琳毅, 白静, 李文静, 等 YOLO系列目标检测算法研究进展[J]. 计算机工程与应用, 2023, 59 (14): 15- 29
WANG Linyi, BAI Jing, LI Wenjing, et al Research progress of YOLO series target detection algorithms[J]. Computer Engineering and Applications, 2023, 59 (14): 15- 29
doi: 10.3778/j.issn.1002-8331.2301-0081
[14]   GUO S, LI L, GUO T, et al Research on mask-wearing detection algorithm based on improved YOLOv5[J]. Sensors, 2022, 22 (13): 4933
doi: 10.3390/s22134933
[15]   LI C, ZHOU A, YAO A. Omni-dimensional dynamic convolution [C]// International Conference on Learning Representations. Appleton: [s.n.], 2022(1181): 1–20.
[16]   YANG B, BENDER G, LE Q V, et al. Condconv: conditionally parameterized convolutions for efficient inference [J]. Advances in Neural Information Processing Systems, 2019, 32.
[17]   CHEN Y, DAI X, LIU M, et al. Dynamic convolution: attention over convolution kernels [C]// IEEE/CVF Conference on Computer Vision and Pattern Recognition. Seattle: IEEE, 2020: 11030–11039.
[18]   LIU Z, MAO H, WU C Y, et al. A ConvNet for the 2020s [C]// IEEE/CVF Conference on Computer Vision and Pattern Recognition. New Orleans: IEEE, 2022: 11966–11976.
[19]   LIU Z, LIN Y, CAO Y, et al. Swin transformer: hierarchical vision transformer using shifted windows [C]// IEEE/CVF International Conference on Computer Vision. Montreal: IEEE, 2021: 9992–10002.
[20]   刘欢, 李云红, 张蕾涛, 等 基于MA-ConvNext网络和分步关系知识蒸馏的苹果叶片病害识别[J]. 浙江大学学报: 工学版, 2024, 58 (9): 1757- 1767,1780
LIU Huan, LI Yunhong, ZHANG Leitao, et al Identification of apple leaf diseases based on MA-ConvNext network and stepwise relational knowledge distillation[J]. Journal of Zhejiang University: Engineering Science, 2024, 58 (9): 1757- 1767,1780
[21]   朱宏禹, 韩建宁, 徐勇 基于改进型YOLOv5s的印刷线路板瑕疵检测[J]. 国外电子测量技术, 2023, 42 (3): 152- 159
ZHU Hongyu, HAN Jianning, XU Yong Printed circuit board blemishes detection based on the improved YOLOv5s[J]. Foreign Electronic Measurement Technology, 2023, 42 (3): 152- 159
[22]   TAN M, PANG R, LE Q V. EfficientDet: scalable and efficient object detection [C]// IEEE/CVF Conference on Computer Vision and Pattern Recognition. Seattle: IEEE, 2020: 10778–10787.
[23]   ZHAO C, SHU X, YAN X, et al RDD-YOLO: a modified YOLO for detection of steel surface defects[J]. Measurement, 2023, 214: 112776
doi: 10.1016/j.measurement.2023.112776
[24]   曹建斌. 基于深度学习的高速铁路混凝土轨枕裂纹检测[D]. 上海: 上海大学, 2020.
CAO Jianbin. Crack detection of railway concrete sleeper based on deep learning [D]. Shanghai: Shanghai University, 2020.
[25]   李飞, 胡坤, 张勇, 等 基于混合域注意力YOLOv4的输送带纵向撕裂多维度检测[J]. 浙江大学学报: 工学版, 2022, 56 (11): 2156- 2167
LI Fei, HU Kun, ZHANG Yong, et al Multi-dimensional detection of longitudinal tearing of conveyor belt based on YOLOv4 of hybrid domain attention[J]. Journal of Zhejiang Universit: Engineering Science, 2022, 56 (11): 2156- 2167
[26]   王安静, 袁巨龙, 朱勇建, 等 基于改进YOLOv8s的鼓形滚子表面缺陷检测算法[J]. 浙江大学学报: 工学版, 2024, 58 (2): 370- 380
WANG Anjing, YUAN Julong, ZHU Yongjian, et al Drum roller surface defect detection algorithm based on improved YOLOv8s[J]. Journal of Zhejiang University: Engineering Science, 2024, 58 (2): 370- 380
[27]   HAN K, WANG Y, TIAN Q, et al. GhostNet: more features from cheap operations [C]// IEEE/CVF Conference on Computer Vision and Pattern Recognition. Seattle: IEEE, 2020: 1577–1586.
[1] Jiarui FU,Zhaofei LI,Hao ZHOU,Wei HUANG. Camouflaged object detection based on Convnextv2 and texture-edge guidance[J]. Journal of ZheJiang University (Engineering Science), 2025, 59(8): 1718-1726.
[2] Huizhi XU,Xiuqing WANG. Perception of distance and speed of front vehicle based on vehicle image features[J]. Journal of ZheJiang University (Engineering Science), 2025, 59(6): 1219-1232.
[3] Shenchong LI,Xinhua ZENG,Chuanqu LIN. Multi-task environment perception algorithm for autonomous driving based on axial attention[J]. Journal of ZheJiang University (Engineering Science), 2025, 59(4): 769-777.
[4] Yongfu HE,Shiwei XIE,Jialu YU,Siyu CHEN. Detection method for spillage risk vehicle considering cross-level feature fusion[J]. Journal of ZheJiang University (Engineering Science), 2025, 59(2): 300-309.
[5] Hongzhao DONG,Shaoxuan LIN,Yini SHE. Research progress of YOLO detection technology for traffic object[J]. Journal of ZheJiang University (Engineering Science), 2025, 59(2): 249-260.
[6] Jiayi YU,Qin WU. Monocular 3D object detection based on context information enhancement and depth guidance[J]. Journal of ZheJiang University (Engineering Science), 2025, 59(1): 89-99.
[7] Juan SONG,Longxi HE,Huiping LONG. Deep learning-based algorithm for multi defect detection in tunnel lining[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(6): 1161-1173.
[8] Tianmin DENG,Xinxin CHENG,Jinfeng LIU,Xiyue ZHANG. Small target detection algorithm for aerial images based on feature reuse mechanism[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(3): 437-448.
[9] Yaolian SONG,Can WANG,Dayan LI,Xinyi LIU. UAV small target detection algorithm based on improved YOLOv5s[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(12): 2417-2426.
[10] Dingjian DU,Zunhai GAO,Zhuo CHEN. Wolfberry pest detection based on improved YOLOv5[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(10): 1992-2000.
[11] Siyi QIN,Shaoyan GAI,Feipeng DA. Video object detection algorithm based on multi-level feature aggregation under mixed sampler[J]. Journal of ZheJiang University (Engineering Science), 2024, 58(1): 10-19.
[12] Wei-long HE,Ping WANG,Ai-hua ZHANG,Ting-ting LIANG,Qiang-jie MA. On-line quantitative detection of welding arc shape based on object detection[J]. Journal of ZheJiang University (Engineering Science), 2023, 57(9): 1903-1914.
[13] Yan ZHANG,Jing-xue SUN,Ye-mei SUN,Shu-dong LIU,Chuan-qi WANG. Lightweight object detection based on split attention and linear transformation[J]. Journal of ZheJiang University (Engineering Science), 2023, 57(6): 1195-1204.
[14] Yao ZENG,Fa-qin GAO. Surface defect detection algorithm of electronic components based on improved YOLOv5[J]. Journal of ZheJiang University (Engineering Science), 2023, 57(3): 455-465.
[15] Na ZHANG,Xu-lei QI,Xiao-an BAO,Biao WU,Xiao-mei TU,Yu-ting JIN. Single-stage object detection algorithm based on optimizing position prediction[J]. Journal of ZheJiang University (Engineering Science), 2022, 56(4): 783-794.