A real-time face mask detection project using TensorFlow and OpenCV, which utilizes a pre-trained MobileNetV2 model to identify faces and determine whether a person is wearing a mask or not. This project is designed to help in enforcing safety measures during the COVID-19 pandemic.
The Real-Time Face Mask Detection project is a practical application of computer vision and deep learning. It combines face detection and mask classification to determine whether individuals are wearing masks properly. This can be utilized in various settings, including airports, healthcare facilities, and public spaces.
-
Face Detection: The project employs a pre-trained deep learning model (SSD-based) to detect faces within a video stream. This enables accurate face tracking even in crowded or dynamic environments.
-
Mask Classification: A pre-trained MobileNetV2 model is used to classify faces into two categories: "With Mask" and "Without Mask." This classification helps in identifying individuals who are not following mask-wearing guidelines.
-
Real-Time Processing: The system operates in real-time, making it suitable for monitoring purposes where immediate action is required.
- Real-time face mask detection with a webcam or video source.
- Accurate face detection and tracking using a pre-trained SSD-based model.
- Classification of individuals into "With Mask" or "Without Mask" categories.
- Visual annotations on the video stream to highlight mask-wearing status.
-
Clone the repository:
git clone https://github.com/Yomna-moustafa/real-time-mask-detection.git
-
Install the required Python packages
-
Download the pre-trained MobileNetV2 model weights (face_mask_detection.model) and place it in the project directory.
-
Download the face detection model files (deploy.prototxt and res10_300x300_ssd_iter_140000.caffemodel) and place them in the face_detector directory.
To use this project for real-time face mask detection with your webcam, follow these steps:
-
Run the following command to start real-time face mask detection using your webcam:
python face_mask_detection.py
-
The application will open a window displaying the webcam feed.
-
It will analyze each frame, detect faces, and classify them based on mask-wearing status.
-
Detected faces will be annotated with text and bounding boxes indicating whether they are wearing masks or not.
-
Press 's' to stop the video stream and close the window.
This project was created as a learning exercise and is inspired by various tutorials and resources available online.
.png)
