>> English >> Current Issue >> Mechanical & Electrical Engineering · Intelligent Systems >> 正文
An improved lightweight YOLOv5s algorithm for mask-wearing detection
Time: 2025-12-03 Counts:

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.

doi:10.16186/j.cnki.1673-9787.2023090056

Received:2023/09/26

Revised:2024/03/14

Published: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

Lastest