Enhancing mask detection performance based on YOLOv5 model optimization and attention mechanisms
Abstract
Due to the COVID-19 pandemic, there has been a significant increase in the usage of masks, leading to more complex scenarios for mask detection techniques. This paper focuses on optimizing the performance of mask detection using the You Only Look Once (YOLO) v5 model. In this study, the yolov5 target detection model was employed for training the mask dataset. Diverse model improvement techniques were explored to enhance the model's capability to capture crucial features and differentiate masks from the background in complex scenarios. Finally, the modified model was compared with the earlier original target detection model to identify the most considerable performance gain. The CSPDarknet design with the TensorFlow framework is utilized in this study, and the Attention Mechanism module is implemented through the Keras library. The objective is to optimize the three feature layers between the backbone network and the neck by integrating multiple attention mechanisms. This will enable the model to more quickly and accurately capture important features when dealing with complex scenarios by adjusting the feature map weights. Additionally, in the feature pyramid network, shallow feature maps are fused with deeper feature maps in a certain order to determine the most efficient feature fusion method. Finally, this study identified the optimal combination of attention mechanism and feature fusion through ablation experiments. The results of the experiment demonstrate that the combination of SE block and shallow feature fusion (SE + FF2 model) can greatly enhance category confidence, leading to an improved model performance.
References
- Andrejko K L 2022 COVID-19 Case-Control Study Team Effectiveness of Face Mask or Respirator Use in Indoor Public Settings for Prevention of SARS-CoV-2 Infection - California, February-December 2021. MMWR. Morbidity and mortality weekly report, 71(6), 212–216. https://doi.org/10.15585/mmwr.mm7106e1
- Pei W et al 2023 Small target detection with remote sensing images based on an improved YOLOv5 algorithm. Frontiers in neurorobotics, 16, 1074862. https://doi.org/10.3389/fnbot.2022.1074862
- Susanto S et al 2020 The Face Mask Detection For Preventing the Spread of COVID-19 at Politeknik Negeri Batam 2020 3rd International Conference on Applied Engineering (ICAE), Batam, Indonesia pp. 1-5, doi: 10.1109/ICAE50557.2020.9350556.
- Xu S 2022 An Improved Lightweight YOLOv5 Model Based on Attention Mechanism for Face Mask Detection. International Conference on Artificial Neural Networks.
- Vaswani A et al 2017 Attention is All you Need. NIPS.
- Pratama Y et al 2021 Application of YOLO (You Only Look Once) V. 4 with Preprocessing Image and Network Experiment. The IJICS (International Journal of Informatics and Computer Science), 5(3), 280-286.
- Abadi M et al 2016 TensorFlow: A system for large-scale machine learning. USENIX Symposium on Operating Systems Design and Implementation.
- Gong H et al 2022 Swin-transformer-enabled YOLOv5 with attention mechanism for small object detection on satellite images. Remote Sensing, 14(12), 2861.
- Xia W et al 2022 A high-precision lightweight smoke detection model based on SE attention mechanism. In 2022 2nd International Conference on Consumer Electronics and Computer Engineering (ICCECE) (pp. 941-944). IEEE.
- Qiu Y et al 2022 Pose-guided matching based on deep learning for assessing quality of action on rehabilitation training. Biomedical Signal Processing and Control, 72, 103323.
- Shi G et al 2021 Combined Channel and Spatial Attention for YOLOv5 during Target Detection. In 2021 IEEE 2nd International Conference on Pattern Recognition and Machine Learning (PRML) (pp. 78-85). IEEE.
- Yang S Q et al 2022 Student in-class behaviors detection and analysis system based on CBAM-YOLOv5. In 2022 7th International Conference on Intelligent Computing and Signal Processing (ICSP) (pp. 440-443). IEEE.
- Linlin Z et al 2021 Improving YOLOv5 with Attention Mechanism for Detecting Boulders from Planetary Images Remote Sensing, 13(18), 3776-3776.
- Yang W et al 2023 ST-CA YOLOv5: Improved YOLOv5 Based on Swin Transformer and Coordinate Attention for Surface Defect Detection. In 2023 International Joint Conference on Neural Networks (IJCNN) (pp. 1-8). IEEE.
- Bottou L 2010 Large-scale machine learning with stochastic gradient descent. In Proceedings of COMPSTAT'2010: 19th International Conference on Computational StatisticsParis France, August 22-27, 2010 Keynote, Invited and Contributed Papers (pp. 177-186). Physica-Verlag HD.
- Zheng Z et al 2020 Distance-IoU loss: Faster and better learning for bounding box regression. In Proceedings of the AAAI conference on artificial intelligence (Vol. 34, No. 07, pp. 12993-13000).
- Ren S et al 2015 Faster r-cnn: Towards real-time object detection with region proposal networks. Advances in neural information processing systems, 28.
- Guo C et al 2022 Multi-Stage Attentive Network for Motion Deblurring via Binary Cross-Entropy Loss. Entropy, 24(10), 1414.