Target Detection in B-scan images is currently a relatively effective method for rail flaw detection. To address the problem that traditional object detection algorithms tend to produce misjudgments and omissions for different types of flaws when detecting B-scan images, this paper proposes a flaw recognition algorithm for rail B-scan images based on the improved YOLOv9. Firstly, aiming at the problem of omissions and misjudgments, a novel multi-level feature fusion mechanism is proposed to improve model accuracy and reduce omissions and misjudgments. Then, aiming at the problems that traditional algorithms rely heavily on high-quality datasets and have a large model computational load, the loss function is optimized and the depthwise separable convolution is introduced to improve model training efficiency. Finally, verification of the improved YOLOv9 algorithm is conducted by testing various detection metrics of the YOLOv9 algorithm (before and after improvement) on the B-scan image dataset. The results show that the detection average precision (AP) of the YOLOv9 model after various improvements reaches 99.5%, and its performance outperforms other models.
YOLOv10和YOLO11与前代模型的提升主要在检测速度和检测效率方面,而对于B显图像检测过程中漏报误报问题,2种模型未有针对性改进。考虑到钢轨B显图像中各类损伤之间差异较小、分类较为模糊,且实际检测过程中对于精度要求较高,因此本文采用实际检测精度较高的YOLOv9作为模型基本架构进行改进,结合空间通道重构卷积(Spatial and Channel reconstruction Convolution,SCConv)和多层次特征融合模块(Semantics and Detail Infusion,SDI)构建1种多层次特征提取体系。
检测算法中交并比(Intersection over Union,IoU)代表预测框和目标框的交并比值,其数值越大,意味着预测的精度越高。而对应损失函数则为1减去交并比。
通过优化损失函数可有效降低训练中模型对数据集的依赖。由于YOLOv9中使用完全交并比损失函数(Complete Intersection over Union loss,CIoU),其参数只能反应宽高比而无法反应目标框与预测框的真实大小,且实际工况下钢轨B显图像中各类损伤面积存在一定差异。此种情况在检测简单损伤(如螺孔上裂,螺孔下裂等)和复杂损伤(螺孔组合裂纹)时体现尤为明显,使得模型在检测过程中难以判定目标框和预测框的差异,导致其泛化能力较弱。为弥补现有CIoU的缺陷,引入辅助边界框(Inner-Intersection over Union,Inner-IoU)和柔性损失函数(Soft Intersection over Union loss,SIoU)计算损失,以加速边界框定位准确性。前者Inner-IoU引入尺度因子比,控制辅助边界框的尺度大小,从而解决不同损伤面积差异带来的检测困难问题,通过对不同类型的损伤使用不同尺度因子辅助边界框,可以克服现有方法在泛化能力方面的局限;后者SIoU则直接优化交并比计算方式,从根本上解决预测框与目标框定位问题。其计算方式综合考量预测框与真实框之间的角度、中心距离和形状差异多种因素,而CIoU计算过程中只考虑宽高比,因此SIoU优势明显。为结合Inner-IoU与SIoU优势,将二者结合为辅助柔性损失函数(Inner-Soft Intersection over Union loss,Inner-SIoU)。
试验中主要采用准确度P、召回率R,F1分数、IoU为0.5时的均值平均精度(Mean Average Precision0.5,mAP0.5)和IoU为0.5到0.95时的均值平均精度(Mean Average Precision0.95∶0.5,mAP0.5∶0.95)5种评价指标比较不同模型的检测效果,测试的模型主要包括Faster-R-CNN,YOLOv5,YOLOv7,YOLOv8,YOLOv9和改进YOLOv9。数据集的测试和训练在Windows11系统和Pycharm集成开发环境完成,显卡为RTX4060,CUDA11.8,Torch 2.1.2。
HANBaoming, XIZhe, SUNYajie, et al. Statistical Analysis of Urban Rail Transit Operation in the World in 2022: a Review [J]. Urban Rapid Rail Transit, 2023, 36 (1): 1-8. in Chinese
ZHANGYuhua, XUGuiyang, LIPei, et al. Key Technology to Autonomous Ultrasonic Detection System of Rail Flaw Detection Car [J]. China Railway Science, 2015, 36 (5): 131-136. in Chinese
HEQing, CHENZhengxing, WANGQihang, et al. Research on B-Scan Image Recognition of Rail Defect Based on Improved YOLO V3 [J]. Journal of the China Railway Society, 2022, 44 (12): 82-88. in Chinese
HUANGXiaoyan, SHIYongsheng, ZHANGYuhua, et al. BP Neural Network Based on Rail Flaw Classification of RFD Car’s B-Scan Data [J]. China Railway, 2018 (3): 82-87. in Chinese
SUNCisuo, LIUJun, QINYong, et al. Intelligent Detection Method for Rail Flaw Based on Deep Learning [J]. China Railway Science, 2018, 39 (5): 51-57. in Chinese
[11]
GIRSHICKR. Fast R-CNN [C] // Proceedings of the IEEE International Conference on Computer Vision. New York: IEEE, 2015: 1440-1448.
[12]
GAVRILESCUR, ZET C, FOŞALĂUC, et al. Faster R-CNN: an Approach to Real-Time Object Detection [C] //2018 International Conference and Exposition on Electrical and Power Engineering (EPE). New York: IEEE Press, 2018: 165-168.
[13]
REDMONJ, DIVVALAS, GIRSHICKR, et al. You Only Look Once: Unified, Real-Time Object Detection [C] //Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition. New York: IEEE, 2016: 779-788.
[14]
REDMONJ, FARHADIA. YOLOv3: an Incremental Improvement [EB/OL]. [2018-04-08].
[15]
BOCHKOVSKIYA, WANGC, LIAOH M. YOLOv4: Optimal Speed and Accuracy of Object Detection [J]. 2020. DOI: 10.48550/arXiv.2004.10934 .
[16]
LIC Y, LIL L, JIANGH L, et al. YOLOv6: a Single-Stage Object Detection Framework for Industrial Applications [EB/OL]. [2024-03-19].
[17]
WANGC Y, BOCHKOVSKIYA, LIAOH Y M. YOLOv7: Trainable Bag-of-Freebies Sets New State-of-the-Art for Real-Time Object Detectors [C] // Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition. New York: IEEE Press, 2023: 7464-7475.
WANGBingshui, ZHENGShubin, CHAIXiaodong, et al. State Detection of Track Fastener Based on YOLO [J]. Transducer and Microsystem Technologies, 2021, 40 (4): 135-138. in Chinese
LIZhaoyang, LIBailin, LUOJianqiao, et al. High-Speed Rail Fastener Positioning Algorithm Based on Improved SSD Model [J]. Railway Standard Design, 2020, 64 (5): 24-29. in Chinese
YANGJiahao, ZUOHaoxuan, HUANGQicheng, et al. Lightweight Method for Crop Leaf Disease Detection Model Based on YOLO v5s [J]. Transactions of the Chinese Society for Agricultural Machinery, 2023, 54 (): 222-229. in Chinese
SHITianyun, HOUBo, LIGuohua, et al. Foreign Object Detection Method for Railway Contact Network Based on Improved DINO [J]. China Railway Science, 2024, 45 (4): 158-167. in Chinese
HOUFeifei, ZHANGZhixuan, CUIGuangyan, et al. DETR-MCA: Intelligent Detection Algorithm for Tunnel Lining Defects Based on GPR Images [J]. Journal of Railway Science and Engineering, 2025, 22 (4): 1840-1852. in Chinese
HOUFeifei, PENGYinghao, DONGJian, et al. Ground Penetrating Radar Hyperbolic Keypoint Detection and Object Localization Based on Dual YOLOv8-Pose Model [J]. Journal of Electronics & Information Technology, 2024, 46 (11): 4305-4316. in Chinese
MEITian, ZHANGYuhua, XIONGLonghui, et al. Research on Shallow Surface Flaw Classification and Evaluation of High-Speed Railway Based on Entropy Method [J]. Journal of Railway Science and Engineering, 2025, 22 (4): 1420-1431. in Chinese