Inspiration

Opposition to mask-wearing is not a new thing. During the 1918 Spanish Flu pandemic, many anti-maskers form a group to protest the enforcement of wearing masks. Since the start of the COVID-19 pandemic, we saw a rise of negligence and refusal of mask wearing by a small handful of American people. I came up with this idea after seeing news articles and videos of anti-maskers being getting caught at public indoor events.

What it does

This python application identifies separates individuals into 2 groups: individuals wearing masks and individuals who are not. With an accuracy of 98%, this application correctly identifies people in pictures and video frames not wearing masks most of the time.

How we built it

Having watched several machine learning project design videos and researched different python data science libraries I might find useful for this project, I was able to plan out the necessary steps for this project: load and preprocess MaskedFace-Net image dataset (TensorFlow), one-hot encode and split data (Sci-kit learn), fine-tune the Resnet50 CNN model, train classifier model (TensorFlow, Keras), and plot the accuracy curves (MatplotLib). With the trained model complete, I then used OpenCV to identify face ROIs from images and extract a blob to be passed through the model. After that, I looped through the detections and out the confidence level of the image being with or without mask.

Challenges we ran into

My first attempts were to train my model via Google Collab since my computer doesn’t have a GPU, but it took an extremely long time and resulted in several unsuccessful tests and crashes. Hence, I resorted to training on my personal computer (despite it taking a long time and causing my laptop to overheat, I was able to get a working model after two or three attempts.

Accomplishments that we're proud of

This is the first big ML python project that I built after spending many hours learning about different python libraries. I am quite proud that I was able to put together the stuff I learned during this hackathon and build a working model of a mask detector for images.

What we learned

I learned to utilize different library features of TensorFlow, Keras and OpenCV. Some other skills I learned during this project were the uses of One-hot encoding.

What's next for Masks.For.All

I am hoping to delve deeper into OpenCV documentation and discover more advanced feature extraction strategies that could be useful for this and my other projects. Some ways I hope to further this project are to identify individuals who are not wearing masks properly.

Built With

Share this project:

Updates