Face Mask Wearing Detection Using Support Vector Machine (SVM)


image classification
image processing
face region extraction
confusion matrix

How to Cite

Muhammad Nur Yasir Utomo, & Fajrin Violita. (2021). Face Mask Wearing Detection Using Support Vector Machine (SVM). IJID (International Journal on Informatics for Development), 10(2), 72–81. https://doi.org/10.14421/ijid.2021.3038


As an effort to prevent the spread of the Covid-19, various countries have implemented health protocol policies such as work-from-home, social distancing, and face mask-wearing in public places. However, monitoring compliance with the policy is still difficult, especially for the face mask policy. It is still managed by humans and is costly. Thus, this research proposes a face mask-wearing detection using a soft-margin Support Vector Machine (SVM). There are three main stages: feature selection and preprocessing, model training, and evaluation. During the first stage, the dataset of 3833 images (1915 images with face masks and 1918 images without face masks) was prepared to be used in the training stage. The training stage was conducted using SVM added with the soft-margin objective to overcome images that could not be separated linearly. At the final stage, evaluation was conducted using a confusion matrix with 10 folds cross-validation. Based on the experiments, the proposed method shows a performance accuracy of 91.7%, a precision of 90.3%, recall of 93.5%, and an F-measure of 91.8%. Our method also worked fast, taking only 0.025 seconds to process a new image. It is 7.12 times faster than Deep Learning which requires 0.18 seconds for one classification.



M. Loey, G. Manogaran, M. H. N. Taha, and N. E. M. Khalifa, “Fighting Against COVID-19 - A Novel Deep Learning Model Based on YOLO-v2 with ResNet-50 for Medical Face Mask Detection,” Sustain. Cities Soc., vol. 65, pp. 1–8, 2021, doi: https://doi.org/10.1016/j.scs.2020.102600.

M. N. Y. Utomo, M. Sudaryanto, and K. Saddhono, “Tools and Strategy for Distance Learning to Respond COVID-19 Pandemic in Indonesia,” Ing. des Syst. d’Information, vol. 25, no. 3, pp. 383–390, 2020, doi: 10.18280/isi.250314.

G. Jignesh Chowdary, N. S. Punn, S. K. Sonbhadra, and S. Agarwal, “Face Mask Detection Using Transfer Learning of InceptionV3,” Lect. Notes Comput. Sci. (Artificial Intell. Bioinformatics) Springer, vol. 12581, no. 1, pp. 1–11, 2020, doi: 10.1007/978-3-030-66665-1_6.

J. Yu and W. Zhang, “Face Mask-wearing Detection Algorithm Based on Improved Yolo-v4,” Sensors, vol. 21, no. 9, pp. 1–21, 2021, doi: 10.3390/s21093263.

M. Loey, G. Manogaran, M. H. N. Taha, and N. E. M. Khalifa, “A Hybrid Deep Transfer Learning Model with Machine Learning Methods for Face Mask Detection in the Era of the COVID-19 Pandemic,” J. Int. Meas. Confed., vol. 167, 2021, doi: 10.1016/j.measurement.2020.108288.

C. Z. Basha, B. N. L. Pravallika, and E. B. Shankar, “An Efficient Face Mask Detector with Pytorch and Deep Learning,” EAI Endorsed Trans. Pervasive Heal. Technol., vol. 7, no. 25, pp. 1–8, 2021, doi: 10.4108/eai.8-1-2021.167843.

S. Yadav, “Deep Learning based Safe Social Distancing and Face Mask Detection in Public Areas for COVID-19 Safety Guidelines Adherence,” Int. J. Res. Appl. Sci. Eng. Technol., vol. 8, no. 7, pp. 1368–1375, 2020, doi: 10.22214/ijraset.2020.30560.

S. V. Militante and N. V. Dionisio, “Real-Time Facemask Recognition with Alarm System using Deep Learning,” IEEE Control Syst. Grad. Res. Colloq., pp. 106–110, 2020, doi: 10.1109/ICSGRC49013.2020.9232610.

M. R. Bhuiyan, S. A. Khushbu, and M. S. Islam, “A Deep Learning Based Assistive System to Classify COVID-19 Face Mask for Human Safety with YOLOv3,” 2020 11th Int. Conf. Comput. Commun. Netw. Technol. ICCCNT 2020, pp. 1–5, 2020, doi: 10.1109/ICCCNT49239.2020.9225384.

B. Xu, A. Shirani, D. Lo, and M. Amin Alipour, “Prediction of Relatedness in Stack Overflow: Deep Learning vs. SVM,” Proc. 12th ACM/IEEE Int. Symp. Empir. Softw. Eng. Meas., pp. 1–10, 2018, doi: https://doi.org/10.1145/3239235.3240503.

