欢迎访问《图学学报》 分享到:

图学学报 ›› 2023, Vol. 44 ›› Issue (1): 16-25.DOI: 10.11996/JG.j.2095-302X.2023010016

• 图像处理与计算机视觉 • 上一篇    下一篇

融合注意力机制的YOLOv5口罩检测算法

李小波1(), 李阳贵1,2(), 郭宁1, 范震1   

  1. 1. 青海大学计算机技术与应用系,青海 西宁 810016
    2. 青海大学省部共建三江源生态与高原农牧业国家重点实验室,青海 西宁 810016
  • 收稿日期:2022-06-05 修回日期:2022-08-03 出版日期:2023-10-31 发布日期:2023-02-16
  • 通讯作者: 李阳贵
  • 作者简介:李小波(1998-),男,硕士研究生。主要研究方向为目标检测、图像处理。E-mail:1336441422@qq.com
  • 基金资助:
    国家自然科学基金项目(61962051);省部共建三江源生态与高原农牧业国家重点实验室自主课题项目(2021-ZZ-2)

Mask detection algorithm based on YOLOv5 integrating attention mechanism

LI Xiao-bo1(), LI Yang-gui1,2(), GUO Ning1, FAN Zhen1   

  1. 1. Department of Computer Technology and Applications, Qinghai University, Xining Qinghai 810016, China
    2. State Key Laboratory of Plateau Ecology and Agriculture, Qinghai University, Xining Qinghai 810016, China
  • Received:2022-06-05 Revised:2022-08-03 Online:2023-10-31 Published:2023-02-16
  • Contact: LI Yang-gui
  • About author:LI Xiao-bo (1998-), master student. His main research interests cover object detection and image processing. E-mail:1336441422@qq.com
  • Supported by:
    National Natural Science Foundation of China(61962051);Independent Project of the State Key Laboratory of Plateau Ecology and Agriculture(2021-ZZ-2)

摘要:

新冠疫情期间正确佩戴口罩可以有效防止病毒的传播,针对公共场所存在的人员密集、检测目标较小等加大检测难度的问题,提出一种以YOLOv5s模型为基础并引入注意力机制融合多尺度注意力权重的口罩佩戴检测算法。在YOLOv5s模型的骨干网络中分别引入4种注意力机制,抑制无关信息,增强特征图的信息表达能力,提高模型对小尺度目标的检测能力。实验结果表明,引入CBAM模块后较原网络mAP值提升了6.9个百分点,在4种注意力机制中提升幅度最明显,而引入NAM模块后在损失少量mAP的情况下使参数量最少,最后通过对比实验选用GIoU损失函数计算边界框回归损失,进一步提升定位精度,最终结果较原网络mAP值提升了8.5个百分点。改进模型在不同场景下的检测结果证明了该算法对小目标检测的准确率和实用性。

关键词: 口罩检测, YOLOv5, 注意力机制, 特征融合, 小目标检测

Abstract:

Wearing masks correctly during the COVID-19 pandemic can effectively prevent the spread of the virus. In response to the detection challenge posed by dense crowds and small detection targets in public places, a mask wearing detection algorithm based on the YOLOv5s model and integrating an attention mechanism was proposed. Four attention mechanisms were introduced into the backbone network of the YOLOv5s model to respectively suppress irrelevant information, enhance the ability of the feature map to express information, and improve the model?s detection ability for small-scale targets. Experimental results show that the introduction of the convolutional block attention module could increase the mAP value by 6.9 percentage points compared with the original network, with the greatest improvement among the four attention mechanisms. The normalization-based attention module also showed excellent performance, with the least quantity of parameters while losing a small amount of mAP. Through comparative experiments, the GIoU loss function was selected to calculate the bounding box regression loss, resulting in further improvements to positioning accuracy, resulting in an mAP value that was improved by 8.5 percentage points compared to the original network. The detection results of the improved model in different scenarios prove the accuracy and practicability of the algorithm for small target detection.

Key words: mask detection, YOLOv5, attention mechanism, feature fusion, small target detection

中图分类号: