In this project we have built a face mask detector which helps us to predict whether a person is wearing mask or not and all that in real time via a webcam or video streams.
This project is specifically divided into two parts i.e.
- Creating our dataset and training the face mask detector model.
- Applying the trained model to work along with the webcam to give us real time predictions.
Usually what I found in the datasets available on the internet was it generally had two categories mask and without mask. Hence I decided to include another category which would increase the usability and efficiency of our face mask detector.
That being said, our dataset has 3 categories of people:
- wearing mask
- not wearing mask
- wearing mask but in an incorrect manner
Each category has close to 600-700 images. Obviously it is not possible to download or web-scrap this many images. Hence data augmentation technique has been applied on 80-100 images to increase the volume of our dataset.
Since the size of the dataset is quite big (~ 200 mb) hence I couldn't commit the dataset here but you can download it from my kaggle profile.
(P.S: If you really liked the dataset don't forget to give a thumbs up. Creating dataset is quite a task)
Here our face mask dataset is loaded and trained using keras/tensorflow.
We have fine-tuned MobileNet V2 model / architecture with pre-trained ImageNet weights.
After training the face mask detector model, it is then loaded to perform face mask detection.
Nothing in this world is perfect and so is our face mask detector. I have listed some aspects of our project which has scope of improvemet.
-
We can notice that all three categories of our dataset has people wearing basic white / blue surgical use and throw masks. While our model works perfectly fine but some times it is unable to detect / predict if any person is wearing printed / designer masks.
Hence we can experiment by adding more images in our dataset with people wearing variety of masks
-
The face mask detector was trained and the accuracy was pretty good but for some strange reasons when any person was wearing mask incorrectly, the model predicted that the person was not wearing mask at all.
I am still figuring out why that has happened but if anyone has some good modifications which can be done to improve the face mask detector please play around your way to see if you can rectify these tiny errors.