dipesg / Face-Mask-Detector

Face Mask Detector that detect whether a person is wearing a mask or not.:mask:

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Face-Mask Detection 😷

LinkedIn

Arcitechture

Model Training Overview

πŸ‘©β€πŸ’» Introduction

In the COVID-19 crisis wearing masks is absolutely necessary for public health and in terms of controlling the spread of the pandemic. This project's aim is to develop a system that could detect masked and unmasked faces in images and real-time video. This can, for example, be used to alert people that do not wear a mask when using the public transport, airports or in a theatre.

πŸ™‹ Project Workflow

Our pipeline consists of three steps:

  1. An AI model which detect all human faces in an image.
  2. An AI model which predict if that face wears mask/no_mask.
  3. The output is an annotated image with the prediction.

πŸš€ Model's performance

The face-mask model is trained with 900 images but in order to increase their volume it was used data augmentation and the weights of the MobileNetV2 model. More about this architecture can be found here.

The facemask model has an accuracy of 99%.

plot

⭐ Streamlit app

Face Mask Detector with video using Tensorflow & Streamlit Webrtc

command First clone the repository.

git clone https://github.com/dipesg/Face-Mask-Detector.git

Create new conda environment.

conda create -n venv python=3.8 -y

Install Necessary Requirements for the project.

pip install -r requirements.txt

Run following command to run the app.

streamlit run main.py 

IMAGES

⚠️ Technology Stack

  • OpenCV
  • Caffe-based face detector
  • Keras
  • TensorFlow
  • MobileNetV2
  • Streamlit & Streamlit Webrtc

πŸ“‚ Folder Structure


|   LICENSE
|   main.py
|   Procfile
|   README.md
|   requirements.txt
|   Resultant.txt
|   runtime.txt
|   setup.sh
|   
+---face_detector
|       deploy.prototxt
|       haarcascade_frontalface_default.xml
|       res10_300x300_ssd_iter_140000.caffemodel
|       
+---logs
|       Detect_and_predict_mask.log
|       Detect_and_predict_mask.logs
|       Detect_from_video.log
|       Detect_from_video.logs
|       info.logs
|       prediction.logs
|       preprocessing.logs
|       train.logs
|       
+---mask_detector
|   |   keras_metadata.pb
|   |   mask_detector.model
|   |   saved_model.pb
|   |   
|   \---variables
|           variables.data-00000-of-00001
|           variables.index
|           
+---plot
|       plot.png
|       
\---src
        detect_and_predict_mask.py
        detect_from_video.py
        logger.py
        prediction.py
        preprocessing.py
        train_mask.py
        __init__.py

πŸ‘€ Next Steps

  • Upload the streamlit ad-hoc app to Amazon Web Services.
  • Keep improving the performance of face and face-mask AI model.
  • Keep improving the detection of faces with low light and low quality pictures/webcams.

πŸ“« Contact info

For questions, suggestions and other inquiries... ping me here.

About

Face Mask Detector that detect whether a person is wearing a mask or not.:mask:

License:MIT License


Languages

Language:PureBasic 94.8%Language:Python 5.2%Language:Shell 0.0%Language:Procfile 0.0%