《计算机应用》唯一官方网站 ›› 2022, Vol. 42 ›› Issue (4): 1292-1300.DOI: 10.11772/j.issn.1001-9081.2021071246
• CCF第36届中国计算机应用大会 (CCF NCCA 2021) • 上一篇
收稿日期:
2021-07-16
修回日期:
2021-08-27
接受日期:
2021-08-31
发布日期:
2021-09-10
出版日期:
2022-04-10
通讯作者:
屈佩琪
作者简介:
张锦(1979—),男,河南信阳人,教授,博士,CCF会员,主要研究方向:人工智能、软件工程基金资助:
Jin ZHANG1, Peiqi QU1(), Cheng SUN2, Meng LUO2
Received:
2021-07-16
Revised:
2021-08-27
Accepted:
2021-08-31
Online:
2021-09-10
Published:
2022-04-10
Contact:
Peiqi QU
About author:
ZHANG Jin, born in 1979, Ph. D., professor. His research interests include artificial intelligence, software engineering.Supported by:
摘要:
针对现有安全帽佩戴检测干扰性强、检测精度低等问题,提出一种基于改进YOLOv5的安全帽检测新算法。首先,针对安全帽尺寸不一的问题,使用K-Means++算法重新设计先验框尺寸并将其匹配到相应的特征层;其次,在特征提取网络中引入多光谱通道注意力模块,使网络能够自主学习每个通道的权重,增强特征间的信息传播,从而加强网络对前景和背景的辨别能力;最后,在训练迭代过程中随机输入不同尺寸的图像,以此增强算法的泛化能力。实验结果表明,在自制安全帽佩戴检测数据集上,所提算法的均值平均精度(mAP)达到96.0%,而对佩戴安全帽的工人的平均精度(AP)达到96.7%,对未佩戴安全帽的工人的AP达到95.2%,相较于YOLOv5算法,该算法对佩戴安全帽的平均检测准确率提升了3.4个百分点,满足施工场景下安全帽佩戴检测的准确率要求。
中图分类号:
张锦, 屈佩琪, 孙程, 罗蒙. 基于改进YOLOv5的安全帽佩戴检测算法[J]. 计算机应用, 2022, 42(4): 1292-1300.
Jin ZHANG, Peiqi QU, Cheng SUN, Meng LUO. Safety helmet wearing detection algorithm based on improved YOLOv5[J]. Journal of Computer Applications, 2022, 42(4): 1292-1300.
特征图尺度 | 锚框尺寸 | ||
---|---|---|---|
锚框1 | 锚框2 | 锚框3 | |
小尺度 | (11.9,18) | (21.5,30.8) | (30.8,43) |
中尺度 | (38.1,60) | (52.3,73.6) | (63,103.3) |
大尺度 | (89.2,135) | (120,207.5) | (209.4,324) |
表1 先验锚框尺寸
Tab. 1 Anchor box size
特征图尺度 | 锚框尺寸 | ||
---|---|---|---|
锚框1 | 锚框2 | 锚框3 | |
小尺度 | (11.9,18) | (21.5,30.8) | (30.8,43) |
中尺度 | (38.1,60) | (52.3,73.6) | (63,103.3) |
大尺度 | (89.2,135) | (120,207.5) | (209.4,324) |
K-Means++聚类 | MCA模块 | AP50/% | mAP/% | |
---|---|---|---|---|
佩戴安全帽 | 未佩戴安全帽 | |||
× | × | 93.3 | 91.7 | 92.7 |
√ | × | 94.4 | 92.8 | 93.6 |
× | √ | 95.6 | 94.4 | 95.0 |
√ | √ | 96.7 | 95.2 | 96.0 |
表2 YOLOv5在不同改进下的性能对比
Tab. 2 Performance comparison of different improvements of YOLOv5
K-Means++聚类 | MCA模块 | AP50/% | mAP/% | |
---|---|---|---|---|
佩戴安全帽 | 未佩戴安全帽 | |||
× | × | 93.3 | 91.7 | 92.7 |
√ | × | 94.4 | 92.8 | 93.6 |
× | √ | 95.6 | 94.4 | 95.0 |
√ | √ | 96.7 | 95.2 | 96.0 |
检测算法 | AP50 | 精度 | 召回率 | mAP | ||
---|---|---|---|---|---|---|
小目标 | 中等目标 | 大目标 | ||||
YOLOv5 | 83.0 | 97.9 | 99.3 | 76.4 | 92.5 | 92.7 |
MCA-YOLOv5-BackBone | 90.4 | 98.6 | 99.6 | 82.2 | 95.4 | 96.0 |
MCA-YOLOv5-Neck | 78.3 | 96.4 | 99.1 | 70.9 | 93.7 | 91.6 |
MCA-YOLOv5-Prediction | 82.7 | 97.1 | 99.2 | 72.5 | 92.8 | 92.4 |
表3 MCA模块融合结果对比 (%)
Tab. 3 Comparison of MCA module fusion results
检测算法 | AP50 | 精度 | 召回率 | mAP | ||
---|---|---|---|---|---|---|
小目标 | 中等目标 | 大目标 | ||||
YOLOv5 | 83.0 | 97.9 | 99.3 | 76.4 | 92.5 | 92.7 |
MCA-YOLOv5-BackBone | 90.4 | 98.6 | 99.6 | 82.2 | 95.4 | 96.0 |
MCA-YOLOv5-Neck | 78.3 | 96.4 | 99.1 | 70.9 | 93.7 | 91.6 |
MCA-YOLOv5-Prediction | 82.7 | 97.1 | 99.2 | 72.5 | 92.8 | 92.4 |
目标类别 | 训练集目标数 | 测试集目标数 | 标注目标总数 |
---|---|---|---|
佩戴安全帽类别 | 81 836 | 11 316 | 93 152 |
未佩戴安全帽类别 | 98 187 | 12 021 | 110 208 |
表4 数据集类别分配
Tab. 4 Dataset category distribution
目标类别 | 训练集目标数 | 测试集目标数 | 标注目标总数 |
---|---|---|---|
佩戴安全帽类别 | 81 836 | 11 316 | 93 152 |
未佩戴安全帽类别 | 98 187 | 12 021 | 110 208 |
类别 | 条目 | 版本 |
---|---|---|
硬件配置 | 显卡 | GeForce RTX 2080 Ti |
软件配置 | 系统 | Ubuntu 18.04 |
CPU | AMD Ryzen 7 3800X 8-Core | |
Python版本 | 3.8 | |
深度学习框架 | Pytorch | |
CUDA | 10.0 |
表5 实验运行环境
Tab. 5 Experimental operating environment
类别 | 条目 | 版本 |
---|---|---|
硬件配置 | 显卡 | GeForce RTX 2080 Ti |
软件配置 | 系统 | Ubuntu 18.04 |
CPU | AMD Ryzen 7 3800X 8-Core | |
Python版本 | 3.8 | |
深度学习框架 | Pytorch | |
CUDA | 10.0 |
检测算法 | AP50/% | mAP/% | 参数量/106 | 推理时间/ms | 模型大小/MB | |
---|---|---|---|---|---|---|
佩戴安全帽 | 未佩戴安全帽 | |||||
Faster R-CNN | 80.80 | 42.20 | 61.50 | 186.00 | 291 | 182.1 |
SSD | 78.80 | 68.20 | 73.50 | 23.75 | 126 | 188.0 |
YOLOv3 | 89.12 | 80.70 | 84.90 | 61.90 | 69 | 236.0 |
YOLOv3+SPP | 90.50 | 86.30 | 88.41 | 63.00 | 70 | 237.4 |
YOLOv5 | 93.30 | 91.70 | 92.70 | 7.10 | 36 | 14.8 |
MCA-YOLOv5 | 96.70 | 95.20 | 96.00 | 7.30 | 37 | 15.2 |
表6 多种检测算法结果对比
Tab. 6 Comparison of results of multiple detection algorithms
检测算法 | AP50/% | mAP/% | 参数量/106 | 推理时间/ms | 模型大小/MB | |
---|---|---|---|---|---|---|
佩戴安全帽 | 未佩戴安全帽 | |||||
Faster R-CNN | 80.80 | 42.20 | 61.50 | 186.00 | 291 | 182.1 |
SSD | 78.80 | 68.20 | 73.50 | 23.75 | 126 | 188.0 |
YOLOv3 | 89.12 | 80.70 | 84.90 | 61.90 | 69 | 236.0 |
YOLOv3+SPP | 90.50 | 86.30 | 88.41 | 63.00 | 70 | 237.4 |
YOLOv5 | 93.30 | 91.70 | 92.70 | 7.10 | 36 | 14.8 |
MCA-YOLOv5 | 96.70 | 95.20 | 96.00 | 7.30 | 37 | 15.2 |
1 | 常欣,刘鑫萌. 建筑施工人员不合理佩戴安全帽事故树分析[J]. 吉林建筑大学学报, 2018, 35(6):65-69. 10.3969/j.issn.1009-0185.2018.06.014 |
CHANG X, LIU X M. Fault tree analysis of unreasonably wearing helmets for builders[J]. Journal of Jilin Jianzhu University, 2018, 35(6):65-69. 10.3969/j.issn.1009-0185.2018.06.014 | |
2 | 王忠玉. 智能视频监控下的安全帽佩戴检测系统的设计与实现[D]. 北京:北京邮电大学, 2018: 1-18. |
WANG Z Y. Design and implementation of detection system of wearing helmets based on intelligent video surveillance[D]. Beijing: Beijing University of Posts and Telecommunications, 2018:1-18. | |
3 | GIRSHICK R, DONAHUE J, DARRELL T, et al. Rich feature hierarchies for accurate object detection and semantic segmentation[C]// Proceedings of the 2014 IEEE Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE, 2014:580-587. 10.1109/cvpr.2014.81 |
4 | GIRSHICK R. Fast R-CNN[C]// Proceedings of the 2015 IEEE International Conference on Computer Vision. Piscataway: IEEE, 2015:1440-1448. 10.1109/iccv.2015.169 |
5 | REN S Q, HE K M, GIRSHICK R, et al. Faster R-CNN: towards real-time object detection with region proposal networks[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2017, 39(6):1137-1149. 10.1109/tpami.2016.2577031 |
6 | REDMON J, DIVVALA S, GIRSHICK R, et al. You only look once: unified, real-time object detection[C]// Proceedings of the 2016 IEEE Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE, 2016:779-788. 10.1109/cvpr.2016.91 |
7 | LIU W, ANGUELOV D, ERHAN D, et al. SSD: single shot multiBox detector[C]// Proceedings of the 2016 European Conference on Computer Vision, LNCS 9905. Cham: Springer, 2016:21-37. |
8 | REDMON J, FARHADI A. YOLO9000: better, faster, stronger[C]// Proceedings of the 2017 IEEE Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE, 2017:6517-6525. 10.1109/cvpr.2017.690 |
9 | REDMON J, FARHADI A. YOLOv3: an incremental improvement[EB/OL]. (2018-04-08) [2021-04-08].. 10.1109/cvpr.2018.00430 |
10 | BOCHKOVSKIY A, WANG C Y, LIAO H Y M. YOLOv4: optimal speed and accuracy of object detection[EB/OL]. [2020-05-09].. 10.1109/cvpr46437.2021.01283 |
11 | Ultralytics. YOLOv5[CP/OL]. [2020-08-09].. 10.1109/iccvw54120.2021.00312 |
12 | ZHANG L L, LIN L, LIANG X D, et al. Is faster R-CNN doing well for pedestrian detection?[C]// Proceedings of the 2016 European Conference on Computer Vision, LNCS, 9906. Cham: Springer, 2016:443-457. 10.1007/978-3-319-46475-6_28 |
13 | 宋欢欢,惠飞,景首才,等.改进的RetinaNet模型的车辆目标检测[J].计算机工程与应用,2019,55(13):225-230. |
SONG H H, HUI F, JING S C, et al. Improved RetinaNet model for vehicle target detection[J]. Computer Engineering and Applications, 2019, 55(13):225-230. | |
14 | 陈磊,张孙杰,王永雄.基于改进的YOLOv3及其在遥感图像中的检测[J].小型微型计算机系统,2020,41(11):2321-2324. 10.3969/j.issn.1000-1220.2020.11.014 |
CHEN L, ZHANG S J, WANG Y X. Based on improved YOLOv3 and its detection in remote sensing images[J]. Journal of Chinese Computer Systems, 2020, 41(11):2321-2324. 10.3969/j.issn.1000-1220.2020.11.014 | |
15 | 邓壮来,汪盼,宋雪桦,等.基于SSD的粮仓害虫检测研究[J]. 计算机工程与应用,2020,56(11):214-218. |
DENG Z L, WANG P, SONG X H, et al. Research on granary pest detection based on SSD[J]. Computer Engineering and Applications, 2020, 56(11):214-218. | |
16 | 张海川,彭博,许伟强.基于UNet++及条件生成对抗网络的道路裂缝检测[J].计算机应用,2020,40(S2):158-161. |
ZHANG H C, PENG B, XU W Q. Road crack detection based on UNet++ and conditional generative adversarial nets[J]. Journal of Computer Applications, 2020, 40(S2):158-161. | |
17 | KELM A, LAUβAT L, MEINS-BECKER A, et al. Mobile passive Radio Frequency Identification (RFID) portal for automated and rapid control of Personal Protective Equipment (PPE) on construction sites[J]. Automation in Construction, 2013, 36:38-52. 10.1016/j.autcon.2013.08.009 |
18 | 刘晓慧,叶西宁.肤色检测和Hu矩在安全帽识别中的应用[J].华东理工大学学报(自然科学版),2014,40(3):365-370. |
LIU X H, YE X N. Skin color detection and Hu moments in helmet recognition research[J]. Journal of East China University of Science and Technology (Natural Science Edition), 2014, 40(3):365-370. | |
19 | SHRESTHA K, SHRESTHA P P, BAJRACHARYA D, et al. Hard-hat detection for construction safety visualization[J]. Journal of Construction Engineering, 2015, 2015:No.721380. 10.1155/2015/721380 |
20 | RUBAIYAT A H M, TOMA T T, KALANTARI-KHANDANI M, et al. Automatic detection of helmet uses for construction safety[C]// Proceedings of the 2016 IEEE/WIC/ACM International Conference on Web Intelligence Workshops. Piscataway: IEEE,2016:135-142. 10.1109/wiw.2016.045 |
21 | SILVA R R V e, AIRES K R T, VERAS R de M S. Helmet detection on motorcyclists using image descriptors and classifiers[C]// Proceedings of the 27th SIBGRAPI Conference on Graphics, Patterns and Images. Piscataway: IEEE, 2014:141-148. 10.1109/sibgrapi.2014.28 |
22 | 李琪瑞.基于人体识别的安全帽视频检测系统研究与实现[D].成都:电子科技大学,2017:1-6,34-59. |
LI Q R. A research and implementation of safety-helmet video detection system based on human body recognition[D]. Chengdu: University of Electronic Science and Technology of China, 2017: 1-6, 34-59. | |
23 | WU H, ZHAO J S. An intelligent vision-based approach for helmet identification for work safety[J]. Computers in Industry, 2018, 100:267-277. 10.1016/j.compind.2018.03.037 |
24 | QIN Z Q, ZHANG P Y, WU F, et al. FcaNet: frequency channel attention networks[EB/OL]. (2021-07-23) [2021-08-04].. 10.1109/iccv48922.2021.00082 |
25 | HU J, SHEN L, SUN G. Squeeze-and-excitation networks[C]// Proceedings of the 2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE, 2018:7132-7141. 10.1109/cvpr.2018.00745 |
26 | WANG Q L, WU B G, ZHU P F, et al. ECA-net: efficient channel attention for deep convolutional neural networks[C]// Proceedings of the 2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE, 2020:11531-11539. 10.1109/cvpr42600.2020.01155 |
27 | FU J, LIU J, TIAN H J, et al. Dual attention network for scene segmentation[C]// Proceedings of the 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE, 2019:3141-3149. 10.1109/cvpr.2019.00326 |
28 | WOO S, PARK J, LEE J Y, et al. CBAM: convolutional block attention module[C]// Proceedings of the 2018 European Conference on Computer Vision, LNCS 11211. Cham: Springer, 2018:3-19. |
29 | ZHANG Z L, ZHANG X Y, PENG C, et al. ExFuse: enhancing feature fusion for semantic segmentation[C]// Proceedings of the 2018 European Conference on Computer Vision, LNCS 11214. Cham: Springer, 2018:273-288. |
30 | CHAIB S, LIU H, GU Y F, et al. Deep feature fusion for VHR remote sensing scene classification[J]. IEEE Transactions on Geoscience and Remote Sensing, 2017, 55(8):4775-4784. 10.1109/tgrs.2017.2700322 |
31 | GHIASI G, LIN T Y, LE Q V. NAS-FPN: learning scalable feature pyramid architecture for object detection[C]// Proceedings of the 2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition. Piscataway: IEEE, 2019:7029-7038. 10.1109/cvpr.2019.00720 |
32 | PENG D Z, SUN Z K, CHEN Z R, et al. Detecting heads using feature refine net and cascaded multi-scale architecture[C]// Proceedings of the 24th International Conference on Pattern Recognition. Piscataway: IEEE, 2018:2528-2533. 10.1109/icpr.2018.8545068 |
33 | EVERINGHAM M, WINN J. The PASCAL Visual Object Classes challenge 2012 (VOC2012) development kit[EB/OL]. (2012-05-18) [2021-07-20].. 10.1007/s11263-009-0275-4 |
[1] | 蒋雯静, 熊熙, 李中志, 李斌勇. 基于无采样协作知识图网络的推荐系统[J]. 《计算机应用》唯一官方网站, 2022, 42(4): 1057-1064. |
[2] | 汪祖民, 张志豪, 秦静, 季长清. 基于卷积神经网络的机械故障诊断技术综述[J]. 《计算机应用》唯一官方网站, 2022, 42(4): 1036-1043. |
[3] | 李海丰, 赵碧帆, 侯谨毅, 王怀超, 桂仲成. 基于自适应双阈值的地下目标自动检测算法[J]. 《计算机应用》唯一官方网站, 2022, 42(4): 1275-1283. |
[4] | 陈浩杰, 范江亭, 刘勇. 深度强化学习解决动态旅行商问题[J]. 《计算机应用》唯一官方网站, 2022, 42(4): 1194-1200. |
[5] | 王颖洁, 朱久祺, 汪祖民, 白凤波, 弓箭. 自然语言处理在文本情感分析领域应用综述[J]. 《计算机应用》唯一官方网站, 2022, 42(4): 1011-1020. |
[6] | 蔡前舟, 郑伯川, 曾祥银, 侯金. 结合长尾数据解决方法的野生动物目标检测[J]. 《计算机应用》唯一官方网站, 2022, 42(4): 1284-1291. |
[7] | 董永峰, 邓亚晗, 董瑶, 王雅琮. 基于深度学习的聚类综述[J]. 《计算机应用》唯一官方网站, 2022, 42(4): 1021-1028. |
[8] | 胡新荣, 张君宇, 彭涛, 刘军平, 何儒汉, 何凯. 级联跨域特征融合的虚拟试衣[J]. 《计算机应用》唯一官方网站, 2022, 42(4): 1269-1274. |
[9] | 季长清, 高志勇, 秦静, 汪祖民. 基于卷积神经网络的图像分类算法综述[J]. 《计算机应用》唯一官方网站, 2022, 42(4): 1044-1049. |
[10] | 董永峰, 孙跃华, 高立超, 韩鹏, 季海鹏. 基于改进一维卷积和双向长短期记忆神经网络的故障诊断方法[J]. 《计算机应用》唯一官方网站, 2022, 42(4): 1207-1215. |
[11] | 刘志华, 陈文洁, 陈爱斌. 基于自注意力机制时频谱同源特征融合的鸟鸣声分类[J]. 《计算机应用》唯一官方网站, 2022, 42(4): 1260-1268. |
[12] | 顾军华, 王锐, 李宁宁, 张素琪. 融合协同过滤信息的知识图注意力网络[J]. 《计算机应用》唯一官方网站, 2022, 42(4): 1087-1092. |
[13] | 赵玉明, 顾慎凯. 融合残差密集块自注意力机制和生成对抗网络的对抗攻击防御模型[J]. 《计算机应用》唯一官方网站, 2022, 42(3): 921-929. |
[14] | 刘朋伟, 高媛, 秦品乐, 殷喆, 王丽芳. 基于多感受野的生成对抗网络医学MRI影像超分辨率重建[J]. 《计算机应用》唯一官方网站, 2022, 42(3): 938-945. |
[15] | 危德健, 王文明, 王全玉, 任好盼, 高彦彦, 王志. 改进的基于锚点的三维手部姿态估计网络[J]. 《计算机应用》唯一官方网站, 2022, 42(3): 953-959. |
阅读次数 | ||||||
全文 |
|
|||||
摘要 |
|
|||||