Real-Time Face Mask Classification with Convolutional Neural Network for Proper and Improper Face Mask Wearing


  • Fatin Amanina Azis
  • Hazwani Suhaimi
  • Emeroylariffion Abas



Face mask, CNN, Real-Time, Infectious Respiratory Diseases, MaskedFace-Net, Image Processing


Since the discovery of COVID-19, the wearing of a face mask has been recognized as an effective means of curbing the spread of most infectious respiratory diseases. A face mask must completely enclose the lips and nose properly for effective prevention of the disease. Some people still refuse to wear the mask, either out of annoyance or difficulty, or they are just wearing it incorrectly, which diminishes the mask's effectiveness and renders it worthless. The deep learning models described in this research provide a mechanism for assessing whether a face mask is being worn correctly or incorrectly using images. For both training and testing, the suggested method makes use of MaskedFace-Net dataset that contains annotated photos of an individual's face with proper and improper masks. Threshold optimizations are applied to produce significant results of prediction when comparing ResNet50, MobileNetV2 and DenseNet121 models. It is observed that better performance can be achieved with having accuracy as the target evaluation metric and reaching accuracy levels of 97.6%, 99.0%, and 99.8% for ResNet50, DenseNet121, and MobileNetV2, respectively after threshold optimization. As an outcome, DenseNet121 outperformed the other evaluated models when accuracy, recall, and precision metrics were used to assess the testing set. The face mask categorization can be used to automatically monitor face masks in real-time in public locations like hospitals, airports, shopping complexes and congested spaces to verify compliance with the published guidelines by the higher authorities in a country, making the results valuable for future use.


S. M. Jung et al., “Real-time estimation of the risk of death from novel coronavirus (COVID-19) infection: Inference using exported cases,” Journal of Clinical Medicine, vol. 9, no. 2, pp. 1–10, 2020,

E. A. Nardell, “Transmission and institutional infection control of tuberculosis,” Cold Spring Harbor Perspectives in Medicine, vol. 6, no. 2, pp. 1–12, 2016,

R. Zhang, Y. Li, A. L. Zhang, Y. Wang, and M. J. Molina, “Identifying airborne transmission as the dominant route for the spread of COVID-19,” Proceedings of the National Academy of Sciences of the United States of America, vol. 117, no. 26, pp. 14857–14863, 2020,

K. Brown and P. A. Leggat, “Human monkeypox: Current state of knowledge and implications for the future,” Tropical Medicine and Infectious Disease, vol. 1, no. 1, pp. 1–13, 2016,

V. Singh and M. Sood, “Swine flu - A comprehensive view,” International Journal of Advancements in Research & Technology, vol. 1, no. 2, pp.1-5, 2012.

C. Matuschek et al., “Face masks: Benefits and risks during the COVID-19 crisis,” European Journal of Medical Research, vol. 25, no. 1, pp. 1–8, 2020,

M. Liao et al., “A technical review of face mask wearing in preventing respiratory COVID-19 transmission,” Current Opinion in Colloid and Interface Science, vol. 52, p. 101417, 2021,

T. U. Rashid, S. Sharmeen, and S. Biswas, “Effectiveness of N95 masks against SARS-CoV-2: Performance efficiency, concerns, and future directions,” ACS Chemical Health & Safety, vol. 29, no. 2, pp. 135–164, 2022,

L. Y. K. Lee et al., “Practice and technique of using face mask amongst adults in the community: A cross-sectional descriptive study,” BMC Public Health, vol. 20, no. 1, pp. 1–11, 2020,

F. A. Azis, H. Suhaimi, and E. Abas, “Waste classification using convolutional neural network,” ACM International Conference Proceeding Series, pp. 9–13, 2020,

M. A. Humayun, H. Yassin, and P. E. Abas, “Native language identification for Indian-speakers by an ensemble of phoneme-specific, and text-independent convolutions,” Speech Communication, vol. 139, no. February 2021, pp. 92–101, 2022,

Y. Zhang, J. Gao, and H. Zhou, “Breeds classification with deep convolutional neural network,” PervasiveHealth: Pervasive Computing Technologies for Healthcare, pp. 145–151, 2020,

H. Nguyen, “Fast object detection framework based on Mobilenetv2 architecture and enhanced feature pyramid,” Journal of Theoretical and Applied Information Technology, vol. 98, no. 5, pp. 812–824, 2020.

M. Almghraby and A. O. Elnady, “Face mask detection in real-time using MobileNetv2,” International Journal of Engineering and Advanced Technology, vol. 10, no. 6, pp. 104–108, 2021,

S. Susanto, F. A. Putra, R. Analia, and I. K. L. N. Suciningtyas, “The face mask detection for preventing the spread of COVID-19 at politeknik negeri batam,” Proceedings of the ICAE 2020 3rd International Conference on Applied Engineering, pp. 1–5, 2020,

A. Negi, K. Kumar, P. Chauhan, and R. S. Rajput, “Deep neural architecture for face mask detection on simulated masked face dataset against covid-19 pandemic,” Proceedings of the IEEE 2021 International Conference on Computing, Communication, and Intelligent Systems, ICCCIS'2021, pp. 595–600, 2021,

