Skip to main content
Log in

Fast detection of face masks in public places using QARepVGG-YOLOv7

  • Research
  • Published:
Journal of Real-Time Image Processing Aims and scope Submit manuscript

Abstract

The COVID-19 pandemic has resulted in substantial global losses. In the post-epidemic era, public health needs still advocate the correct use of medical masks in confined spaces such as hospitals and indoors. This can effectively block the spread of infectious diseases through droplets, protect personal and public health, and improve the environmental sustainability and social resilience of cities. Therefore, detecting the correct wearing of masks is crucial. This study proposes an innovative three-class mask detection model based on the QARepVGG-YOLOv7 algorithm. The model replaces the convolution module in the backbone network with the QARepVGG module and uses the quantitative friendly structure and re-parameterization characteristics of the QARepVGG module to achieve high-precision and high-efficiency target detection. To validate the effectiveness of our proposed method, we created a mask dataset of 5095 pictures, including three categories: correct use of masks, incorrect use of masks, and individuals who do not wear masks. We also employed data augmentation techniques to further balance the dataset categories. We tested YOLOv5s, YOLOv6, YOLOv7, and YOLOv8s models on self-made datasets. The results show that the QARepVGG-YOLOv7 model has the best accuracy compared with the most advanced YOLO model. Our model achieves a significantly improved mAP value of 0.946 and a faster fps of 263.2, which is 90.8 fps higher than the YOLOv7 model and a 0.5% increase in map value over the YOLOv7 model. It is a high-precision and high-efficiency mask detection model.

This is a preview of subscription content, log in via an institution to check access.

Access this article

Price excludes VAT (USA)
Tax calculation will be finalised during checkout.

Instant access to the full article PDF.

Fig. 1
Fig. 2
Fig. 3
Fig. 4
Fig. 5
Fig. 6
Fig. 7
Fig. 8
Fig. 9

Similar content being viewed by others

Data availability

No datasets were generated or analyzed during the current study.

