留言板

尊敬的读者、作者、审稿人, 关于本刊的投稿、审稿、编辑和出版的任何问题, 您可以本页添加留言。我们将尽快给您答复。谢谢您的支持!

姓名
邮箱
手机号码
标题
留言内容
验证码

基于改进YOLOv5s的安全帽检测算法

赵睿 刘辉 刘沛霖 雷音 李达

赵睿,刘辉,刘沛霖,等. 基于改进YOLOv5s的安全帽检测算法[J]. 北京航空航天大学学报,2023,49(8):2050-2061 doi: 10.13700/j.bh.1001-5965.2021.0595
引用本文: 赵睿,刘辉,刘沛霖,等. 基于改进YOLOv5s的安全帽检测算法[J]. 北京航空航天大学学报,2023,49(8):2050-2061 doi: 10.13700/j.bh.1001-5965.2021.0595
ZHAO R,LIU H,LIU P L,et al. Safety helmet detection algorithm based on improved YOLOv5s[J]. Journal of Beijing University of Aeronautics and Astronautics,2023,49(8):2050-2061 (in Chinese) doi: 10.13700/j.bh.1001-5965.2021.0595
Citation: ZHAO R,LIU H,LIU P L,et al. Safety helmet detection algorithm based on improved YOLOv5s[J]. Journal of Beijing University of Aeronautics and Astronautics,2023,49(8):2050-2061 (in Chinese) doi: 10.13700/j.bh.1001-5965.2021.0595

基于改进YOLOv5s的安全帽检测算法

doi: 10.13700/j.bh.1001-5965.2021.0595
详细信息
    通讯作者:

    E-mail:1852024027@qq.com

  • 中图分类号: TP391.41;TP183

Safety helmet detection algorithm based on improved YOLOv5s

