Face Mask Detectior system built with OpenCV, Keras/TensorFlow using Deep Learning and Computer Vision concepts in order to detect face masks in static images as well as in real-time video streams.
Our face mask detector didn't use any morphed masked images dataset. The model is accurate, and since we used the MobileNetV2 architecture, it’s also computationally efficient and thus making it easier to deploy the model to embedded systems (Raspberry Pi, Google Coral, etc.).
This system can therefore be used in real-time applications which require face-mask detection for safety purposes due to the outbreak of Covid-19. This project can be integrated with embedded systems for application in airports, railway stations, offices, schools, and public places to ensure that public safety guidelines are followed.
The dataset used can be downloaded here - Click to Download
This dataset consists of 4095 images belonging to two classes:
- with_mask: 2165 images
- without_mask: 1930 images
The images used were real images of faces wearing masks. The images were collected from the following sources:
- Bing Search API (See Python script)
- Kaggle datasets
- RMFD dataset (See here)
All the dependencies and required libraries are included in the file projectDependenciesPlain.txt See here
- Clone the repo
$ git clone https://github.com/Tavneetsingh01/face-mask-detector.git
- Change your directory to the cloned repo
$ cd Face-Mask-Detection
- Create a Python virtual environment named 'test' and activate it
$ virtualenv test
$ source test/bin/activate
- Now, run the following command in your Terminal/Command Prompt to install the libraries required
$ pip3 install -r projectDependenciesPlain.txt
- Open terminal. Go into the cloned project directory and type the following command:
$ python3 train_mask_detector.py --dataset dataset
- To detect face masks in an image type the following command:
$ python3 detect_mask_image.py --image images/pic1.jpeg
- To detect face masks in real-time video streams type the following command:
$ python3 detect_mask_video.py
Face Mask Detector webapp using Tensorflow & Streamlit
command
$ streamlit run app.py
Feel free to file a new issue with a respective title and description on the the Face-Mask-Detection repository. If you already found a solution to your problem, I would love to review your pull request!
MIT © Tavneet Singh