Skip to content

Real-time face mask detection with opencv, keras/tensorflow

Notifications You must be signed in to change notification settings

bertuginal/Face-Mask-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Face Mask Detection

Face Mask Detection 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.

                                                                       Python Forks Stargazers


⭐ Features

This system can be used in real-time applications that require face mask detection for security purposes due to the increase in the Covid-19 outbreak. This project can be integrated with embedded systems for application in airports, train stations, offices, schools and public places to ensure compliance with public safety guidelines.

📁 Dataset

The dataset used can be downloaded here - Click to Download

This dataset consists of 5106 images belonging to two classes:

  • with_mask: 3158 images
  • without_mask: 1948 images

The images used were real images of faces wearing masks. The images were collected from the following sources:

  • Kaggle datasets
  • Various videos
  • Udemy tutorials

⚠️ Libraries used

⚠️ Haar-cascade used

It is a method applied to find objects on the image. This method is called haar-like features. I used the "haarcascade_frontalface_default.xml" file in this project.

You can download all the haarcascade xml files you need from here.

🚀  Installation

  1. Clone the repo
$ git clone https://github.com/bertuginal/Face-Mask-Detection.git
  1. Now, run the following command in your Terminal/Command Prompt to install the libraries required
$ pip3 install -r requirements.txt

💡 Working

  1. Open terminal. Type the following command to train the model:
$ python3 Train.py --dataset data
  1. To detect face masks in real-time video streams type the following command:
$ python3 Test.py 

🔑 Results

My model gave 98% accuracy for Face Mask Detection after training via tensorflow-gpu==2.5.0


I got the following accuracy/loss training curve plot.

👇 Images

FRAME: With Mask

I got 98.85% accuracy when wearing a face mask.



FRAME: Without Mask

I got 99.77% accuracy when we were not wearing a face mask.



FRAME: Half With Mask

I got 53.06% accuracy when the face mask is worn under the mouth.


👏 And it's done!

Feel free to mail me for any doubts/query 📧 [email protected]

If you like my project, can you click the star to support me?

About

Real-time face mask detection with opencv, keras/tensorflow

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages