Constructing a Software Tool for Detecting Face Mask-wearing by Machine Learning

Main Article Content

Ashraf Abdulmunim Abdulmajeed
Tawfeeq Mokdad Tawfeeq
Marwa Adeeb Al-jawaherry


       In the pandemic era of COVID19, software engineering and artificial intelligence tools played a major role in monitoring, managing, and predicting the spread of the virus. According to reports released by the World Health Organization, all attempts to prevent any form of infection are highly recommended among people. One side of avoiding infection is requiring people to wear face masks. The problem is that some people do not incline to wear a face mask, and guiding them manually by police is not easy especially in a large or public area to avoid this infection. The purpose of this paper is to construct a software tool called Face Mask Detection (FMD) to detect any face that does not wear a mask in a specific public area by using CCTV (closed-circuit television). The problem also occurs in case the software tool is inaccurate. The technique of this notion is to use large data of face images, some faces are wearing masks, and others are not wearing masks. The methodology is by using machine learning, which is characterized by a HOG (histogram orientation gradient) for extraction of features, then an SVM(support vector machine) for classification, as it can contribute to the literature and enhance mask detection accuracy. Several public datasets for masked and unmasked face images have been used in the experiments. The findings for accuracy are as follows: 97.00%, 100.0%, 97.50%, 95.0% for RWMFD (Real-world Masked Face Dataset)& GENK14k, SMFDB (Simulated Masked Face Recognition Dataset), MFRD (Masked Face Recognition Dataset), and MAFA (MAsked FAces)& GENK14k for databases, respectively. The results are promising as a comparison of this work has been made with the state-of-the-art. The workstation of this research used a webcam programmed by Matlab for real-time testing.


Download data is not yet available.

Article Details

How to Cite
Abdulmajeed AA, Tawfeeq TM, Al-jawaherry MA. Constructing a Software Tool for Detecting Face Mask-wearing by Machine Learning . Baghdad Sci.J [Internet]. 2022Jun.1 [cited 2022Jun.26];19(3):0642. Available from:


Guan W-j, Ni Z-y, Hu Y, Liang W-h, Ou C-q, He J-x, et al. Clinical characteristics of coronavirus disease 2019 in China. New Engl. J med (NEJM). 2020;382(18):1708-20.

Sohrabi C, Alsafi Z, O’Neill N, Khan M, Kerwan A, Al-Jabir A, et al. World Health Organization declares global emergency: A review of the 2019 novel coronavirus (COVID-19). International Journal of Surgery. 2020.

Liu X, Zhang S. COVID‐19: Face masks and human‐to‐human transmission. Influenza and Other Respiratory Viruses. 2020.

Cheng VC, Wong S-C, Chuang VW, So SY, Chen JH, Sridhar S, et al. The role of community-wide wearing of face mask for control of coronavirus disease 2019 (COVID-19) epidemic due to SARS-CoV-2. J. Infect. 2020.

Eikenberry SE, Mancuso M, Iboi E, Phan T, Eikenberry K, Kuang Y, et al. To mask or not to mask: Modeling the potential for face mask use by the general public to curtail the COVID-19 pandemic. Infectious Disease Modelling. 2020.

Feng S, Shen C, Xia N, Song W, Fan M, Cowling BJ. Rational use of face masks in the COVID-19 pandemic. The Lancet Respiratory Medicine. 2020;8(5):434-6.

Liakos KG, Busato P, Moshou D, Pearson S, Bochtis D. Machine learning in agriculture: A review. Sensors. 2018;18(8):2674.

Abbas NH, Yasen KN, Faraj K, Razak LFA, Malallah FL. Offline Handwritten Signature Recognition using Histogram Orientation Gradient and Support Vector Machine. J. Theor. Appl. Info. Technol. 2018;96(8):2075-84.

Malallah FL, Al-Jubouri AA, Sabaawi AM, Shareef BT, Saeed MG, Yasen KN. Smiling and Non-smiling Emotion Recognition Based on Lower-half Face using Deep-Learning as Convolutional Neural Network. IMDC-SDSP (Proceedings of the 1st International Multi-Disciplinary Conference Theme: Sustainable Development and Smart Planning); Virtually: EAI; 2020-09-03.

Ge S, Li J, Ye Q, Luo Z, editors. Detecting masked faces in the wild with lle-cnns. Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition; 2017.

Chowdary GJ, Punn NS, Sonbhadra SK, Agarwal S. Face Mask Detection using Transfer Learning of InceptionV3. arXiv preprint arXiv:200908369. 2020.

Loey M, Manogaran G, Taha MHN, Khalifa NEM. A hybrid deep transfer learning model with machine learning methods for face mask detection in the era of the COVID-19 pandemic. Measur. 2020;167:108288.

Jiang M, Fan X. RetinaMask: a face mask detector. arXiv preprint arXiv:200503950. 2020.

Chowdary GJ, Punn NS, Sonbhadra SK, Agarwal S, editors. Face mask detection using transfer learning of inceptionv3. International Conference on Big Data Analytics; 2020: Springer.

Wang Z, Wang G, Huang B, Xiong Z, Hong Q, Wu H, et al. Masked face recognition dataset and application. arXiv preprint arXiv:200309093. 2020.

Jones M, Viola P. Fast multi-view face detection. Mitsubishi Elect. Res. Lab TR-20003-96. 2003;3(14):2.

Church JC, Chen Y, Rice SV, editors. A spatial median filter for noise removal in digital images. IEEE SoutheastCon 2008; 2008: IEEE.

Dalal N, Triggs B, editors. Histograms of oriented gradients for human detection. 2005 IEEE computer society conference on computer vision and pattern recognition (CVPR'05); 2005: IEEE.

Cristianini N, Shawe-Taylor J. An introduction to support vector machines and other kernel-based learning methods: Cambridge university press; 2000.

Fan R-E, Chen P-H, Lin C-J. Working set selection using second order information for training support vector machines. J. mach. learn res. 2005;6(Dec):1889-918.

Kecman V, Huang T-M, Vogt M. Iterative single data algorithm for training kernel machines from huge data sets: Theory and performance. Support vector machines: Theory and Applications: Springer; 2005. p. 255-74.

Sokolova M, Lapalme G. A systematic analysis of performance measures for classification tasks. Information processing & management. 2009;45(4):427-37.

Visa S, Ramsay B, Ralescu AL, Van Der Knaap E. Confusion matrix-based feature selection. MAICS. 2011;710:120-7., 2020-10-10. A. The mplab genki-4k database. Real-World-Masked-Face-Dataset. accessed in 2020-10-9. SMFD. Accessed in 2020-7-10. Masked Face Recognition DataSet. Accessed in 2020-10-2. MAFA Dataset. Accessed in 2020-8-7.

Malallah FL, Ahmad SMS, Adnan WAW, Arigbabu OA, Iranmanesh V, Yussof S. Online handwritten signature recognition by length normalization using up-sampling and down-sampling. International Journal of Cyber-Security and Digital Forensics (IJCSDF). 2015;4(1):302-13.