Professional Documents
Culture Documents
复杂背景下基于改进 YOLO v3
算法的桥梁表观病害识别
邹俊志 1,杨建喜 2,李昊 2,帅聪 2,黄蝶 2,蒋仕新 2
ZOU Junzhi1, YANG Jianxi2, LI Hao2, SHUAI Cong2, HUANG Die2, JIANG Shixin2
(1. School of Civil Engineering, Chongqing Jiaotong University, Chongqing 400074, China;
2. School of Information Science and Engineering, Chongqing Jiaotong University, Chongqing 400074, China)
Abstract: To improve the detection accuracy of concrete bridge apparent disease under complex background, a
bridge apparent distress detection method was proposed based on an improved YOLO v3 algorithm. According to
the characteristics of dense distribution, and multiscale of bridge apparent disease, the YOLO v3 network
structure was remolded as follows. First, the squeeze and excitation networks attention mechanism module and
the spatial feature pyramid pooling module were embedded in the detection layer to strengthen the semantic
feature extraction ability. Second, the CIoUloss function with better positioning ability was selected to train the
network. Finally, the K-means algorithm was used to cluster the bridge apparent disease defect datasets. To verify
收稿日期:2020-12-24
基金项目:国家自然科学基金青年基金资助项目(62003063);重庆市教委科学技术研究计划项目(KJZD-M202000702,KJQN202000726);重庆市
自然科学基金资助项目(cstc2020jcyj-msxmX0047);重庆交通大学研究生科研创新项目(2020S0045)
通信作者:蒋仕新(1992−),男,重庆人,讲师,博士,从事计算机视觉研究;E−mail:shixinjiang@cqjtu.edu.cn
3258 铁 道 科 学 与 工 程 学 报 2021 年 12 月
the effectiveness of the proposed algorithm, 1363 datasets including bridge exposed rebar, spalling, and corrosion
diseases were established, which were manually annotated and augmented for network training. Experimental
results show that the improved YOLO v3 model has greatly improved the precision rate, recall rate, Average
Precision, and other indicators compared with the original model, and its mean Average Precision has increased
by 5.5%. The detection frame can achieve 84 FPS under RTX 2080 Ti GPU, which can be more accurate and real-
time detection for bridge disease.
Key words: YOLO v3 algorithm; bridge disease detection; SENet; spatial pyramid pooling
法,用于检测钢筋混凝土柱地震后不同损伤类型。
像特征值的混凝土桥梁表面病害分类方法,通过
相比以 Faster R-CNN[12]为代表的两阶段目标检测算
提取病害图像的灰度直方图特征、颜色矩特征及
法,以 SSD[13] 和 YOLO[14] 为代表的单阶段目标检测
纹 理 特 征 , 运 用 支 持 向 量 机 (Support Vector Ma‐
算法,避免了生成候选区域这一步骤,实现了更
chine,SVM)实现了病害图像的分类。韩琨等[4] 基
快的检测速度,更适用于桥梁自动化巡检场景中。
于图像连通域特征,采用 SVM 进行特征分类检测
ZHANG 等[15]基于 YOLO v3 算法实现了桥梁表面裂
裂缝区域。但这类方法主要依靠人工经验进行样
缝、露筋、剥落等多种缺陷的实时检测。然而现
本特征抽取,且构建的仍是没有层次的单层特征,
有的基于深度学习的目标检测算法中,尚未根据
在桥梁自动化巡检中应用场景有限。伴随着无人
桥梁表面病害特点进行改进,针对复杂背景下桥
机[5]、爬壁机器人[6] 等智能检测设备在桥梁结构外
观评估方向的迅速发展,为进一步分析智能检测 梁病害的目标检测算法仍亟需构建。在现有研究
合,增强了对不同大小病害的检测效果,使得所有
尺度下的病害特征细节更为丰富,其预测方式如
1 YOLO v3 算法
图 1 所示。
在检测层中,YOLO v3 将输入的病害图像按
YOLO v3 算法是由 REDMON 等[14] 提出的一种
照特征图尺寸大小划分成 S×S 个网格,每个单元格
基于回归的单阶段目标检测算法,由特征提取主
负责检测落入其中心的病害,同时输出多个预测
干网络和检测层 2 个部分组成。受 ResNet[12]残差网
框和每个预测框的置信度。每个边界框(bounding
络启发,YOLO v3 在主干网络中加入了残差单元, box)包含参数 (t c ,t x ,t y ,t w ,t h ), 其中 c 为置信度变量 ,
组成了特征提取主干网络 darknet53,使得网络模 采 用 sigmod 函 数 , (t x ,t y ) 为 候 选 框 的 中 心 坐 标 ,
型准确率增加的同时有效缓解了深度神经网络中 (t w ,t h ) 为候选框的中心点。在位置预测上,以每张
的梯度消失问题。YOLO v3 在最后 3 次下采样中以 特征图上某单元左上角坐标为 ( c x ,c y ) 为例,每个锚
1/32,1/16 和 1/8 的下采样率分别输出 13×13,26× 框(anchor)预测尺寸为 ( p w ,p h ),所生成的预测坐标
26,52×52 这 3 种不同尺度的特征图。同时借鉴了 为 ( bx ,by ,bw ,bh ),其中 ( bx ,by ) 为预测边界框的中心坐
特征金字塔[16] (FPN,feature pyramid networks)的多 标,( bw ,bh ) 为预测框的宽度和高度,具体如图 2 所
尺度预测方式,将提供图像深层语义信息的小尺 示。输出多个预测框后,将抛弃置信度低的预测
寸特征图与提供较大感受野的大尺寸特征图相融 框并通过非极大值抑制最终定位病害位置。
图1 多尺度预测方式
Fig. 1 Multi-scale forecasting
图2 带有锚框和预测位置的边界框
Fig. 2 Bounding box with anchor and predicted position
3260 铁 道 科 学 与 工 程 学 报 2021 年 12 月
H × W i = 1∑
∑
Z c = F sq ( u c ) =
H W
于复杂背景下的桥梁病害检测;其三,交并比 IoU 1
u c (i,j ) (1)
虽然可以反映预测框与病害真实标注框间的检测 j=1
为进一步提取通道间相关性,将生成的特征
效果,但当 2 框并未相交的时候,IoU 无法提供任
图分别经过 2 个全连接层,对特征图先降维后升
何调整梯度,对于病害位置的预测精度也会有所
维,压缩率 r 设置为 16,再使用 sigmod 激活函数,
下降。故而针对上述问题,本文结合桥梁病害特
得到各通道间对应的权重 S = [ s 1 ,s 2 ,…,s c ]。
性对 YOLO v3 算法进行改进。
(
S = F ex ( Z c ,W ) = sigmod W 2 ReLU ( W 1 Z c ) ) (2)
2 改进的 YOLO v3 算法 C C
W1 ∈ R r ,W 2 ∈ R
×C C×
r
(3)
算法的具体改进主要可分为 4 个部分,分别为 最后将各个通道与对应权重相乘进行权值更
嵌入 SENet 的特征提取网络、空间金字塔池化模 新,得到更新后的输出 X = [ x 1 ,x 2 ,…,x c ]。
块、采用更好地定位损失函数以及聚类自己数据 x c = F scale ( u c ,s c ) = s c ⋅ u c (4)
集的 anchor,从而提升算法整体的检测精度。 SE 注意力机制使网络在生成特征图的过程中
2.1 嵌入 SENet 的特征提取网络 更加“关注”不同类型的桥梁病害特征,同时通
为解决桥梁病害检测中存在的病害重叠、密 过网络自注意力的形式,增强了病害特征的语义
集分布等问题,本文分别在 YOLO v3 的 3 个检测 信息,有效抑制了混凝土桥面复杂的背景信息 ,
层前嵌入 SE 注意力机制结构,使网络生成通道权 解决了桥梁表观病害密集分布时识别精度较差的
重并对通道进行重标定,输出表达能力更强的特 问题。
图3 SE 网络结构
Fig. 3 Squeeze and excitation networks structure
图5 改进的 YOLO v3 结构
Fig. 5 Improved YOLO v3 architecture
3262 铁 道 科 学 与 工 程 学 报 2021 年 12 月
图6 桥梁表观病害标注示例
Fig. 6 Bridge apparent damage ground truth
ηt =
1
2(1 + cos( ))
tπ
T
η (7)
本文选择目标检测中常用的评价指标来进行
分析,采用的统计指标为精确率(precision)、查全
batch size 大小设置为 16,训练轮数为 300 轮。 率(recall)、每类病害的精度均值 AP(Average Preci‐
模型输入图像尺寸为 416×416,将其中 80% 的图像 sion)、 病 害 的 平 均 精 度 均 值 mAP(mean Average
第 12 期 邹俊志,等:复杂背景下基于改进 YOLO v3 算法的桥梁表观病害识别 3263
∫ P ( R ) dR
1 表1 YOLO v3 与改进的 YOLO v3 性能对比
AP = (10) Table 1 Comparison of YOLO v3 and improved YOLO v3
0
∑AP
N
Methods Spall Corrosion Rebar mAP/% FPS
i
i=1
mAP = (11) YOLO v3 0.794 0.634 0.800 0.743 86
N
Our methods 0.860 0.684 0.850 0.798 84
其中:N 表示病害类别的数量。FPS 是指使用 GPU
时每秒能够检测图像数量。本文主要采用 mAP@
接下来,本文将具体展示复杂背景下混凝土
0.5 指标和检测速度 FPS 来评价模型。
剥落、水侵蚀和露筋 3 种病害的实际检测效果 ,
4.2 实验结果分析
4.2.1 本文算法与 YOLO v3 算法实验结果对比 YOLO v3 与 改 进 YOLO v3 的 检 测 效 果 如 图 7~8
图7 YOLO v3 算法识别病害结果
Fig. 7 Detect disease results by using YOLO v3 algorithm
4.2.2 消融实验结果分析
为进一步分析所加入的每种网络结构分支对
于模型整体的影响,将本文所提出的改进 YOLO
v3 算法划分成 5 组不同的网络模型进行消融实验。
实验总共可以分为 5 组,其中第 1 组代表 YOLO v3
算法,第 2 组对训练集数据进行了 mosaic 数据增
强,第 3 组在第 2 组基础上采用了 CIoU 定位损失
函数,第 4 组加入了 SPP 空间金字塔池化模块,最
后一组在第 4 组基础上嵌入了 SE 注意力机制,即
第 5 组为本文所提出的改进的 YOLO v3 算法,具
图9 2 种算法的 P-R 曲线对比
体实验结果如表 2 所示。
Fig. 9 Comparison of P-R curves between two algorithms
从表 2 消融实验的结果可知,第 1 组原有版本
从图 9 可以看出,改进后的 YOLO v3 算法的 的 YOLO v3 取 得 了 74.3% 的 mAP 值 , 检 测 速 度
P-R 曲线面积完全大于 YOLO v3 的曲线面积,其 FPS 为 86;第 2 组采用了 mosaic 数据增强,丰富了
精确率和查全率均优于 YOLO v3 算法,具备更强 检测图像背景,提高了模型的泛化能力,其 mAP
的特征提取能力,更加适用于复杂背景下的桥梁 值整体提升了 1.2%;对于第 3 组模型,由于采用
病害检测场景中。 了 CIoU 定位损失函数,更好地描述了预测框与真
第 12 期 邹俊志,等:复杂背景下基于改进 YOLO v3 算法的桥梁表观病害识别 3265
实病害标注框的距离,进一步加速了模型的收敛 测速度也随着网络模块的引入略有下降;最后一
速度,故提升了检测精度和检测速度;而第 4 组实 组即本文所提的改进 YOLO v3 算法,通过嵌入了
验嵌入了空间金字塔池化模块,进一步解决了病 SENet 注意力机制,进一步增强了病害特征的语义
害在不同检测图像中尺度变化较大的问题,尤其 信息,达到了 79.8% 的 mAP 值,同时也增加了模
是针对水侵蚀病害,其 AP 值提升了 3.3%,同时检 型参数量,故最终检测速度为 84 fps。
表2 消融实验结果分析
Table 2 Comparison of experimental results of ablation
Model Mosaic CIoU SPPNet SENet Spall Corrosion Rebar mAP/% FPS
YOLO v3(1) × × × × 0.794 0.634 0.800 0.743 86
YOLO v3(2) √ × × × 0.825 0.616 0.824 0.755 85
YOLO v3(3) √ √ × × 0.858 0.639 0.828 0.775 87
YOLO v3(4) √ √ √ × 0.824 0.672 0.859 0.785 85
YOLO v3(5) √ √ √ √ 0.859 0.684 0.850 0.798 84
bridge[J]. Chinese Journal of Highway, 2017, 30(11): 63 detecting multiple damage types[J]. Computer-Aided
−80. Civil and Infrastructure Engineering, 2018, 33(9): 731
[2] 刘建威, 钟泽湘 . 基于双目视觉的桥面裂缝检测技术研 −747.
究[J]. 铁道科学与工程学报, 2016, 13(1): 164−167. [11] XU Y, WEI S, BAO Y, et al. Automatic seismic damage
LIU Jianwei, ZHONG Zexiang. A study on detection identification of reinforced concrete columns from
technology of bridge deck cracks based on binocular images by a region-based deep convolutional neural
vision[J]. Journal of Railway Science and Engineering, network[J]. Structural Control and Health Monitoring,
2016, 13(1): 164−167. 2019, 26(3): e2313.1−e2313.22.
[3] 陈飞飞, 张宇峰, 韩晓健 . 基于图像特征值的混凝土桥 [12] REN S, HE K, GIRSHICK R, et al. Faster R-CNN:
梁表面病害图像分类[J]. 结构工程师, 2018, 35(1): 59 Towards real-time object detection with region proposal
−63. networks[J]. IEEE Transactions on Pattern Analysis and
CHEN Feifei, ZHANG Yufeng, HAN Xiaojian. Image Machine Intelligence (TPAMI), 2016, 39(6): 1137−1149.
Classification of surface diseases of concrete bridges [13] LIU W, ANGUELOV D, ERHAN D, et al. SSD: Single
based on image feature value[J]. Strutural Engineer, shot multi-box detector[C]// Proceedings of the 2016
2018, 35(1): 59−63. European Conference on Computer Vision (ECCV).
[4] 韩锟, 韩洪飞 . 基于区域级和像素级特征的路面裂缝检 Amsterdam, Cham: Springer, 2016: 21−37.
测 方 法 [J]. 铁 道 科 学 与 工 程 学 报 , 2018, 15(5): 1178 − [14] REDMON J, FARHADI A. YOLO v3: An incremental
1186. improvement[EB/OL]. arXiv preprint 2018. https: //arxiv.
HAN Kun, HAN Hongfei. Detection method of pavement org/abs/1804.02767.pdf
crack based on regional and pixel characteristics[J]. [15] ZHANG C, CHIH-CHEN CHANG, JAMSHIDI M.
Journal of Railway Science and Engineering, 2018, Concrete bridge surface damage detection using a single-
15(5): 1178−1186. stage detector[J]. Computer-Aided Civil and
[5] CHEN S Y, LAEFER D F, MANGINA E, et al. UAV Infrastructure Engineering, 2020, 35(4): 389−409.
bridge inspection through evaluated 3D reconstructions [16] LIN Y, DOLLÁR P, GIRSHICK R, et al. Feature pyramid
[J]. Journal of Bridge Engineering, 2019, 24(4): 1−15. networks for object detection[C]// Proceedings of the
[6] PHILLIPS S, NARASIMHAN S. Automating data IEEE Conference on Computer Vision and Pattern
collection for robotic bridge inspections[J]. Journal of Recognition, 2017: 2117−2125.
Bridge Engineering, 2019, 24(8): 1−13. [17] HE K, ZHANG X, REN S, et al. Spatial pyramid pooling
[7] LECUN Y, BENGIO Y, HINTON G. Deep learning[J]. in deep convolutional networks for visual recognition[J].
Nature, 2015, 521(7553): 436−444. IEEE Transactions on Pattern Analysis and Machine
[8] 沙爱民, 童峥, 高杰 . 基于卷积神经网络的路表病害识 Intelligence (TPAMI), 2015, 37(9): 1904−1916.
别与测量[J]. 中国公路学报, 2018, 31(1): 1−10. [18] ZHENG Z, WANG P, LIU W, et al. Distance-IoU Loss:
SHA Aimin, TONG Zheng, GAO Jie. Identification and Faster and better learning for bounding box regression
measurement of road surface disease based on [C]// Proceedings of the 2020 AAAI Conference on
convolutional neural network[J]. Chinese Journal of Artificial Intelligence (AAAI). Hilton Midtown, New
Highway, 2018, 31(1): 1−10. York, Menlo Park, CA: AAAI Press, 2020.
[9] 韩晓健, 赵志成, 沈泽江 . 卷积神经网络在桥梁结构表 [19] HE T, ZHANG Z, ZHANG H, et al. Bag of tricks for
面病害检测中的应用研究[J]. 结构工程师, 2019, 35(2): image classification with convolutional neural networks
106−111. [C]// Proceedings of the IEEE Conference on Computer
HAN Xiaojian, ZHAO Zhicheng, SHEN Zejiang. Vision and Pattern Recognition, 2019: 558−567.
Application of convolutional neural network in detection [20] BOCHKOVSKIY A, WANG C Y, MARK Liao H Y.
of surface diseases of bridge structures[J]. Structural YOLO v4: Optimal speed and accuracy of object
Engineer, 2019, 35(2): 106−111. detection[EB/OL]. arXiv preprint 2020. https://arxiv. org/
[10] CHA Y J, CHOI W, SUH G, et al. Autonomous structural abs/2004.10934.pdf.
visual inspection using region-based deep learning for (编辑 阳丽霞)