Sitemap

Face Mask Detection

4 min readMar 1, 2023

--

Predict face with or without a mask

Press enter or click to view image in full size

Table of Contents

  1. Introduction
  2. Business problem
  3. Use of ML/DL
  4. Data set column analysis
  5. Source of Data
  6. Existing Approaches
  7. Improvements to existing approaches
  8. EDA
  9. First cut approach
  10. Model Explanation
  11. future work
  12. LinkedIn
  13. Reference

Introduction

Due to the COVID-19 outbreak, Face Mask has become mandatory for everyone while roaming outside. Detection of people who are not wearing masks is a challenge due to the large population. This face mask detection project can be used in schools, hospitals, banks, airports, etc as a digitalized scanning tool.

A deep Learning model is built for Detecting a Face With and Without masks.

Business problem

The main aim of this case study is Using Deep Learning for Detecting Faces With and Without masks. Here CNN architecture Model is built and trained on color images.

Use of ML/DL

Here I am using the DL model to solve this problem. The given problem is considered a Binary class classification task where 0 means no mask is on the face and 1 means there is a face mask on the face.

Data set column analysis

The data set consists of 7553 RGB images in 2 folders as with_mask and without_mask. Images are named as labels with_mask and without_mask. Images of faces with masks are 3725 and images of faces without masks are 3828.

Source of data

Source of data obtained from Kaggle from the given link:https://www.kaggle.com/datasets/omkargurav/face-mask-dataset

Existing Approaches

Given dataset contains 2 folders as with_mask and without_mask. Using this data a Dataframe is formed containing columns masks and labels. here mask column contains all the with-mask and without-mask images, label columns are formed by images that have a mask marked as 1 and images without a mask as 0. Then after preprocessing of given images, a simple CNN model is trained and then tested with the tested data.

Improvements to existing approaches

Based on the existing approach, in the train data augmentation is included such as (sharpening, linear contrast, edge detection, embossing), dropouts, and batch normalization layer is included in the model. due to this model, AUC accuracy starts to improve.

EDA

From the distribution of the dependent variable(label), we can see that the distribution is balanced. so the given dataset is a balanced dataset.

First cut approach

Based on the data after-preprocessing of the image data, these data are used to train the CNN architecture Model built.

Model Explanation

As the given dataset contains image data, once the data are ready we split the data into train and test sets, train data is used to train the model, and the test data is to evaluate the result. Here preprocessing is done on image train data and data augmentation is done on train data and in test image data only preprocessing is done. This CNN architecture model built is trained using this train data.

Get Surabhi M V’s stories in your inbox

Join Medium for free to get updates from this writer.

This CNN model contains an input layer followed by a convolutional layer then max pooling layer then again convolutional and max-pooling layer, the output of the max-pooling layer is passed to the flattened layer, its output is passed to the dense layer, then to the dropout layer, and again to the dense and dropout layer, its output is passed to batch normalization layer, then to dense layer and then passed to final output dense layer.

the architecture of the CNN model

code for the CNN model

the result obtained after training the model

model AUC and loss graph

Press enter or click to view image in full size

Future work

Here I have worked on data obtained from the Kaggle, What we can do in the future is we can add more image data, computer vision (for object detection (here we can detect face masks)), and can use more complex CNN models which help in a much better result.

LinkedIn

Linkdein id: https://www.linkedin.com/in/surabhi-m-v-ba7256234/

References

  1. https://www.kaggle.com/datasets/omkargurav/face-mask-dataset

Thank you…

--

--