A Face Mask detector is a python project developed with some Machine Learning libraries.
Given the trained COVID-19 face mask detector, weβll proceed to implement two more additional Python scripts used to:
- Detect COVID-19 face masks in images
- Detect face masks in real-time video streams
This repository contains code and resources for a face mask detection system. This system is built using deep learning techniques and is capable of detecting whether a person is wearing a face marsk or not in real-time.
The Face Mask Detector is a computer vision system that can identify whether a person is wearing a facemask or not. It utilizes deep learning techniques to process images and make predictions in real-time. The system can be useful in various applications such as public safety, healthcare, and security.
This repository provides the code and resources necessary to train and deploy the facemask detection system.
The dataset/
directory contains the data described in the βOur COVID-19 face mask detection datasetβ section. Three image examples/
are provided so that you can test the static image face mask detector.
Three python scripts are:
train_mask_detector.py
: Accepts our input dataset and fine-tunes MobileNetV2 upon it to create ourmask_detector.model
. A training historyplot.png
containing accuracy/loss curves is also produceddetect_mask_image.py
: Performs face mask detection in static imagesdetect_mask_video.py
: Using your webcam, this script applies face mask detection to every frame in the stream
- Real-time face mask detection
- High accurace and performance
- Easy to use and integrate into existing systems
- Supports both image and video input
To run the face mask detector, you need to have the following dependencies installed:
- Clone this repository:
git clone https://github.com/Ruban2205/Face-Mask-Detector.git
- Change into the project directory:
cd Face-Mask-Detector
- Install the required dependencies:
pip install -r requirements.txt
To use the face mask detector, Follow these steps:
- Run the detection script:
python detect_mask.py
This will start the face mask detection system using your webcam as the input source.
-
The system will display the live video feed with bounding boxes around detected faces. It will also label each face as "With Mask" or "Without Mask" based on the prediction.
-
Press 'q' to quit the system.
If you want to tran the face mask detection model on your own dataset, you can follow these steps:
-
Prepare your dataset with two classes: "With Mask" and "Without Mask". The dataset should be organized into separate directories for each class.
-
Update the
config.py
file to specify the paths to your dataset and other configuration settings. -
Run the training script:
python train_mask_detector.py
This will train the face mask detection model using the specified dataset and save the trained model to the disk. -
Once training is complete, you can use the trained model for face mask detection by running the
detect_mask.py
script.
The dataset used to train the face mask detection model is not included in this repository. You can use your own dataset or find suitable datasets from public sources. Ensure that your dataset contains a sufficient nuber of images for both "With Mask" and "Without Mask" classes to achieve good performance.
The face mask detection model is based on a deep neural network architecture. It is trained using the TensorFlow and Keras frameworks. The model takes an input image and predicts whether the person in the image is wearing a face mask or not.
The face mask detection system achieves high accuracy on the test dataset. The performance may vary depending on the quality and diversity of the training dataset. It is recommended to train the model on the large and representative dataset for optimal results.
Contributions to the Face Mask Detetor project are welcome and encouraged. If you want to contribute, please follow these steps:
- Fork the repository and create your own branch.
- Make the desired changes and additions.
- Test your changes thoroughly.
- Submit a pull request describing the changes you made.
Please ensure that your contributions align with the project's codeing standards, maintain code quality, and provide clear documentation when necessary.
The Face Mask Detector project is licensed under the MIT License. You are free to use, modify, and distribute the code for personal and commerical purposes. See the LICENSE file for more details.
If you have any questions, suggestions, or concerns about the Face Mask Detector project, please feel free to reach out to me.
You can Contact me at:
- Email: [email protected]
- GitHub Issues: https://github.com/Ruban2205/Face-Mask-Detector/issues
I appreciate your feedback and contributions!
Click below to gift π a book to me.
Thank You!!