detectfacemask is a MobileNetV2-based machine learning model that aims to automatically detect faces in an image or live feed, and determine if the faces are wearing mask.
- MobileNetV2 architecture
- MobileNetV2 is an effective out-of-the-box feature extractor for object detection and segmentation.
- Tensorflow and Keras
- TensorFlow is an open source library for numerical computation and large-scale machine learning. Keras is a neural networks library written in Python that works as a wrapper for TensorFlow.
- BerkleyVision Caffe
- Caffe is a deep learning framework made with expression, speed, and modularity.
- OpenCV
- OpenCV is a library of programming functions mainly aimed at real-time computer vision.
Faces in image files are automatically detected, and an estimation of presence or absence of face mask is given. Press ESC
to close the window.
On the project folder, run the following command on the terminal:
python dfm-i.py --image <image file>
or
python dfm-i.py -i <image file>
Example:
python dfm-i.py --image test/subject1.jpg
Live feed through webcam will be enabled. A window will be launched that will show the webcam feed. Faces in the said feed are automatically detected, and an estimation of presence or absence of face mask is given. Press ESC
to close the window.
On the project folder, run the following command on the terminal:
python dfm-c.py
Clone the repository
$ git clone https://github.com/gmlunesa/detectfacemask.git
Change the directory to the cloned repo folder and create a new Python virtual environment
$ mkvirtualenv env-test
Run command to install required libraries
$ pip3 install -r requirements.txt
Please open 01. Data Preprocessing.ipynb
and 02. Training ML Model.ipnyb
for detailed explanations and code of the training process. This requires Jupyter Notebook.
Real World Masked Face Dataset (RMFD) by Baojin Huang Arxiv
For any questions or clarifications, please see my contact details at https://gmlunesa.com/contact.
For issues, please file them here.