
Enhancing mask detection performance based on YOLOv5 model optimization and attention mechanisms
- 1 Hubei University of Technology
* Author to whom correspondence should be addressed.
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.
Keywords
Mask Detection, YOLOv5, Attention Mechanism, Feature Fusion
[1]. 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
[2]. 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
[3]. 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.
[4]. Xu S 2022 An Improved Lightweight YOLOv5 Model Based on Attention Mechanism for Face Mask Detection. International Conference on Artificial Neural Networks.
[5]. Vaswani A et al 2017 Attention is All you Need. NIPS.
[6]. 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.
[7]. Abadi M et al 2016 TensorFlow: A system for large-scale machine learning. USENIX Symposium on Operating Systems Design and Implementation.
[8]. Gong H et al 2022 Swin-transformer-enabled YOLOv5 with attention mechanism for small object detection on satellite images. Remote Sensing, 14(12), 2861.
[9]. 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.
[10]. 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.
[11]. 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.
[12]. 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.
[13]. Linlin Z et al 2021 Improving YOLOv5 with Attention Mechanism for Detecting Boulders from Planetary Images Remote Sensing, 13(18), 3776-3776.
[14]. 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.
[15]. 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.
[16]. 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).
[17]. Ren S et al 2015 Faster r-cnn: Towards real-time object detection with region proposal networks. Advances in neural information processing systems, 28.
[18]. Guo C et al 2022 Multi-Stage Attentive Network for Motion Deblurring via Binary Cross-Entropy Loss. Entropy, 24(10), 1414.
Cite this article
Yang,G. (2024). Enhancing mask detection performance based on YOLOv5 model optimization and attention mechanisms. Applied and Computational Engineering,50,32-40.
Data availability
The datasets used and/or analyzed during the current study will be available from the authors upon reasonable request.
Disclaimer/Publisher's Note
The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of EWA Publishing and/or the editor(s). EWA Publishing and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
About volume
Volume title: Proceedings of the 4th International Conference on Signal Processing and Machine Learning
© 2024 by the author(s). Licensee EWA Publishing, Oxford, UK. This article is an open access article distributed under the terms and
conditions of the Creative Commons Attribution (CC BY) license. Authors who
publish this series agree to the following terms:
1. Authors retain copyright and grant the series right of first publication with the work simultaneously licensed under a Creative Commons
Attribution License that allows others to share the work with an acknowledgment of the work's authorship and initial publication in this
series.
2. Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the series's published
version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgment of its initial
publication in this series.
3. Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and
during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See
Open access policy for details).