Based on the YOLOv5 algorithm, the feature extraction process was optimized by introducing the FasterNet lightweight network structure to reduce the computational complexity of the model. Combining Convolutional Block Attention Module (CBAM) attention mechanism to improve the model's attention to defect features. Adopting the SIoU loss function to improve the accuracy of bounding box regression and enhance localization accuracy. The experimental results show that the improved model has achieved significant results on the self built bridge defect dataset, with accuracy and mAP reaching 81.2% and 71.5%, respectively, which is a significant improvement compared to the benchmark model. This study provides technical support for the intelligent detection of bridge defects, which is of great significance for promoting the digital transformation of bridge maintenance management.
在复杂环境中,特别是桥梁缺陷识别任务中,模型可能面临精度不足的问题,这主要是因为现有损失函数在目标定位和分类方面的优化能力有限,容易退化为普通的交并比(Intersection over Union,IoU)损失函数,该指标为目标检测中衡量预测框与真实框重叠程度的核心指标,通过计算两框交集面积与并集面积的比值量化重合度,取值为[0,1]。为此,本文通过使用更高效的损失函数,提升模型的识别准确率,使其能够更精准地定位和识别桥梁缺陷区域。新损失函数不仅强化了对小目标和边界模糊目标的检测能力,还能更好地适应高速公路巡检场景中的复杂性和多样性,从而提升模型的鲁棒性和实用性。
2.3.1 经典的损失函数
YOLOv5原始模型使用的损失函数主要是广义交并比(Generalized intersection over union,GIoU)[22],图13为GIoU的示意图,引入GIoU的目的是解决预测框与真实框可能不重叠时的问题。相较于原始的IoU,GIoU增加了一个能够完全包含目标框A和预测框B的最小外接矩形框C。GIoU和损失函数LGIoU的计算公式分别为:
式中:为最小外接矩形的面积;为预测框和真实框的并集面积;IoU为目标检测中衡量预测框和真实框重叠程度,计算得出的GIoU是用于替换IoU的距离度量指标;LGIoU为损失函数,通过最小化这个损失函数,可以使预测框更加接近真实框。但当两个预测框处于包含关系或高宽相同且处于同一水平面时,缩放交并比(Scaled intersection over union,GIoU)可能会退化为IoU;以及当目标具有复杂的形状或方向时,GIoU可能无法准确反映预测框与真实框之间的重合度和位置关系。
YOLOv5模型提供了一种超参数优化的方法,即超参数进化[24]。经超参数优化后的模型,在实际应用中通常能够表现出更好的性能,不仅可以提高模型的准确性和泛化能力,还可以通过降低模型的复杂度和计算成本,实现其轻量化。超参数进化的内在逻辑是利用遗传算法实现超参数优化。在每一次的迭代过程中,基于所有前代的最佳组合产生新的后代,选择更加适合改进后模型的超参数。本次实验中,适应度设置为精确率(Precision)占比15%,召回率(Recall)占比15%,平均检测精度(Mean average precision@IoU=0.5,mAP@0.5)占比70%。最后,进行了300次训练迭代,得到的最优超参数如表1所示。
3.3 模型评价
3.3.1 模型评价指标
模型评估指标采用精确率、召回率、平均检测精度(mAP@0.5)以及F1表示检测的准确性;采用参数量、帧率(Frames per second,FPS)表示检测的速度[26]。精确率和召回率的计算公式如下所示:
DingWei, XiaZhe, ShuJiang-peng, et al. Recognition and detection of concrete bridge tower cracks using a negative pressure adhesion wall-climbing robot and Transformer[J]. China Journal of Highway and Transport, 2024, 37(2): 53-64.
LiuKai, LiJia-po, DengZhi-yun, et al. Benefit analysis of unmanned aerial vehicle bridge detection technology[J]. Journal of Nanchang Institute of Technology, 2018(3): 51-53, 80.
ZouJin-huan. Application and benefit analysis of drones in transmission line inspection[J]. China Strategic Emerging Industry, 2023(36): 153-155.
[7]
OppenheimD, ShaniG, ErlichO, et al. Using deep learning for image-based potato tuber disease detection[J]. Phytopathology, 2019, 109(6): 1083-1087.
[8]
WangJ X, SuY H, YaoJ H, et al. Apple rapid recognition and processing method based on an improved version of YOLOv5[J]. Ecological Informatics, 2023, 77: No.102196.
JiaXue-ying, ZhaoChun-jiang, ZhouJuan, et al. Online detection of citrus surface defects using improved YOLOv7 modeling[J]. Transactions of the Chinese Society of Agricultural Engineering, 2023, 39(23): 142-151.
WangPang-wei. Pyramid-feature-fusion-based two-stage vehicle detection via 3D point cloud[J]. Journal of Transportation Systems Engineering and Information Technology, 2022, 22(5): 107-116.
ZhangHe-shan, FanMeng-wei, TanXin, et al. Dense small target vehicle detection in UAV aerial images based on improved YOLOX[J]. Journal of Jilin University (Engineering and Technology Edition), 2025, 55(4): 1307-1318.
[15]
YangLi-na, ChenGang, Wen-yanCi. Multiclass objects detection algorithm using DarkNet-53 and DenseNet for intelligent vehicles[J] EURASIP Journal on Advances in Signal Processing, 2023, 2023(1): 1-18.
[16]
CaoF, XingB, LuoJ C, et al. An efficient object detection algorithm based on improved YOLOv5 for High-Spatial-Resolution remote sensing images[J]. Remote Sensing, 2023, 15(15):No. 3755.
PengWei-bing, ZhangMing-jian, QuanLiu-meng, et al. Intelligent recognition of multiple diseases in steel bridges based on improved Mask R-CNN[J]. China Journal of Highway and Transport, 2024, 37(2): 100-109.
JiangYan-fang. Identification of apparent defects in RC bridge with image processing and deep learning[D]. Chongqing:College of Civil Engineering, Chongqing University, 2019.
[25]
ZengG, WuZ Z, XuL P, et al. Efficient vision Transformer YOLOv5 for accurate and fast traffic fign detection[J]. Electronics, 2024, 13(5):No. 880.
XuXin. Research and application of medical image lesion region detection based on YOLOv5[D]. Zhenjiang:School of Computer Science and Communication Engineering, Jiangsu University, 2023.
ZhongYuan, YuanJia-zheng, LiHong-tian, et al. Intelligent classroom face detection algorithm with improved YOLOv5[J]. Computer Engineering and Applications, 2024, 60(11): 251-257.
[30]
RejinV, SambathM. YOLOv8: a novel object detection algorithm with enhanced performance and robustness[C]∥International Conference on Advances in Data Engineering and Intelligent Computing Systems (ADICS), Chennai, India, 2024: 1-6.
[31]
ChenJ R, KaoS H, HeH, et al. Run, don't walk: chasing higher FLOPS for faster neural networks [C]∥IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR),Vancouver, Canada, 2023: 12021-12031.
[32]
ChenJ, HeT, ZhuoW, et al. TVConv: efficient translation variant convolution for layout-aware visual processing [C]∥IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR), New Orleans, USA, 2022: 12538-12548.
ZhangNan-nan, ZhangXiao, BaiTie-cheng, et al. Pest and disease identification method for cotton leaves in natural environments based on CBAM-YOLOv7[J]. Transactions of the Chinese Society for Agricultural Machinery, 2023, 54(201): 239-244.
[35]
WooS, ParkJ, LeeJ Y, et al. CBAM: convolutional block attention module[J]. Lecture Notes in Computer Science (Including Subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics), 2018, 11211: 3-19.
[36]
HamidR, NathanT, JunyoungG, et al. Generalized intersection over union: a metric and a loss for bounding box regression[C]∥IEEE/CVF Conference on Computer Vision and Pattern Recognition, Long Beach, USA, 2019: 658-666.
[37]
GevorgyanZ. SIoU Loss: more powerful learning for bounding box regression[DB/OL]. [2025-06-05].
WangYi-xu, XiaoXiao-ling, WangPeng-fei, et al. Improved YOLOv5s small target smoke and fire detection algorithm[J]. Computer Engineering and Applications, 2023, 59(1): 72-81.