- For local image face mask detection, use detect_mask_from_image.py
- For local video streaming face mask detection, use detect_mask_from_video.py
- The website for above two functions was built using Flask framework
- For local standalone test, run 'python app.py'
- For deployment on Heroku, change the filename under .github/workflows to main.yaml and replace the "email, heroku_api_key, heroku_app_name" to one's own. A docker image will be automatically regenerated every time a commit happens and pushed to Heroku.
- Using pretrained SSD to detect faces
- Once faces are detected, feed into mobilenet-v2 finetuned for classification of "face with mask" vs "face without mask"
- Dataset from https://www.kaggle.com/datasets/omkargurav/face-mask-dataset, contains folder of two categories (with_mask, without_mask), around 7000 images
- Besides data augmentation using ImageDataGenerator, in the folder called Data_Generator, augmentation method of using opencv to add masks to unmasked faces in the picture was performed and added to the "with mask" dataset
- mask_detector.model is stage 2 mask classfication model finetuned based on mobilenet-v2
- plot.png is the model training loss and accuracy history
- demoimage_XXX are demo images inferenced by the model with faces with/without masks highlighted with bounding box and confidence
- demovideo.mp4 are demo for video streaming using local computer's camera
- examples folder contains demo images for image face mask detection
- face_detector folder contains pretrained SSD model for face detection and its weights
- In Data_Generator/images/masks, there are the masks used for augmenting the with_mask datasets
- In Data_Generator/Downloads/add_mask, there are the augumented with_mask faces using masks, they are then added to the dataset/with_mask folder
pip install -r requirements.txt