More Information
  • 摘要:

    针对现有安全帽检测算法难以检测小目标、密集目标等缺点,提出一种基于YOLOv5s的安全帽检测改进算法。采用DenseBlock模块来代替主干网络中的切片结构,提升网络的特征提取能力;在网络颈部检测层加入SE-Net通道注意力模块,引导模型更加关注小目标信息的通道特征,以提升对小目标的检测性能;对数据增强方式进行改进,丰富小尺度样本数据集;增加一个检测层以便能更好地学习密集目标的多级特征,从而提高模型应对复杂密集场景的能力。此外,构建一个面向密集目标及远距离小目标的安全帽检测数据集。实验结果表明:所提改进算法比原始YOLOv5s算法平均精确率(mAP@0.5)提升6.57%,比最新的YOLOX-L及PP-YOLOv2算法平均精确率分别提升1.05%与1.21%,在密集场景及小目标场景下具有较强的泛化能力。

     

  • 图 1  YOLOv5s算法网络结构

    Figure 1.  YOLOv5s algorithm network structure

    图 2  Focus结构

    Figure 2.  Focus structure

    图 3  DenseBlock模块结构

    Figure 3.  DenseBlock module structure

    图 4  DenseBlock模块替换Focus结构

    Figure 4.  Denseblock module replaces Focus structure

    图 5  SE-Net通道注意力模块结构

    Figure 5.  SE-Net channel attention module structure

    图 6  引入SE-Net通道注意力模块

    Figure 6.  Introduction of SE-Net channel attention module

    图 7  改进SE-Net模块前后检测效果对比

    Figure 7.  Comparison of detection results before and after improving SE-Net module

    图 8  改进的马赛克数据增强方式

    Figure 8.  Improved mosaic data augmentation method

    图 9  改进数据增强方式前后检测效果对比

    Figure 9.  Comparison of detection results before and after improved data enhancement method

    图 10  原始算法颈部增加检测层的结构图

    Figure 10.  Structure chart of adding a detection layer to neak of original algorithm

    图 11  增加检测层前后的算法检测效果对比

    Figure 11.  Comparison of algorithm detection results before and after adding a detection layer

    图 12  改进的YOLOv5s算法网络结构图

    Figure 12.  Improved YOLOv5s algorithm network structure

    图 13  部分数据可视化结果

    Figure 13.  Visualization results of partial data sets

    图 14  mAP@0.5对比曲线

    Figure 14.  mAP@0.5 comparison curves

    图 15  部分检测结果可视化对比

    Figure 15.  Part detection results visualization comparison chart

    表  1  改进DenseBlock模块前后模型性能对比

    Table  1.   Comparison of model performance before and after improving DenseBlock module

    算法P/%R/%mAP@0.5/%参数量
    原始YOLOv5s算法90.7182.8581.377066239
    改进算法(DenseBlock)91.3685.7884.347066741
    下载: 导出CSV

    表  2  加入SE-Net模块前后算法性能对比

    Table  2.   Comparison of algorithm performance before and after adding SE-Net module %

    算法PRmAP@0.5
    原始YOLOv5s算法90.7182.8581.37
    改进算法(Backbone+SE-Net)91.4285.1484.23
    改进算法(Neck+SE-Net)91.2985.3284.48
    下载: 导出CSV

    表  3  改进数据增强方式前后算法性能对比

    Table  3.   Comparison of algorithm performance before and after improving data enhancement method %

    算法PRmAP@0.5
    原始YOLOv5s算法90.7182.8581.37
    改进算法(Mosaic)90.7984.7983.56
    下载: 导出CSV

    表  4  原始算法颈部增加检测层前后算法性能对比

    Table  4.   Comparison of algorithm performance before and after adding detection layer in original algorithn %

    算法PRmAP@0.5
    原始YOLOv5s算法90.7182.8581.37
    改进算法(Adding layer)91.4785.3383.78
    下载: 导出CSV

    表  5  实验参数值

    Table  5.   Experimental parameter values

    初始
    学习率
    终止
    学习率
    学习率
    调整轮数
    一次传入
    图片数
    训练
    轮数
    0.010.258250
    下载: 导出CSV

    表  6  消融实验对比

    Table  6.   Comparison of ablation experiments %

    算法PRmAP@0.5
    原始YOLOv5s算法 90.71 82.85 81.37
    改进算法(DenseBlock+SE-Net) 91.67 86.65 86.49
    改进算法(DenseBlock+Mosaic) 90.96 86.43 85.93
    改进算法(DenseBlock+Adding layer) 91.43 86.97 85.91
    改进算法(SE-Net+Mosaic) 91.04 87.18 86.24
    改进算法(SE-Net+Adding layer) 92.28 86.52 86.15
    改进算法(Mosaic+Adding layer) 91.62 87.23 86.96
    改进算法(DenseBlock+SE-Net+Mosaic) 91.66 87.73 86.85
    改进算法(DenseBlock+SE-Net+Adding layer) 91.47 88.18 87.07
    改进算法(DenseBlock+Mosaic+Adding layer) 91.92 88.33 86.61
    改进算法(SE-Net+Mosaic+Adding layer) 90.13 87.14 86.48
    改进算法(DenseBlock+SE-Net+
    Mosaic+Adding layer)
    91.21 89.09 87.94
    下载: 导出CSV

    表  7  改进算法与现有目标检测算法性能对比

    Table  7.   Performance comparison between the proposed improved algorithm and existing object detection algorithms

    算法mAP@0.5/%mAP/%NFPS/(帧·s−1)
    YOLOv374.3944.6717.36
    YOLOv3-tiny72.8743.1221.48
    YOLOv3-spp75.7847.1516.58
    YOLOv484.1653.9216.03
    YOLOv5s81.3752.2624.01
    YOLOv5m84.9354.4219.94
    YOLOv5l86.5856.3117.87
    YOLOv5x87.1256.9616.07
    YOLOX-L86.8957.1717.23
    PP-YOLOv286.7357.0317.12
    改进算法87.9458.1420.45
    下载: 导出CSV

    表  8  改进算法与现有安全帽检测算法性能对比

    Table  8.   Performance comparison between proposed improved algorithm and existing safety helmet detection algorithms %

    算法mAP@0.5mAP
    其他改进算法(改进锚框) 83.56 54.14
    其他改进算法(增加自注意力机层) 84.32 53.95
    其他改进算法((增加自注意力层+改进锚框) 84.87 55.63
    其他改进算法(K-means聚类) 82.46 52.74
    其他改进算法(增加特征图) 84.43 54.32
    其他改进算法(增加特征图+K-means聚类) 85.78 55.31
    其他改进算法(深度可分离卷积) 82.76 52.96
    其他改进算法(改进SPP) 82.73 52.97
    其他改进算法(深度可分离卷积+改进SPP) 84.21 55.13
    其他改进算法(K-means++算法) 83.38 53.98
    其他改进算法(多光谱注意力模块) 85.98 56.03
    其他改进算法(K-means++算法+多光谱注意力模块) 86.09 56.76
    本文改进算法 87.94 58.14
    下载: 导出CSV
  • [1] YAN G B, SUN Q, HUANG J Y, et al. Helmet detection based on deep learning and random forest on UAV for power construction safety[J]. Journal of Advanced Computational Intelligence and Intelligent Informatics, 2021, 25(1): 40-49. doi: 10.20965/jaciii.2021.p0040
    [2] 孙国栋, 李超, 张航. 融合自注意力机制的安全帽佩戴检测方法[J]. 计算机工程与应用, 2022, 58(20): 300-304. doi: 10.3778/j.issn.1002-8331.2103-0372

    SUN G D, LI C, ZHANG H. Safety helmet wearing detection method fused with self-attention mechanism[J]. Computer Engineering and Applications, 2022, 58(20): 300-304(in Chinese). doi: 10.3778/j.issn.1002-8331.2103-0372
    [3] 许凯, 邓超. 基于改进YOLOv3的安全帽佩戴识别算法[J]. 激光与光电子学进展, 2021, 58(6): 0615002.

    XU K, DENG C. Research on helmet wear identification based on improved YOLOv3[J]. Laser & Optoelectronics Progress, 2021, 58(6): 0615002(in Chinese).
    [4] CHENG R, HE X W, ZHENG Z L, et al. Multi-scale safety helmet detection based on SAS-YOLOv3-Tiny[J]. Applied Sciences, 2021, 11(8): 3652. doi: 10.3390/app11083652
    [5] 赵红成, 田秀霞, 杨泽森, 等. YOLO-S: 一种新型轻量的安全帽佩戴检测模型[J]. 华东师范大学学报(自然科学版), 2021(5): 134-145.

    ZHAO H C, TIAN X X, YANG Z S, et al. YOLO-S: A new lightweight helmet wearing detection model[J]. Journal of East China Normal University (Natural Science), 2021(5): 134-145(in Chinese).
    [6] 张锦, 屈佩琪, 孙程, 等. 基于改进YOLOv5的安全帽佩戴检测算法[J]. 计算机应用, 2022, 42(4): 1292-1300.

    ZHANG J, QU P Q, SUN C, et al. Safety helmet wearing detection algorithm based on improved YOLOv5[J]. Journal of Computer Applications, 2022, 42(4): 1292-1300(in Chinese).
    [7] 徐传运, 袁含香, 李刚, 等. 使用场景增强的安全帽佩戴检测方法研究[J]. 计算机工程与应用, 2022, 58(19): 326-332. doi: 10.3778/j.issn.1002-8331.2103-0030

    XU C Y, YUAN H X, LI G, et al. Research on safety helmet wearing detection method based on scene augment[J]. Computer Engineering and Applications, 2022, 58(19): 326-332(in Chinese). doi: 10.3778/j.issn.1002-8331.2103-0030
    [8] 高明华, 杨璨. 基于改进卷积神经网络的交通目标检测方法[J]. 吉林大学学报(工学版), 2022, 52(6): 1353-1361. doi: 10.13229/j.cnki.jdxbgxb20210380

    GAO M H, YANG C. Traffic target detection method based on improved convolution neural network[J]. Journal of Jilin University (Engineering and Technology Edition), 2022, 52(6): 1353-1361(in Chinese). doi: 10.13229/j.cnki.jdxbgxb20210380
    [9] ZHU L L, GENG X, LI Z, et al. Improving YOLOv5 with attention mechanism for detecting boulders from planetary images[J]. Remote Sensing, 2021, 13(18): 152-161.
    [10] 高云鹏. 基于深度神经网络的大田小麦麦穗检测方法研究[D]. 北京: 北京林业大学, 2019: 1-68.

    GAO Y P. Study on detection method of wheat ear in field based on deep neural network[D]. Beijing: Beijing Forestry University. 2019: 1-68(in Chinese).
    [11] 马永康, 刘华, 凌成星, 等. 基于改进YOLOv5的红树林单木目标检测研究[J]. 激光与光电子学进展, 2022, 59(18): 426-436.

    MA Y K, LIU H, LING C X, et al. Object detection of individual mangrove based on improved YOLOv5[J]. Laser & Optoelectronics Progress, 2022, 59(18): 426-436(in Chinese).
    [12] MAGALHÃES S A, CASTRO L, MOREIRA G, et al. Evaluating the single-shot MultiBox detector and YOLO deep learning models for the detection of tomatoes in a greenhouse[J]. Sensors, 2021, 21(10): 3569. doi: 10.3390/s21103569
    [13] 舒朗, 张智杰, 雷波. 一种针对红外目标检测的Dense-Yolov5算法研究[J]. 光学与光电技术, 2021, 19(1): 69-75. doi: 10.19519/j.cnki.1672-3392.2021.01.010

    SHU L, ZHANG Z J, LEI B. Research on dense-Yolov5 algorithm for infrared target detection[J]. Optics & Optoelectronic Technology, 2021, 19(1): 69-75(in Chinese). doi: 10.19519/j.cnki.1672-3392.2021.01.010
    [14] CHEN B L, ZHAO T S, LIU J H, et al. Multipath feature recalibration DenseNet for image classification[J]. International Journal of Machine Learning and Cybernetics, 2021, 12(3): 651-660. doi: 10.1007/s13042-020-01194-4
    [15] LI G Q, ZHANG M, LI J J, et al. Efficient densely connected convolutional neural networks[J]. Pattern Recognition, 2021, 109: 107610. doi: 10.1016/j.patcog.2020.107610
    [16] ALBAHLI S, AYUB N, SHIRAZ M. Coronavirus disease (COVID-19) detection using X-ray images and enhanced DenseNet[J]. Applied Soft Computing, 2021, 110: 107645. doi: 10.1016/j.asoc.2021.107645
    [17] WANG Y, HAO Z Y, ZUO F, et al. A fabric defect detection system based improved YOLOv5 detector[J]. Journal of Physics:Conference Series, 2021, 2010(1): 012191. doi: 10.1088/1742-6596/2010/1/012191
    [18] HUANG G, LIU Z, VAN DER MAATEN L, et al. Densely connected convolutional networks[C]//2017 IEEE Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE Press, 2017: 2261-2269.
    [19] JUNG E, CHIKONTWE P, ZONG X P, et al. Enhancement of perivascular spaces using densely connected deep convolutional neural network[J]. IEEE Access:Practical Innovations, Open Solutions, 2019, 7: 18382-18391.
    [20] TANG X L, ZHONG B, PENG J P, et al. Multi-scale channel importance sorting and spatial attention mechanism for retinal vessels segmentation[J]. Applied Soft Computing, 2020, 93: 106353. doi: 10.1016/j.asoc.2020.106353
    [21] ZHANG G Q, YANG J C, ZHENG Y H, et al. Hybrid-attention guided network with multiple resolution features for person re-identification[J]. Information Sciences, 2021, 578: 525-538. doi: 10.1016/j.ins.2021.07.058
    [22] 陈文豪, 何敬, 刘刚. 引入注意力机制的卷积神经网络高光谱图像分类[J]. 激光与光电子学进展, 2022, 59(18): 162-169.

    CHEN W H, HE J, LIU G. Hyperspectral image classification based on convolution neural network with attention mechanism[J]. Laser & Optoelectronics Progress, 2022, 59(18): 162-169(in Chinese).
    [23] 邹梓吟, 盖绍彦, 达飞鹏, 等. 基于注意力机制的遮挡行人检测算法[J]. 光学学报, 2021, 41(15): 1515001. doi: 10.3788/AOS202141.1515001

    ZOU Z Y, GAI S Y, DA F P, et al. Occluded pedestrian detection algorithm based on attention mechanism[J]. Acta Optica Sinica, 2021, 41(15): 1515001(in Chinese). doi: 10.3788/AOS202141.1515001
    [24] HU J, SHEN L, SUN G. Squeeze-and-excitation networks[C]// 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE Press, 2018: 7132-7141.
    [25] 林贤早, 刘俊, 田胜, 等. 基于多空间混合注意力的图像描述生成方法[J]. 计算机应用, 2020, 40(4): 985-989.

    LIN X Z, LIU J, TIAN S, et al. Image description generation method based on multi-spatial mixed attention[J]. Journal of Computer Applications, 2020, 40(4): 985-989(in Chinese).
    [26] 程鸣洋, 盖绍彦, 达飞鹏. 基于注意力机制的立体匹配网络研究[J]. 光学学报, 2020, 40(14): 1415001. doi: 10.3788/AOS202040.1415001

    CHENG M Y, GAI S Y, DA F P. A stereo-matching neural network based on attention mechanism[J]. Acta Optica Sinica, 2020, 40(14): 1415001(in Chinese). doi: 10.3788/AOS202040.1415001
    [27] CAO Z H, SHAO M F, XU L, et al. MaskHunter: Real-time object detection of face masks during the COVID-19 pandemic[J]. IET Image Processing, 2020, 14(16): 4359-4367. doi: 10.1049/iet-ipr.2020.1119
    [28] 李成跃, 姚剑敏, 林志贤, 等. 基于改进YOLO轻量化网络的目标检测方法[J]. 激光与光电子学进展, 2020, 57(14): 141003.

    LI C Y, YAO J M, LIN Z X, et al. Object detection method based on improved YOLO lightweight network[J]. Laser & Optoelectronics Progress, 2020, 57(14): 141003(in Chinese).
    [29] J IANG X B, GAO T H, ZHU Z C, et al. Real-time face mask detection method based on YOLOv3[J]. Electronics, 2021, 10(7): 327-336.
    [30] ZHANG K, WU Y L, WANG J Y, et al. Semantic context-aware network for multiscale object detection in remote sensing images[J]. IEEE Geoscience and Remote Sensing Letters, 2022, 19: 1-5.
    [31] LI S S, LI Y J, LI Y, et al. YOLO-FIRI: Improved YOLOv5 for infrared image object detection[J]. IEEE Access, 2021, 9: 141861-141875. doi: 10.1109/ACCESS.2021.3120870
    [32] CAO S, ZHANG X W, MA J W. Trans-scale feature aggregation network for multiscale pedestrian detection[J]. Journal of Beijing University of Aeronautics and Astronautics, 2020, 46(9): 1786-1796.
    [33] LI X G, FU C P, LI X L, et al. Improved faster R-CNN for multi-scale object detection[J]. Journal of Computer-Aided Design & Computer Graphics, 2019, 31(7): 1095-1101.
    [34] HSU W Y, LIN W Y. Adaptive fusion of multi-scale YOLO for pedestrian detection[J]. IEEE Access, 2021, 9: 110063-110073. doi: 10.1109/ACCESS.2021.3102600
    [35] 管军霖, 智鑫. 基于YOLOv4卷积神经网络的口罩佩戴检测方法[J]. 现代信息科技, 2020, 4(11): 9-12. doi: 10.19850/j.cnki.2096-4706.2020.11.002

    GUAN J L, ZHI X. Mask wearing detection method based on YOLOv4 convolutional neural network[J]. Modern Information Technology, 2020, 4(11): 9-12(in Chinese). doi: 10.19850/j.cnki.2096-4706.2020.11.002
    [36] 程可欣, 王玉德. 基于改进YOLOv3的自然场景人员口罩佩戴检测算法[J]. 计算机系统应用, 2021, 30(2): 231-236. doi: 10.15888/j.cnki.csa.007788

    CHENG K X, WANG Y D. Algorithm of mask wearing detection in natural scenes based on improved YOLOv3[J]. Computer Systems & Applications, 2021, 30(2): 231-236(in Chinese). doi: 10.15888/j.cnki.csa.007788
    [37] LIU Y F, LIU H B, PENG J X, et al. Research on the Use of YOLOv5 object detection algorithm in mask wearingrecognition[J]. World Scientific Research Journal, 2020, 6(11): 230-238.
  • 加载中
图(15) / 表(8)
计量
  • 文章访问数:  540
  • HTML全文浏览量:  129
  • PDF下载量:  89
  • 被引次数: 0
出版历程
  • 收稿日期:  2021-10-09
  • 录用日期:  2021-11-02
  • 网络出版日期:  2021-11-23
  • 整期出版日期:  2023-08-31

目录

    /

    返回文章
    返回
    常见问答