Computer Engineering and Applications ›› 2022, Vol. 58 ›› Issue (9): 303-312.DOI: 10.3778/j.issn.1002-8331.2112-0242

• Engineering and Applications • Previous Articles    

YOLOv5 Helmet Wear Detection Method with Introduction of Attention Mechanism

WANG Lingmin, DUAN Jun, XIN Liwei   

  1. 1.School of Information Engineering, Inner Mongolia University of Science & Technology, Baotou, Inner Mongolia 014010, China
    2.Mining Research Institute, Inner Mongolia University of Science & Technology, Baotou, Inner Mongolia 014010, China
    3.Baotou Lianfang Information Automation Co., Ltd., Baotou, Inner Mongolia 014010, China
  • Online:2022-05-01 Published:2022-05-01



  1. 1.内蒙古科技大学 信息工程学院,内蒙古 包头 014010
    2.内蒙古科技大学 矿业研究院,内蒙古 包头 014010
    3.包头市联方信息自动化有限责任公司,内蒙古 包头 014010

Abstract: For high-risk industries such as steel manufacturing, coal mining and construction industries, wearing helmets during construction is one of effective ways to avoid injuries. For the current helmet wearing detection model in a complex environment for small and dense targets, there are problems such as false detection and missed detection, an improved YOLOv5 target detection method is proposed to detect the helmet wearing. A coordinate attention mechanism(coordinate attention) is added to the backbone network of YOLOv5, which embeds location information into channel attention so that the network can pay attention on a larger area. The original feature pyramid module in the feature fusion module is replaced with a weighted bi-directional feature pyramid(BiFPN)network structure to achieve efficient bi-directional cross-scale connectivity and weighted feature fusion. The experimental results on the homemade helmet dataset show that the improved YOLOv5 model achieves an average accuracy of 95.9%, which is 5.1 percentage points higher than the YOLOv5 model, and meets the requirements for small and dense target detection in complex environments.

Key words: helmet wearing detection, YOLOv5 algorithm, weighted bidirectional feature pyramid, coordinate attention mechanism

摘要: 对于钢铁制造业、煤矿行业及建筑行业等高危行业来说,施工过程中佩戴安全帽是避免受伤的有效途径之一。针对目前安全帽佩戴检测模型在复杂环境下对小目标和密集目标存在误检和漏检等问题,提出一种改进YOLOv5的目标检测方法来对安全帽的佩戴进行检测。在YOLOv5的主干网络中添加坐标注意力机制(coordinate attention),该机制将位置信息嵌入到通道注意力当中,使网络可以在更大区域上进行注意。将特征融合模块中原有特征金字塔模块替换成加权双向特征金字塔(BiFPN)网络结构,实现高效的双向跨尺度连接和加权特征融合。在自制安全帽数据集上实验结果表明,改进的YOLOv5模型平均精度达到了95.9%,相比于YOLOv5模型,平均精度提高了5.1个百分点,达到了在复杂环境下对小目标和密集目标检测的要求。

关键词: 安全帽佩戴检测, YOLOv5算法, 加权双向特征金字塔, 坐标注意力机制