Skip to content

FYT3RP4TIL/Face-Mask-Detection

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.

Introduction

Due to the seen pandemic Covid-19 in the past years we got to know how wearing masks beccame important hence this system can therefore be used in real-time applications which require face-mask detection for safety purposes due to the outbreak . 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.

⚠️ TechStack

📁 Dataset

The dataset used can be downloaded here - Click to Download

This dataset consists of ~12k images belonging to three classes:

  • Train
  • Test
  • Validation

🔑 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/Sudhanshu21xx/Face-Mask-Detection.git
  1. Open the repo in notebook

  2. Now, run the following command in your notebook to install the libraries required

$ pip3 install -r requirements.txt

💡 Working

  1. Download the dataset.

  2. Change the directory main_dir in the Facemask_model.ipynb and run it:

import os
main_dir ='New Masks Dataset'
train_dir = os.path.join(main_dir,'Train')
test_dir = os.path.join(main_dir,'Test')
valid_dir = os.path.join(main_dir,'Validation')

train_mask_dir = os.path.join(train_dir,'Mask')
train_nomask_dir = os.path.join(train_dir,'Non Mask')
  1. Run the Facemaskdetection(open_cv).ipynb (you can also change the videocapture to livecapture)
cap = cv2.VideoCapture('video.mp4')
#cap = cv2.VideoCapture(0)

🔑 Results