>> 自然科学版期刊 >> 2026 >> 2026年01期 >> 正文
一种用于口罩佩戴检测的轻量级YOLOv5s改进算法
时间: 2025-12-03 次数:

沈记全, 马帅, 罗军伟,等.一种用于口罩佩戴检测的轻量级YOLOv5s改进算法[J].河南理工大学学报(自然科学版),2026,45(1):153-160.

SHEN J Q, MA S, LUO J W, et al.An improved lightweight YOLOv5s algorithm for mask-wearing detection[J].Journal of Henan Polytechnic University(Natural Science) ,2026,45(1):153-160.

一种用于口罩佩戴检测的轻量级YOLOv5s改进算法

沈记全1, 马帅1,2, 罗军伟1, 张霄宏1

1.河南理工大学 软件学院,河南 焦作  454000;2.河南理工大学 计算机科学与技术学院,河南 焦作  454000

摘要: 目的 为了在公共场所准确地检测口罩佩戴并根据检测结果进行人性化提醒,提出一种轻量化的YOLOv5s网络结构,并以此为基础构建一种快速的口罩佩戴检测方案,以应对真实场景中对口罩佩戴检测速度和准确性的双重要求。 方法 首先,对快速空间金字塔池化进行改进,用深度卷积替换原来的卷积,以达到对快速空间金字塔池化进行轻量化的目的;其次,提出自校准通道注意力机制,它由两级通道交互构成,第一级交互用于获取邻近通道之间的相关性并根据相关性计算通道权重,第二级交互用于在更大的通道范围内对第一级交互得到的通道权重进行校准,该机制已经应用在网络的Neck部分;再次,对加权双向特征金字塔网络进行改进,增加大尺度特征图和小尺度特征图的融合路径,以丰富融合后的小尺度特征图中包含的细节信息;最后,利用GhostConv模块和C3Ghost模块分别替换Backbone和Neck部分的Conv模块和C3模块,从而降低网络的计算量和参数量,达到对Backbone和Neck进行轻量化的目的。 结果 在自制数据集和公共数据集Moxa3K上的实验结果表明,所提方法与YOLOv5s相比, mAP分别提高了3.1%和2.9%,参数量分别降低了46.8%和46.8%,检测速度分别提升了25%和29.1%。 结论 实验结果证明了所提方法的有效性。

关键词:口罩佩戴检测;YOLOv5;轻量化;注意力机制;双向特征融合

doi:10.16186/j.cnki.1673-9787.2023090056

基金项目:国家自然科学基金资助项目(61972134);河南理工大学创新科研团队项目(T2021-3)

收稿日期:2023/09/26

修回日期:2024/03/14

出版日期:2025-12-03

An improved lightweight YOLOv5s algorithm for mask-wearing detection

Shen Jiquan1, Ma Shuai1,2, Luo Junwei1, Zhang Xiaohong1

1.Software School, Henan Polytechnic University, Jiaozuo  454000, Henan, China;2.School of Computer Science and Technology, Henan Polytechnic University, Jiaozuo  454000, Henan, China

Abstract: Objectives In order to accurately detect mask wearing in public places and provide humanized reminders based on the detection results, a fast mask wearing detection solution was constructed to cope with the dual demands of detection speed and accuracy in the real-world scenarios. Methods Firstly, Fast Spatial Pyramid Pooling was improved by replacing the original convolution with deep convolution to achieve the purpose of lightweight the Fast Spatial Pyramid Pooling. Secondly, a self-calibrating channel attention mechanism was proposed, which consists of two levels of channel interactions. The first level of interactions was used to obtain the correlation between neighboring channels and channel weights were computed based on the correlation, and the second level of interactions was used to calibrate the channel weights obtained from the first level of interactions over a larger range of channels. This mechanism has been applied to the Neck part of the network. Thirdly, Weighted Bi-directional Feature Pyramid Network was improved by introducing fusion paths for large-scale feature maps and small-scale feature maps, which aimed to enrich the detail information in the fused small-scale feature maps. Finally, GhostConv module and C3Ghost module were separately utilized to replace the Conv module and C3 module in the Backbone and Neck parts respectively, which aimed to reduce the computation and parameters of the network and finally lightweight the Backbone and Neck. Results According to the results on the self-made datasets and the public datasets Moxa3K, the solution in this paper separately improved mAP by 3.1% and 2.9%, reduced parameters by 46.8% and 46.8%, and improved detection speed by 25% and 29.1% when comparing with YOLOv5s. Conclusions The experimental results demonstrated the effectiveness of the proposed solution.

Key words:mask wear detection;YOLOv5;lightweight;attention mechanism;bi-directional feature fusion

最近更新