michael-zhu-sh / Face-Mask-Detection

Face Mask Detection system based on computer vision and deep learning using OpenCV and Tensorflow/Keras

Home Page:https://www.youtube.com/watch?v=AAkNyZlUae0

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Face Mask Detection



About SCI

Student Code-in is a global program that helps students grow with “OPEN SOURCE”. It is a 2 months long Open-Source initiative which provides you the best platform to improve your skills and abilities by contributing to vast variety of OPEN SOURCE Projects. In this,all the registered participants would get an exquisite opportunity to interact with the mentors and the Organizing Team.

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 contributions welcome Forks Stargazers Issues MIT License LinkedIn

                                    Live Demo

😇 Motivation

In the present scenario due to Covid-19, there is no efficient face mask detection applications which are now in high demand for transportation means, densely populated areas, residential districts, large-scale manufacturers and other enterprises to ensure safety. Also, the absence of large datasets of ‘with_mask’ images has made this task more cumbersome and challenging.

Project Demo

🎥 YouTube Demo Link

💻 Dev Link

⚠️ Tech/framework used


Our face mask detector didn't uses 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.

📁 Dataset

The dataset used can be downloaded here - Click to Download

This dataset consists of 3835 images belonging to two classes:

  • with_mask: 1916 images
  • without_mask: 1919 images

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

🔑 Prerequisites

All the dependencies and required libraries are included in the file requirements.txt See here

🚀  Installation

  1. Clone the repo
$ git clone https://github.com/chandrikadeb7/Face-Mask-Detection.git
  1. Change your directory to the cloned repo and create a Python virtual environment named 'test'
$ mkvirtualenv test
  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. Go into the cloned project directory folder and type the following command:
$ python3 train_mask_detector.py --dataset dataset
  1. Now detect the face masks in images
$ python3 detect_mask_image.py --image images/pic1.jpeg
  1. Detection in real-time video streams
$ python3 detect_mask_video.py 

🔑 Results

Our model gave 93% accuracy for Face Mask Detection after training via tensorflow-gpu==2.0.0

We got the following accuracy/loss training curve plot

👏 And it's done!

Feel free to mail me for any doubts/query 📧 chandrikadeb7@gmail.com

🤝 Contribution

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!

❤️ Owner

Made with ❤️  by Chandrika Deb

👍 Credits

👀 License

MIT © Chandrika Deb

ezoic increase your site revenue


Face Mask Detection system based on computer vision and deep learning using OpenCV and Tensorflow/Keras


License:MIT License


Language:Python 100.0%