S. Y. Chaganti, I. Nanda, K. R. Pandi, T. G. N. R. S. N. Prudhvith, and N. Kumar, “Image Classification using SVM and CNN,” 2020 Int. Conf. Comput. Sci. Eng. Appl., pp. 1–5, 2020, doi: https://doi.org/10.1109/ICCSEA49143.2020.9132851.

M. A. I. Mahmoud and H. Ren, “Forest Fire Detection and Identification using Image Processing and SVM,” J. Inf. Process. Syst., vol. 15, no. 1, pp. 159–168, 2019, doi: 10.3745/JIPS.01.0038.

H. I. Dino and M. B. Abdulrazzaq, “Facial Expression Classification Based on SVM, KNN and MLP Classifiers,” 2019 Int. Conf. Adv. Sci. Eng. ICOASE 2019, pp. 70–75, 2019, doi: 10.1109/ICOASE.2019.8723728.

L. Hu and J. Cui, “Digital Image Recognition Based on Fractional-order-PCA-SVM Coupling Algorithm,” J. Int. Meas. Confed., vol. 145, no. February, pp. 150–159, 2019, doi: 10.1016/j.measurement.2019.02.006.

Y. Guo, X. Jia, and D. Paull, “Effective Sequential Classifier Training for SVM-Based Multitemporal Remote Sensing Image Classification,” IEEE Trans. Image Process., vol. 27, no. 6, pp. 3036–3048, 2018, doi: 10.1109/TIP.2018.2808767.

Y. Kortli, M. Jridi, A. Al Falou, and M. Atri, “A Novel Face Detection Approach using Local Binary Pattern Histogram and Support Vector Machine,” 2018 Int. Conf. Adv. Syst. Electr. Technol. ICASET 2018, pp. 28–33, 2018, doi: 10.1109/ASET.2018.8379829.

W. Shu and K. Cai, “A SVM Multi-Class Image Classification Method Based on de and KNN in Smart City Management,” IEEE Access, vol. 7, pp. 132775–132785, 2019, doi: 10.1109/ACCESS.2019.2941321.

M. L. Dantas Dias and A. R. Rocha Neto, “Training Soft Margin Support Vector Machines by Simulated Annealing: A Dual Approach,” Expert Syst. Appl., vol. 87, pp. 157–169, 2017, doi: 10.1016/j.eswa.2017.06.016.

J. F. Tuttle, L. D. Blackburn, and K. M. Powell, “On-line Classification of Coal Combustion Quality using Nonlinear SVM for Improved Neural Network NOx Emission Rate Prediction,” Comput. Chem. Eng., vol. 141, p. 106990, 2020, doi: 10.1016/j.compchemeng.2020.106990.

W. Xiong, J. Xu, Z. Xiong, J. Wang, and M. Liu, “Degraded Historical Document Image Binarization using Local Features and Support Vector Machine (SVM),” Opt. - Int. J. Light Electron Opt., vol. 164, pp. 218–223, 2018, doi: 10.1016/j.ijleo.2018.02.072.

H. Adusumalli, D. Kalyani, R. K. Sri, M. Pratapteja, and P. V. R. D. P. Rao, “Face Mask Detection Using OpenCV,” Proc. 3rd Int. Conf. Intell. Commun. Technol. Virtual Mob. Networks, ICICV 2021, pp. 1304–1309, 2021, doi: 10.1109/ICICV50876.2021.9388375.

Z. Arya and V. Tiwari, “Automatic Face Recognition and Detection Using OpenCV, Haar Cascade and Recognizer for Frontal Face,” Int. J. Eng. Res. Appl. www.ijera.com, vol. 10, no. 6, pp. 13–19, 2020, doi: 10.9790/9622-1006051319.

N. Prasad, B. Rajpal, K. K. Rao Mangalore, R. Shastri, and N. Pradeep, “Frontal and Non-Frontal Face Detection using Deep Neural Networks (DNN),” Int. J. Res. Ind. Eng., vol. 10, no. 1, pp. 9–21, 2021.

S. Balaji, B. Balamurugan, T. A. Kumar, R. Rajmohan, and P. P. Kumar, “A Brief Survey on AI Based Face Mask Detection System for Public Places,” Irish Interdiscip. J. Sci. Res. 2021, vol. 5, no. 1, pp. 108–117, 2021.

S. Zimmerman, C. Fox, and U. Kruschwitz, “Improving Hate Speech Detection with Deep Learning Ensembles,” Lr. 2018 - 11th Int. Conf. Lang. Resour. Eval., pp. 2546–2553, 2019.

S. Abu Jwade, A. Guzzomi, and A. Mian, “On Farm Automatic Sheep Breed Classification using Deep Learning,” Comput. Electron. Agric., vol. 167, p. 105055, 2019, doi: 10.1016/j.compag.2019.105055.

Creative Commons License

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.