Skip to content

This project focuses on face mask detection using computer vision and deep learning techniques. It detects whether individuals are wearing face masks in real-time, helping in health and safety monitoring. Built with Python, OpenCV, and neural networks, this system can be deployed for public spaces, workplaces, and events to ensure mask compliance.

License

Notifications You must be signed in to change notification settings

Warishayat/Face-Mask-Detection

Repository files navigation

Face Mask Detection

This project implements a face mask detection system using a Convolutional Neural Network (CNN) with a pre-trained VGG16 model. The model is designed to identify whether a person is wearing a mask or not, utilizing OpenCV for real-time face detection.

Table of Contents

Installation

To set up the project, clone this repository and install the required dependencies:

git clone https://github.com/Warishayat/Face-Mask-Detection.git
cd Face-Mask-Detection
pip install -r requirements.txt

Requirements

  • Python 3.x
  • OpenCV
  • TensorFlow/Keras
  • NumPy
  • Matplotlib (optional for visualizations)

Dataset

The model is trained on a balanced dataset obtained from Kaggle, which contains images of individuals wearing masks and those without masks. Ensure the dataset is organized properly for training.

Model Training

  1. Load the VGG16 model pre-trained on ImageNet.
  2. Modify the output layers for binary classification (mask vs. no mask).
  3. Train the model for 5 epochs, achieving approximately 90% accuracy.

Training Code

The training script is located in train.py. You can adjust hyperparameters as needed.

Real-Time Detection

The project utilizes OpenCV for real-time face detection with the Haar Cascade frontal face detection model.

Detection Code

The detection script is found in detect.py. Start the detection by running:

python detect.py

Ensure your camera is connected and accessible.

Usage

  1. Clone the repository and install dependencies.
  2. Place the trained mask detection model in the correct directory.
  3. Run the training script if you wish to retrain the model.
  4. Use the detection script for real-time mask detection.

Results

The model achieved a training accuracy of 90% after 5 epochs. Real-time detection effectively identifies individuals with or without masks in live video feeds.

Contributing

Contributions are welcome! If you have suggestions for improvements or new features, feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License. See the LICENSE file for more details.


About

This project focuses on face mask detection using computer vision and deep learning techniques. It detects whether individuals are wearing face masks in real-time, helping in health and safety monitoring. Built with Python, OpenCV, and neural networks, this system can be deployed for public spaces, workplaces, and events to ensure mask compliance.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published