This repository contains a Python3 script that recognizes whether or not a face is wearing a mask!
The code uses the OpenCV library for image processing and scikit-learn for training the model that classifies a face that bears a mask or not.
More about the code
In open_cam.py we have a script that allows your computer's webcam to start.
In this script we load a dataframe from the set of images we have and train a K-Nearest Neighbor model to classify faces.
For generic face recognition, CascadeClassifier is used, which is already included in the OpenCV library. In general, this training method uses an .xml file, which is also already included in the package, to train a model that recognizes faces in a generic way, using the Viola-Jones and AdaBoost method to improve performance.
The Machine Learning algorithm chosen for classification was the K-Nearest Neighbor, as it was the one that presented the best performance before the test and validation set. The idea is that, in a next experiment, that same code can be redone using a CNN!