Computer Engineering and Applications ›› 2024, Vol. 60 ›› Issue (3): 78-87.DOI: 10.3778/j.issn.1002-8331.2305-0209

• Special Issue on Object Detection • Previous Articles     Next Articles

Improved YOLOv5 Helmet Wearing Detection Algorithm for Small Targets

DENG Zhenrong, XIONG Yuxu, YANG Rui, CHEN Yuren   

  1. 1.School of Computer and Information Security, Guilin University of Electronic Science and Technology, Guilin, Guangxi 541004, China
    2.Guangxi Key Laboratory of Image Graphics and Intelligent Processing, Guilin, Guangxi 541004, China
    3.Guangxi Construction Engineering Dadu Leasing Co., Ltd., Nanning 530000, China
  • Online:2024-02-01 Published:2024-02-01



  1. 1.桂林电子科技大学 计算机与信息安全学院,广西 桂林 541004
    2.广西图像图形与智能处理重点实验室,广西 桂林 541004
    3.广西建工大都租赁有限公司,南宁 530000

Abstract: Safety helmets are the safety guarantee for construction personnel, but existing safety helmet detection models have issues such as false detection and missed detection of overlapping and dense small targets in complex environments. Therefore, an improved small target detection algorithm of YOLOv5 is proposed. Transformer is added to the backbone network of YOLOv5 to capture global information at multiple scales and obtain richer high-level semantic features. This paper uses GsConv convolution for feature fusion enhancement and introduces coordinate attention mechanism to enable the network to pay attention on a larger area. The detection head decouples classification and regression to accelerate convergence speed. Anchor-free detection method is used to simplify algorithm structure and accelerate detection speed. The EIOU loss function is used to optimize the accuracy of frame prediction. The experimental results on the self-made helmet dataset show that the improved YOLOv5 model has an average accuracy of 96.33%, which is 4.73?percentage points higher than the YOLOv5 model, meeting the requirements for detecting overlapping and dense small targets under complex conditions.

Key words: safety helmet detection, improved YOLOv5, Transformer, decoupling head, anchor-free

摘要: 安全帽是施工人员的安全保障,但是现有安全帽检测模型在复杂环境下对重叠和密集小目标存在误检和漏检等问题,为此提出改进YOLOv5的小目标检测算法。在YOLOv5的主干网络中加入Transformer捕获多个尺度上的全局信息,获得更丰富的高层语义特征;使用GsConv卷积进行特征融合增强,并引入坐标注意力机制(coordinate attention),让网络在更大区域上进行注意;检测头将分类和回归进行解耦,加快收敛速度;使用无锚点(anchor-free) 的检测方法,简化算法结构,加快检测速度;使用EIOU损失函数来优化边框预测的准确度。在自制安全帽数据集上实验结果表明,改进的YOLOv5模型平均精度达到了96.33%,相比于YOLOv5模型,平均精度提高了4.73个百分点,达到了在复杂条件下对重叠和密集小目标检测的要求。

关键词: 安全帽检测, 改进YOLOv5, Transformer, 解耦头, 无锚点(anchor-free)