S. E. Snyder and G. Husari, “Thor: A deep learning approach for face mask detection to prevent the COVID-19 pandemic,” Conference Proceedings - IEEE SOUTHEASTCON, vol. 2021, March 2021, pp. 1-8.

J. S. Kaiming He, Xiangyu Zhang, Shaoqing Ren, “Deep residual learning for image recognition kaiming,” Indian Journal of Chemistry - Section B Organic and Medicinal Chemistry, vol. 45, no. 8, pp. 1951–1954, 2006,

K. E. Tokarev, V. M. Zotov, V. N. Khavronina, and O. V. Rodionova, “Convolutional neural network of deep learning in computer vision and image classification problems,” IOP Conference Series: Earth and Environmental Science, vol. 786, no. 1, pp. 1-4, 2021,

I. Kwon, G. Jo, and K. S. Shin, “A deep neural network based on resnet for predicting solutions of Poisson–Boltzmann equation,” Electronics (Switzerland), vol. 10, no. 21, pp. 1–12, 2021,

H. Zhang et al., “Deep learning model for the automated detection and histopathological prediction of meningioma,” Neuroinformatics, vol. 19, no. 3, pp. 393–402, 2021,

W. Hariri, “Efficient masked face recognition method during the COVID-19 pandemic,” Signal, Image and Video Processing, vol. 16, no. 3, pp. 605–612, 2022,

S. N. Yahya, A. F. Ramli, M. N. Nordin, H. Basarudin, and M. A. Abu, “Comparison of convolutional neural network architectures for face mask detection,” International Journal of Advanced Computer Science and Applications, vol. 12, no. 12, pp. 667–677, 2021,

B. Khasoggi, Ermatita, and Samsuryadi, “Efficient mobilenet architecture as image recognition on mobile and embedded devices,” Indonesian Journal of Electrical Engineering and Computer Science, vol. 16, no. 1, pp. 389–394, 2019,

S. Habib, M. Alsanea, M. Aloraini, H. S. Al-Rawashdeh, M. Islam, and S. Khan, “An efficient and effective deep learning-based model for real-time face mask detection,” Sensors, vol. 22, no. 7, pp. 1–13, 2022,

A. K. Sharadhi, V. Gururaj, S. P. Shankar, M. S. Supriya, and N. S. Chogule, “Face mask recogniser using image processing and computer vision approach,” Global Transitions Proceedings, vol. 3, no. 1, pp. 67–73, 2022,

K. K. Bressem, L. C. Adams, C. Erxleben, B. Hamm, S. M. Niehues, and J. L. Vahldiek, “Comparing different deep learning architectures for classification of chest radiographs,” Scientific Reports, vol. 10, no. 1, pp. 1–16, 2020,

N. Hasan, Y. Bao, A. Shawon, and Y. Huang, “DenseNet convolutional neural networks application for predicting COVID-19 using CT image,” SN Computer Science, vol. 2, no. 5, pp. 1-11, 2021,

B. Batagelj, P. Peer, V. Štruc, and S. Dobrišek, “How to correctly detect face-masks for COVID-19 from visual information?,” Applied Sciences, vol. 11, no. 5, p. 2070, 2021,

A. Cabani, K. Hammoudi, H. Benhabiles, and M. Melkemi, “MaskedFace-Net – A dataset of correctly/incorrectly masked face images in the context of COVID-19,” Smart Health, vol. 19, p. 100144, 2021,

R. Senthamizh Selvi, D. Sivakumar, J. S. Sandhya, S. Siva Sowmiya, S. Ramya, and S. Kanaga Suba Raja, “Face recognition using Haar - Cascade classifier for criminal identification,” International Journal of Recent Technology and Engineering, vol. 7, no. 6, pp. 1871–1876, 2019.

X. Feng, X. Gao, and L. Luo, “A resnet50-based method for classifying surface defects in hot-rolled strip steel,” Mathematics, vol. 9, no. 19, pp. 1–15, 2021,

H. H. Hoang and H. H. Trinh, “Improvement for convolutional neural networks in image classification using long skip connection,” Applied Sciences, vol. 11, no. 5, p. 2092, 2021,

C. Ferri, J. Hernández-Orallo, and P. Flach, “Setting decision thresholds when operating conditions are uncertain,” Data Mining and Knowledge Discovery, vol. 33, no. 4, pp. 805–847, 2019,

R. E. Fan and C. J. Lin, “A study on threshold selection for multi-label classification,” Department of Computer Science, National Taiwan University, pp. 1–23, 2007, [Online]. Available:

A. Monahov, “Model evaluation with weighted threshold optimization (and the ‘mewto’ R package),” SSRN Electronic Journal, no. March, pp. 1-11, 2021,

E. Robles, F. Zaidouni, A. Mavromoustaki, and P. Refael, “Threshold optimization in multiple binary classifiers for extreme rare events using predicted positive data,” CEUR Workshop Proceedings, vol. 2600, pp. 1-12, 2020.




How to Cite

Azis, F. A., Suhaimi, H., & Abas, E. (2023). Real-Time Face Mask Classification with Convolutional Neural Network for Proper and Improper Face Mask Wearing. International Journal of Computing, 22(2), 184-190.