Detect mask v/s no-mask on faces in an image using a combination of a openCV based face detector DNN and a trained keras model for mask detection. Model and Google Colab ipynb included.
- Upload mask_detector.zip file to google colab;
- Upload ipynb to Google Colab or "open in colab" using the Colab Chrome plugin
- The code outputs a "result.png" file with the detected faces and a green / red mask based on whether a mask is detected.
Trained models for this example come from Bayangmbe Moumno based on a dataset of simulated masked-face images created using an innovative OpenCV pipeline based on face landmark detection, by Prajna Bhandary. This dataset consists of 1,376 images belonging to two classes:
- with_mask: 690 images
- without_mask: 686 images
Read more about how to train your own model and work the face-landmark based mask simulator on Adrian Rosebrock's blog post.