Intelligent detection method for metro track defect targets based on improved YOLOv8s algorithm
-
摘要: 针对轨道状态检测中的小尺寸目标、样本不均衡、检测精度低和实时性要求高等问题,提出了一种融合小目标检测算法和Focal Loss损失函数的地铁轨道缺陷目标检测方法;通过数据清洗和图像标注构建了TrackScanner缺陷数据集,并针对数据集存在的“小目标样本”和“正负样本不均衡”问题,在YOLOv8s算法的基础上进行针对性改进;针对“小目标样本”问题增加了轻量化的双重注意力机制模块、真内卷模块和检测尺度为160×160的小目标检测头,通过联合改进措施提升算法对关键细节的关注度;针对“正负样本不均衡”问题引入了Focal Loss损失函数,此改进通过权重因子和损失因子调节损失函数预测结果值;通过模型训练与消融试验,对比分析了本文所提算法在轨道状态检测领域的效果和优势。研究结果表明:改进YOLOv8s算法的mAP50、F1和检测效率分别为71.70%、73.43%和46.84帧·s-1,对扣件缺失、扣件反装、扣件移位、扣件断裂、道床异物和轨面擦伤等缺陷目标的检测精度分别为82.6%、65.8%、72.3%、25.3%、95.6%和88.6%。本研究适用于地铁轨道缺陷目标检测工作,可有效提升轨道巡检人员的工作效率,对保障轨道列车的安全运营至关重要。Abstract: For the problems of small-sized targets, sample imbalance, low detection accuracy, and high real-time requirements in track state detection, a detection method for metro track defect targets fusing a small target detection algorithm and the Focal Loss function was proposed. The TrackScanner defect dataset was constructed through data cleaning and image annotation. For the problems of "small target samples" and "unbalanced positive and negative samples" existing in the dataset, targeted improvements were made on the basis of the YOLOv8s algorithm. To address the problem of "small target samples", a lightweight dual attention mechanism module, an involution module, and a small target detection head with a detection scale of 160 × 160 were added. The attention of the algorithm to key details was enhanced through joint improvement measures. To address the problem of "unbalanced positive and negative samples", the Focal Loss function was introduced. This improvement regulated the predicted result value of the loss function through a weight factor and a loss factor. Through model training and ablation experiments, the effects and advantages of the proposed algorithm in the field of track state detection were compared and analyzed. Research results indicate that the mAP50, F1, and defection efficiency of the improved YOLOv8s algorithm are 71.70%, 73.43%, and 46.84 frame·s-1, respectively, and the detection accuracies for defect targets such as missing fastener, reversed fastener, shifted fastener, broken fastener, foreign object on the track bed, and rail surface abrasion are 82.6%, 65.8%, 72.3%, 25.3%, 95.6%, and 88.6%, respectively. This research is applicable to the detection work of metro track defect targets, can effectively enhance the work efficiency of track inspection personnel, and is crucial for ensuring the safe operation of track trains.
-
Key words:
- rail transit /
- track defect /
- YOLOv8s algorithm /
- small object detection /
- subway line /
- rail fastener /
- rail surface abrasion
-
表 1 TrackScanner数据集划分
Table 1. TrackScanner dataset split
数据集名称 图片数量/ 张 扣件缺失数量/个 扣件反装数量/个 扣件移位数量/个 扣件断裂数量/个 道床异物数量/个 轨面擦伤数量/个 训练集 786 150 15 21 2 408 229 验证集 98 21 1 2 1 51 26 测试集 99 22 3 2 1 45 32 合计 983 193 19 25 4 504 287 表 2 不同算法检测结果对比
Table 2. Comparison of detection results of different algorithms
算法 对各类缺陷目标的检测精度/% mAP50 /% F1/% 检测效率/ (帧·s-1) 扣件缺失 扣件反装 扣件移位 扣件断裂 道床异物 轨面擦伤 Faster R-CNN 89.2 32.5 50.0 5.8 65.9 74.3 52.95 65.80 9.57 Cascade R-CNN 90.9 33.6 76.4 11.6 68.4 68.3 58.20 69.40 7.39 YOLOv5 81.4 33.2 66.3 8.9 94.2 66.1 58.35 67.98 74.85 YOLOv8s 84.2 35.5 69.5 16.6 94.9 86.6 64.55 71.56 70.92 YOLOv10 80.9 49.7 33.2 0.0 85.4 60.8 62.00 65.54 136.99 本文算法 82.6 65.8 72.3 25.3 95.6 88.6 71.70 73.43 46.84 表 3 不同改进方法检测结果对比
Table 3. Comparison of detection results of different improved methods
算法 对各类缺陷目标的检测精度AP/% mAP50/% F1/% 检测效率/ (帧·s-1) 扣件缺失 扣件反装 扣件移位 扣件断裂 道床异物 轨面擦伤 YOLOv8s 84.2 35.5 69.5 16.6 94.9 86.6 64.55 71.56 70.92 YOLOv8s+小目标检测算法 83.3 42.3 68.9 18.3 95.4 88.3 66.08 73.33 48.31 YOLOv8s+损失函数 78.7 62.4 63.8 16.6 92.3 84.2 66.33 66.05 71.94 本文算法 82.6 65.8 72.3 25.3 95.6 88.6 71.70 73.43 46.84 -
[1] LIU R K, LIU W M, DUAN M F, et al. MemFormer: A memory based unified model for anomaly detection on metro railway tracks[J]. Expert Systems with Applications, 2024, 237: 121509. doi: 10.1016/j.eswa.2023.121509 [2] 杨彪, 梅子, 龙志强. 磁浮列车悬浮系统LSTM与MGD融合的在线异常检测方法[J]. 交通运输工程学报, 2023, 23(6): 216-231. doi: 10.19818/j.cnki.1671-1637.2023.06.014YANG Biao, MEI Zi, LONG Zhi-qiang. Online anomaly detection method integrating LSTM and MGD for suspension system of maglev trains[J]. Journal of Traffic and Transpor-tation Engineering, 2023, 23(6): 216-231. doi: 10.19818/j.cnki.1671-1637.2023.06.014 [3] 魏秀琨, 所达, 魏德华, 等. 机器视觉在轨道交通系统状态检测中的应用综述[J]. 控制与决策, 2021, 36(2): 257-282.WEI Xiu-kun, SUO Da, WEI De-hua, et al. A survey of the application of machine vision in rail transit system inspection[J]. Control and Decision, 2021, 36(2): 257-282. [4] 蒋仕新, 邹小雪, 杨建喜, 等. 复杂背景下基于改进YOLO v8s的混凝土桥梁裂缝检测方法[J]. 交通运输工程学报, 2024, 24(6): 135-147. doi: 10.19818/j.cnki.1671-1637.2024.06.009JIANG Shi-xin, ZOU Xiao-xue, YANG Jian-xi, et al. Con-crete bridge crack detection method based on improved YOLO v8s in complex backgrounds[J]. Journal of Traffic and Transportation Engineering, 2024, 24(6): 135-147. doi: 10.19818/j.cnki.1671-1637.2024.06.009 [5] 杨炜, 方虹苏, 唐湘松, 等. 桥梁裂缝病害检测的轻量化YOLOv8-ALTE算法[J]. 交通运输工程学报, 2025, 25(6): 75-89. doi: 10.19818/j.cnki.1671-1637.2025.06.007YANG Wei, FANG Hong-su, TANG Xiang-song, et al. Lightweight YOLOv8-ALTE algorithm for bridge crack disease detection[J]. Journal of Traffic and Transportation Engineering, 2025, 25(6): 75-89. doi: 10.19818/j.cnki.1671-1637.2025.06.007 [6] 翟军治, 孙朝云, 裴莉莉, 等. 多尺度特征增强的路面裂缝检测方法[J]. 交通运输工程学报, 2023, 23(1): 291-308. doi: 10.19818/j.cnki.1671-1637.2023.01.022ZHAI Jun-zhi, SUN Zhao-yun, PEI Li-li, et al. Pavement crack detection method based on multi-scale feature enhan-cement[J]. Journal of Traffic and Transportation Engi-neering, 2023, 23(1): 291-308. doi: 10.19818/j.cnki.1671-1637.2023.01.022 [7] HAMISHEBAHAR Y, GUAN H, SO S, et al. A compre-hensive review of deep learning-based crack detection approaches[J]. Applied Sciences, 2022, 12(3): 1374. doi: 10.3390/app12031374 [8] 李清勇, 王建柱, 祝叶舟, 等. 基于结构相似深度卷积自编码的异常扣件检测模型[J]. 交通运输工程学报, 2022, 22(4): 186-195. doi: 10.19818/j.cnki.1671-1637.2022.04.014LI Qing-yong, WANG Jian-zhu, ZHU Ye-zhou, et al. Abnor-mal fastener detection model based on deep convolutional autoencoder with structural similarity[J]. Journal of Traffic and Transportation Engineering, 2022, 22(4): 186-195. doi: 10.19818/j.cnki.1671-1637.2022.04.014 [9] 朱胜阳, 张庆铼, 袁站东, 等. 基于残差卷积网络的浮置板轨道钢弹簧损伤检测[J]. 交通运输工程学报, 2022, 22(2): 123-135. doi: 10.19818/j.cnki.1671-1637.2022.02.009ZHU Sheng-yang, ZHANG Qing-lai, YUAN Zhan-dong, et al. Damage detection for floating-slab track steel-spring based on residual convolutional network[J]. Journal of Traffic and Transportation Engineering, 2022, 22(2): 123-135. doi: 10.19818/j.cnki.1671-1637.2022.02.009 [10] 蔡智超, 陈澜, 李豪, 等. 基于非线性超声的CL60车轮和U75V钢轨磨损检测方法[J]. 交通运输工程学报, 2021, 21(6): 136-146. doi: 10.19818/j.cnki.1671-1637.2021.06.010CAI Zhi-chao, CHEN Lan, LI Hao, et al. Wear detection method of CL60 railway wheel and U75V rail steel based on nonlinear ultrasound[J]. Journal of Traffic and Transporta-tion Engineering, 2021, 21(6): 136-146. doi: 10.19818/j.cnki.1671-1637.2021.06.010 [11] DONG Y Q, YANG Y W, HAN C J, et al. Heterogeneous graph attention network for rail fastener looseness detection using distributed acoustic sensing and accelerometer data fusion[J]. Automation in Construction, 2025, 172: 106051. doi: 10.1016/j.autcon.2025.106051 [12] QIU S, ZAHEER Q, MUHAMMAD AHMED HASSAN SHAH S, et al. Multimodal geometric AutoEncoder (MGAE) for rail fasteners tightness evaluation with point clouds & monocular depth fusion[J]. Measurement: Journal of the International Measurement Confederation, 2025, 244: 116557. doi: 10.1016/j.measurement.2024.116557 [13] WANG W D, YIN Q, AI C B, et al. Automation railway fastener tightness detection based on instance segmentation and monocular depth estimation[J]. Engineering Structures, 2025, 322: 119229. doi: 10.1016/j.engstruct.2024.119229 [14] 黄石甫, 曹广如, 李斌, 等. 机器视觉在轨道扣件检测上的应用综述[J]. 轨道交通材料, 2024, 3(3): 45-53.HUANG Shi-pu, CAO Guang-ru, LI Bin, et al. Overview of the application of machine vision on the test of rail fasteners[J]. Materials for Rail Transportation System, 2024, 3(3): 45-53. [15] ZHAN Y, DAI X X, YANG E H, et al. Convolutional neu-ral network for detecting railway fastener defects using a developed 3D laser system[J]. International Journal of Rail Transportation, 2021, 9(5): 424-444. doi: 10.1080/23248378.2020.1825128 [16] 陈文婷, 罗文婷, 李林, 等. 基于2D与3D激光图像的轨道扣件状态智能检测[J]. 仪表技术与传感器, 2022(11): 88-95.CHEN Wen-ting, LUO Wen-ting, LI Lin, et al. Intelligent detection of track fastener status based on 2D and 3D laser images[J]. Instrument Technique and Sensor, 2022(11): 88-95. [17] 乔彦涵, 陈文, 邹劲柏, 等. 基于Transformer与局部特征融合的轨道紧固件缺陷检测方法[J]. 铁路计算机应用, 2024, 33(4): 18-22.QIAO Yan-han, CHEN Wen, ZOU Jin-bai, et al. Defect detection method for track fastener based on Transformer and local feature fusion[J]. Railway Computer Application, 2024, 33(4): 18-22. [18] 姜香菊, 冯海照, 李涛. 基于FasterNet和YOLOv8s改进的铁路异物入侵快速检测方法[J]. 北京交通大学学报, 2024, 48(5): 39-48.JIANG Xiang-ju, FENG Hai-zhao, LI Tao. Improved rapid detection method for foreign object intrusion on railroads based on FasterNet and YOLOv8s[J]. Journal of Beijing Jiaotong University, 2024, 48(5): 39-48. [19] 高嘉琳, 白堂博, 姚德臣, 等. 基于改进YOLOv4算法的铁路扣件检测[J]. 科学技术与工程, 2022, 22(7): 2872-2877.GAO Jia-lin, BAI Tang-bo, YAO De-chen, et al. Detection of track fastener based on improved YOLOv4 algorithm[J]. Science Technology and Engineering, 2022, 22(7): 2872-2877. [20] 李浪怡, 刘强, 邹一鸣, 等. 基于改进YOLOv5算法的轨面缺陷检测[J]. 五邑大学学报(自然科学版), 2021, 35(3): 43-48, 54.LI Lang-yi, LIU Qiang, ZOU Yi-ming, et al. Rail surface defect detection based on improved YOLOv5 algorithm[J]. Journal of Wuyi University (Natural Science Edition), 2021, 35(3): 43-48, 54. [21] QIU S, CAI B X, WANG W D, et al. Automated detection of railway defective fasteners based on YOLOv8-FAM and synthetic data using style transfer[J]. Automation in Construction, 2024, 162: 105363. doi: 10.1016/j.autcon.2024.105363 [22] 裴莹玲, 罗晖, 张诗慧, 等. 基于改进Faster R-CNN的高铁扣件检测算法[J]. 华东交通大学学报, 2023, 40(1): 75-81.PEI Ying-ling, LUO Hui, ZHANG Shi-hui, et al. High-speed railway fastener detection algorithm based on improved faster R-CNN[J]. Journal of East China Jiaotong University, 2023, 40(1): 75-81. [23] 许贵阳, 李金洋, 白堂博, 等. 基于改进Mask R-CNN的轨道扣件状态检测方法[J]. 中国铁道科学, 2022, 43(1): 44-51.XU Gui-yang, LI Jin-yang, BAI Tang-bo, et al. Detection method of track fastener state based on improved mask R-CNN[J]. China Railway Science, 2022, 43(1): 44-51. [24] 张博, 刘秀波. 基于机器视觉的圆斑状钢轨擦伤检测算法[J]. 铁道建筑, 2023, 63(1): 1-3, 9.ZHANG Bo, LIU Xiu-bo. Detection algorithm of circular spot rail scratch based on machine vision[J]. Railway Engi-neering, 2023, 63(1): 1-3, 9. [25] 邹文武, 许贵阳, 白堂博. 基于EfficientDet的轨道扣件识别与检测[J]. 武汉大学学报(工学版), 2024, 57(7): 1006-1012.ZOU Wen-wu, XU Gui-yang, BAI Tang-bo. Track fastener identification and detection based on EfficientDet[J]. Engi-neering Journal of Wuhan University, 2024, 57(7): 1006-1012. [26] 陈正兴. 基于计算机视觉的钢轨伤损与道床异物图像识别研究[D]. 成都: 西南交通大学, 2022: 35.CHEN Zheng-xing. Research on the detection of rail defect and ballastless bed foreign object images based on computer vision[D]. Chengdu: Southwest Jiaotong University, 2022: 35. [27] 刘宇鸣. 基于视觉的无砟轨道异物检测研究[D]. 北京: 北京交通大学, 2020: 42.LIU Yu-ming. Vision based ballastless track abnormal object detection[D]. Beijing: Beijing Jiaotong University, 2020: 42. [28] 胡波, 刘培文, 刘瑞琪. 采用改进YOLOv10的轨道侵限异物检测算法[J]. 厦门理工学院学报, 2025, 33(3): 19-25.HU Bo, LIU Pei-wen, LIU Rui-qi. An improved YOLOv10 algorithm for railway foreign object detection[J]. Journal of Xiamen University of Technology, 2025, 33(3): 19-25. [29] VARGHESE R J, SAMBATH M. YOLOv8: A novel object detection algorithm with enhanced performance and robust-ness[C]//IEEE. 2024 International Conference on Advances in Data Engineering and Intelligent Computing Systems (ADICS). New York: IEEE, 2024: 1-6. [30] WOO S, PARK J, LEE J Y, et al. CBAM: convolutional block attention module[C]//Springer. Computer Vision-ECCV 2018. Berlin: Springer, 2018: 3-19. [31] LI D, HU J, WANG C H, et al. Involution: Inverting the inherence of convolution for visual recognition[C]//IEEE. 2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). New York: IEEE, 2021: 12316-12325. [32] 郭磊, 王邱龙, 薛伟, 等. 基于改进YOLOv5的小目标检测算法[J]. 电子科技大学学报, 2022, 51(2): 251-258.GUO Lei, WANG Qiu-long, XUE Wei, et al. A small object detection algorithm based on improved YOLOv5[J]. Journal of University of Electronic Science and Technology of China, 2022, 51(2): 251-258. [33] LIN T Y, GOYAL P, GIRSHICK R, et al. Focal loss for dense object detection[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2020, 42(2): 318-327. doi: 10.1109/TPAMI.2018.2858826 [34] WANG A, CHEN H, LIU L H, et al. YOLOv10: Real-time end-to-end object detection[C]//Neural Information Proce-ssing Systems. Advances in Neural Information Processing Systems 37. Vancouver: Neural Information Processing Sys-tems Foundation, 2024: 107984-108011. [35] SELVARAJU R R, COGSWELL M, DAS A, et al. Grad-CAM: Visual explanations from deep networks via gradient-based localization[C]//IEEE. 2017 IEEE International Con-ference on Computer Vision (ICCV). New York: IEEE, 2017: 618-626. -
下载: