Skip to content

vijaykumar1799/face_mask_classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

face mask classifier

Repository information:

To access dataset: https://www.kaggle.com/vijaykumar1799/face-mask-detection.

The python project is based on classifying whether a person is wearing, not wearing, or incorrectly wear his/her mask. Dataset contains 3 folders labeled as their class names, each folder contains an equal number of distributed images (2994 images).

To begin, below is an image of some random set of images extracted from the dataset.

Note:

Images appearing in the figure below do not have any defects, simply color correction had to applied for it to be visualized properly using matplotlib. I havent done the color mapping correction due to the fact that it is being used here for display purposes and wont affect the dataset.

Figure_1

Inorder to classify whether a person is wearing, wearing incorrectly, or not wearing their mask correctly, a CNN model was built.

Briefly, dataset once loaded onto system for training, the data is split into training, validation, and testing data. where training data holds 70% of the original dataset, 20% is used for validation while training, and the remaining 10% to test the model once the model has completed training on the specified number of epochs.

Figure shown below represents how well the model performed. the figure displays 2 graphs over 150 iterations of training where the left graph represents the loss of training and validation data, in other words error. As for the graph on the right represents the accuracy of how well the model performed on the training and validation data.

Figure_2

Figure shown below represents how well the trained model has performed on the testing data.

Figure_3

Moreover to actually test whether the model has performed well or it is not overfitting, some random images from google were extracted. by applying a cascade classifier to detect faces using openCV, faces were extracted and fed to the model for a prediction whether the face belongs to a class where the person is wearing a mask, not wearing a mask, or wearing their mask incorrectly.

Note: the cascade classifier didnt detect all face in the second figure shown below, so to solve this issue MTCNN should be used since it performs much well when compared to a cascade classifier.

Figure_4

Figure_5

Figure_6

Figure_7

Overall, the trained model has performed well even when it comes to unseen data. adding to that, what can be improved is that more data should be accumulated of people wearing their masks incorrectly since there is a confusion when it comes to dealing with whether a person is wearing their mask incorrectly or not wearing. Thus improving images related to class mask_weared_incorrect should be taken into consideration.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages