| In order to prevent and respond to sudden public health emergencies,it is crucial to be able to accurately and instantly determine whether people are wearing masks in public places.Currently,face mask detection in public places is typically done through manual inspections,which requires a lot of human resources and poses a significant risk of infection.With the rapid development of target detection algorithms,real-time face mask detection using deep learning has become an urgent problem in the field of computer vision applications.However,these methods are often affected by issues such as significant image differences in the dataset,which can lead to suboptimal detection results.To address these issues,the main work of this paper is as follows:(1)In order to improve data consistency and the detection accuracy of mask detection algorithms,a dataset specifically for mask-wearing detection was constructed by continuing to filter various open-source mask datasets.Image enhancement techniques,such as cropping,scaling,flipping,and mosaic data augmentation,were used to enhance the images,and unannotated images were also labeled.(2)In order to improve the detection of small targets in face mask object detection,a face mask detection method based on an improved YOLOv5 network model was proposed.The algorithm incorporates channel attention and spatial attention mechanisms in the feature pyramid to increase the algorithm’s attention to important parts of the input image.Finally,the improved YOLOv5 algorithm was compared to similar object detection algorithms on the dataset,and the addition of the attention module to some algorithms demonstrated that the improved YOLOv5 algorithm has better detection performance.(3)In order to reduce the parameter and computational complexity of the network model,and to address the issue of high inference latency,a mask detection algorithm based on the YOLOv8 algorithm was proposed.The algorithm optimizes the C2 f module in the network structure using the C3 Ghost module of Ghost convolution,and introduces spatial attention and channel attention modules to achieve fast and accurate mask target detection on a lightweight basis.Finally,various experiments were conducted on the dataset and compared with representative related algorithms.The experimental results showed that although the improved algorithm has a lower mean average precision than the YOLOv8 algorithm,its model parameters,computational complexity,and inference latency are the lowest. |