References

  1. Xinran, W., Qichuan, T., Dong, Z.: Review of research on face mask wearing detection. Comput. Eng. Appl. 58, 13–26 (2022). https://doi.org/10.3778/j.issn.1002-8331.2110-0396

    Article  Google Scholar 

  2. Paul, V., Michael, J.: Robust real-time face detection. Int. J. Comput. Vis. 57, 137–154 (2004). https://doi.org/10.1023/B:VISI.0000013087.49260.fb

    Article  Google Scholar 

  3. Navneet, D., Bill, T.: Histograms of oriented gradients for human detection. In: 2005 IEEE computer society conference on computer vision and pattern recognition (CVPR’05). 1 pp. 886-893 (2005). https://doi.org/10.1109/CVPR.2005.177

  4. David, L.G.: Distinctive image features from scale-invariant keypoints. Int. J. Comput. Vision 60, 91–110 (2004). https://doi.org/10.1023/B:VISI.0000029664.99615.94

    Article  Google Scholar 

  5. Ross, G., Jeff, D., Trevor, D., Jitendra, M.: Rich feature hierarchies for accurate object detection and semantic segmentation. In: Proceedings of the IEEE conference on computer vision and pattern recognition. pp. 580-587 (2014). https://doi.org/10.1109/CVPR.2014.81

  6. Ross, G.: Fast R-CNN. In: 2015 IEEE International Conference on Computer Vision (ICCV). pp. 1440-1448 (2015). https://doi.org/10.1109/ICCV.2015.169

  7. Shaoqing, R., Kaiming, H., Ross, G., Jian, S.: Faster R-CNN: towards real-time bbject detection with region proposal networks. IEEE Trans. Pattern Anal. Mach. Intell. 39, 1137–1149 (2017). https://doi.org/10.1109/TPAMI.2016.2577031

    Article  Google Scholar 

  8. Wei, L., Dragomir, A., Dumitru, E., Christian, S., Scott, R., Cheng-Yang, F., Alexander, B.C.: SSD: single shot multiBox detector. Comput. Vis. ECCV (2016). https://doi.org/10.1007/978-3-319-46448-0_2

    Article  Google Scholar 

  9. Joseph, R., Santosh, D., Ross, G., Ali, F.: You Only Look Once: Unified, Real-Time Object Detection. In: 2016 IEEE Conference on Computer Vision and Pattern Recognition (CVPR). pp. 779-788 (2016). https://doi.org/10.1109/CVPR.2016.91

  10. Cao, X.: Research and system implementation of real-time detection algorithm for mask wearing based on deep learning. Master’s Thesis Anhui Eng. Univ. (2022). https://doi.org/10.27763/d.cnki.gahgc.2022.000143

    Article  Google Scholar 

  11. Yassine, H., Somaya, A., Iraklis, V., Noor, A., Khalid, A., Amr, M.: Face Mask Detection in Smart Cities Using Deep and Transfer Learning: Lessons Learned from the COVID-19 Pandemic. Systems 11, 107 (2023). https://doi.org/10.3390/systems11020107

    Article  Google Scholar 

  12. Mingyuan, X., Heng, W., Shuqun, Y., Rui, L.: Mask wearing detection method based on SSD-Mask algorithm. In: 2020 International Conference on Computer Science and Management Technology (ICCSMT). pp. 138-143 (2020). https://doi.org/10.1109/ICCSMT51754.2020.00034

  13. Haleem, F., Taimoor, K., Zahid, K., Shabana, H., Muhammad, I., Adel, A.: Real-time face mask detection to ensure COVID-19 precautionary measures in the developing countries. Appl. Sci. 12, 3879 (2022). https://doi.org/10.3390/app12083879

    Article  Google Scholar 

  14. Jesús, T., Albert, R., Sandra, V., Jaime, L.: Incorrect facemask-wearing detection using convolutional neural networks with transfer learning. Healthcare 9, 1050 (2021). https://doi.org/10.3390/healthcare9081050

    Article  Google Scholar 

  15. Muhammad Zubair, A., et al.: Facial mask detection using depthwise separable convolutional neural network model during COVID-19 pandemic. Front. Public Health 10, 855254 (2022). https://doi.org/10.3389/fpubh.2022.855254

    Article  Google Scholar 

  16. Liu, Z.: Improved face mask detection algorithm based on YOLOX. Master’s thesis, Nanjing University of Posts and Telecommunications (2023). https://doi.org/10.27251/d.cnki.gnjdc.2022.000194

  17. Shanmughapriya, M., Josephine Ruth, F., Sanchana, R.: Proper face mask detection using deep learning. Elem. Edu. Online 19, 2158–2158 (2022). https://doi.org/10.17051/ilkonline.2020.02.696800

    Article  Google Scholar 

  18. Changqing, W., Bei, Z., Yuan, C., Maoxuan, S., Kunyu, H., Zhonghao, C., Meng, W.: Mask detection method based on YOLO-GBC network. Electronics 12, 408 (2023). https://doi.org/10.3390/electronics12020408

    Article  Google Scholar 

  19. Mohamed, L., Gunasekaran, M., Mohamed, Hamed N.: Fighting against COVID-19: a novel deep learning model based on YOLO-v2 with ResNet-50 for medical face mask detection. Sustain. Cit. Soc. 65, 102600 (2021). https://doi.org/10.1016/j.scs.2020.102600

    Article  Google Scholar 

  20. Dostdar, H., Muhammad, I., Israr, H., Roobaea, A., Saddam, H., Syed Sajid, U.: Face mask detection using deep convolutional neural network and MobileNetV2-based transfer learning. Wirel. Commun. Mob. Comput. 2022, 1536318 (2022). https://doi.org/10.1155/2022/1536318

    Article  Google Scholar 

  21. Zhenggong, H., Haisong, H., Qingsong, F., Yiting, L., Yuqin, L., Xingran, C.: SMD-YOLO: an efficient and lightweight detection method for mask wearing status during the COVID-19 pandemic. Comput. Methods Programs Biomed. 221, 106888 (2022). https://doi.org/10.1016/j.cmpb.2022.106888

    Article  Google Scholar 

  22. Mona, A.S.A., Anitha, S., Suresh, M., Chandrasekaran, V., Hitesh, P., Mahendran, K., Diaa Salama, E., Rasha, O.: Real-time facemask detection for preventing COVID-19 spread using transfer learning based deep neural network. Electronics 11, 2250 (2022)

    Article  Google Scholar 

  23. Akhil, K., Arvind, K., Aayushi, K.: ETL-YOLO v4: a face mask detection algorithm in era of COVID-19 pandemic. Optik 259, 169051 (2022). https://doi.org/10.1016/j.ijleo.2022.169051

    Article  Google Scholar 

  24. Zhang, Y., Sun, Y., Wang, Z., Jiang, Y.: YOLOv7-RAR for urban vehicle detection. Sensors 23(4), 1801 (2023). https://doi.org/10.3390/s23041801

    Article  Google Scholar 

  25. Zhigao, W., Ming, C.: Lightweight detection method for microalgae based on improved YOLO v7. J Dalian Ocean Univ 38(1), 129–139 (2023). https://doi.org/10.16535/j.cnki.dlhyxb.2022-338

    Article  Google Scholar 

  26. Zheng, Z., Wang, P., Ren, D., Liu, W., Ye, R., Hu, Q., Zuo, W.: Enhancing geometric factors in model learning and inference for object detection and instance segmentation. IEEE Trans. Cybern. 52(8), 8574–8586 (2022). https://doi.org/10.1109/TCYB.2021.3095305

    Article  Google Scholar 

  27. Chu, X., Li, L., Zhang, B.: Make RepVGG Greater Again: A Quantization-aware Approach. arXiv preprint arXiv:2212.01593. (2022). https://doi.org/10.48550/arXiv.2212.01593

  28. Larxel: Face mask detection. https://www.kaggle.com/datasets/andrewmvd/face-mask-detection (2020)

  29. Revanth: MAFA dataset. https://www.kaggle.com/datasets/revanthrex/mafadataset(2020)

  30. Humans in the Loop: Medical mask dataset. https://humansintheloop.org/resources/datasets/medical-mask-dataset/ (2020)

  31. Jocher, G., Chaurasia, A., Stoken, A., Borovec, J., NanoCode012, Kwon, Y., Michael, K., TaoXie, Fang, J., imyhxy, Lorna, Yifu, Z., Wong, C., V, A., Montes, D., Wang, Z., Fati, C., Nadar, J., Laughing, UnglvKitDe, Sonck, V., tkianai, yxNONG, Skalski, P., Hogan, A., Nair, D., Strobel, M., Jain, M.: YOLOv5 SOTA Realtime Instance Segmentation. Zenodo. v7.0 (2022). https://doi.org/10.5281/zenodo.7347926

  32. Li, C., Li, L., Jiang, H., Weng, K., Geng, Y., Li, L., Ke, Z., Li, Q., Cheng, M., Nie, W., Li, Y., Zhang, B., Liang, Y., Zhou, L., Xu, X., Chu, X., Wei, X., Wei, X.: YOLOv6: A Single-Stage Object Detection Framework for Industrial Applications. arXiv preprint arXiv:2209.02976. (2022). https://doi.org/10.48550/arXiv.2209.02976

  33. Wang, C., Bochkovskiy, A., Liao, H.: YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors. arXiv preprint arXiv:2207.02696. (2022). https://doi.org/10.48550/arXiv.2207.02696

  34. Wang, Z., Huang, B., Wang, G., Yi, P., Jiang, K.: Masked face recognition dataset and application. IEEE Trans. Biom. Behav. Ident. Sci. 5, 298–304 (2023). https://doi.org/10.1109/TBIOM.2023.3242085

    Article  Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Contributions

C.G. was responsible for the conceptualization, methodology, software, investigation, visualization, data curation, validation, and writing the original draft. J.J. was involved in the investigation and validation. Z.W. conceptualized the study and provided supervision. All authors reviewed the manuscript.

Corresponding author

Correspondence to Zhong Wang.

Ethics declarations

Conflict of interest

All authors declare that they have no conflict of interest and that no funds, grants, or other forms of support were received for this study.

Additional information

Publisher's Note

Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.

Rights and permissions

Springer Nature or its licensor (e.g. a society or other partner) holds exclusive rights to this article under a publishing agreement with the author(s) or other rightsholder(s); author self-archiving of the accepted manuscript version of this article is solely governed by the terms of such publishing agreement and applicable law.

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Guan, C., Jiang, J. & Wang, Z. Fast detection of face masks in public places using QARepVGG-YOLOv7. J Real-Time Image Proc 21, 95 (2024). https://doi.org/10.1007/s11554-024-01476-y

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: https://doi.org/10.1007/s11554-024-01476-y

Keywords

Navigation