The aim of this project is to detect whether a person is wearing a face mask or not by capturing input from the camera and testing it on a Face Mask detection Model. If our model detects a face without a mask, it will capture the image and store it in a database for record. After doing all this, if time permits, then the next improvement will be identifying the defaulters by using the data stored previously.
- python installed
- anaconda ide or a virtual env with python and other dependencies.
- mySQL
- OpenCV , MySQL Connector, NumPy , keras and tensorflow python libraries.
- Haarcascade frontal_face.xml file
- CPU or a GPU(fast compute preferred).
- large dataset for training
sample.mp4
- here we will load the data from our dataset to organise and convert them into a format which can be given as an input to our CNN
- tf.keras.applications.vgg16.preprocess_input is used to preprocess our data to send into our VGG16 model
- i used 12K dataset from kaggle and trained my model on 10000 images
- val_accuracy: 0.9975
Check for the accuracy using a confusion matrix and plotting it using matplotlib’s pilot module.
- we can move on to loading the image into our model and classifying a face as with or without mask and store the labels
- the image of a person without a mask is captured and saved in our local directory. After regular intervals we send that data from the local directory to our MySQL database by running our python script sql.py.
- The name of our table is pic
- It stores 3 parameters (the id of defaulter, name if known, the image captured).