计算机工程与应用 ›› 2024, Vol. 60 ›› Issue (1): 104-109.DOI: 10.3778/j.issn.1002-8331.2303-0458

• YOLO系列改进及应用专题 • 上一篇    下一篇

安全帽与反光衣的轻量化检测:改进YOLOv5s的算法

张学立,贾新春,王美刚,智瀚宇   

  1. 山西大学 自动化与软件学院,太原 030013
  • 出版日期:2024-01-01 发布日期:2024-01-01

Lightweight Detection of Helmets and Reflective Clothings: Improved YOLOv5s Algorithm

ZHANG Xueli, JIA Xinchun, WANG Meigang, ZHI Hanyu   

  1. School of Automation and Software Engineering, Shanxi University, Taiyuan 030013, China
  • Online:2024-01-01 Published:2024-01-01

摘要: 安全帽与反光衣检测对生产与交通环境的安全管理具有重要意义。针对目前安全帽和反光衣检测算法参数量大、计算量大和模型体积较大等问题,提出了一种基于YOLOv5s轻量化改进的检测算法。引入GhostNet 网络结构中的Ghost模块代替原有的部分卷积与C3模块,大大降低了模型的复杂度。在主干网中增加CA注意力机制,抑制无效信息,增强对特征丰富区域的提取。用C3CBAM代替neck层的C3模块,既减少参数量,又提高了检测精度。实验结果表明,改进模型的mAP(平均精度)为93.6%,参数量为4.28×106,计算量为9.2?GFLOPs,模型大小为8.58?MB。与YOLOv5模型相比较参数量减少了39%,计算量减少了41.7%,模型大小降低37.3%。该检测算法既保证了检测的识别准确率,又实现了检测算法的轻量化。

关键词: 目标检测, YOLOv5s, GhostNet, 注意力机制, 轻量化

Abstract: Safety helmet and reflective clothing testing is of great significance to the safety management of production and traffic environment. Aiming at the problems such as large number of parameters, large amount of computation and large model size, an improved detection algorithm based on YOLOv5s is proposed in this paper. Firstly, Ghost module in GhostNet network structure is introduced to replace the original partial convolution and C3 module, which greatly reduces the complexity of the model. Then, CA attention mechanism is added to the backbone network to suppress invalid information and enhance the extraction of feature-rich regions. Finally, the C3 module of neck layer is replaced by C3CBAM, which not only reduces the number of parameters, but also improves the detection accuracy. The experimental results show that the mAP (average accuracy) of the improved model is 93.6%, the number of parameters is 4.28×106, the calculation amount is 9.2 GFLOPs, and the model size is 8.58 MB. Compared with the YOLOv5 model, the number of parameters is reduced by 39%, the amount of calculation is reduced by 41.7%, and the model size is reduced by 37.3%. The detection algorithm not only guarantees the recognition accuracy of the detection, but also realizes the lightweight of the detection algorithm.

Key words: object detection, YOLOv5s, GhostNet, attention mechanism, lightweight