This project uses CNN based Transfer Learning to classify whether a face is masked or not. It uses RESNET-18 Backend with pretrained weights, and customized final layers for Binary Classification (Masked/ Not-Masked).
- Python
- Jupyter Notebook
- Pytorch
- OpenCV
- PILLOW
- Resnet-18 (Architecture + Weights)
- Face_recognition Library
RWMFD (Real World Masked Face Dataset)
Since the dataset didn't contain accurately cropped image consisting of just the face, face_recognition library was applied on the images, to get closeup cropped images.
Some examples of closely cropped masked images
Some examples of closely cropped unmasked images
After training for 10 epochs the training loss graphs is as shown below:
The validation accuracy is about 97 % after 10 epochs.
After testing a total of around 150 images, the testing accuracy stands at 97% which can be inferred from the results shown below:
- Since the dataset was small, using a large number of images might result in better accuracy.
- Since the model is dependent on face detection, greater occlusions in face due to mask might be the reason for incorrect prediction sometimes.
- Face detection module doesn't help identify skewed faces so accurately especially when the size of face is so small.