Abstract:
Since the outbreak of COVID-19, the detection of wearing masks has become a necessary measure for epidemic prevention and control. To solve the problem about low accuracy of mask wearing detection under dim lighting conditions, a method of mask wearing detection combining attention mechanism with YOLOv5 network model is proposed, which uses image enhancement algorithm to pre-process the training set pictures, and then put these pictures to YOLOv5 network with attention mechanism for iterative training. After training, the optimal weight is saved and the best model is used to test the accuracy on the test set. The experimental results show that the YOLOv5 network model with attention mechanism can effectively enhance the extraction of key points such as face and mask and improve the robustness of the model. The accuracy of mask wearing can reach 92% under dim lighting conditions, which can effectively meet the actual needs.