Skip to content

gaikwadabhishek/Real-Time-Face-Mask-Detection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Face-Mask-Detection-Using-SSD-and-CNN

Detecting facemasks using SSD and CNN

Abstract

In this project, a face mask detection model is proposed that can classify people not wearing masks in a live video feed. The system can be deployed in a network of surveillance cameras and predictions from the model can be used to notify concerned authorities in case of mask mandate violation. The model implements a deep learning architecture that has been trained on a dataset containing images of people with and without masks along with bounding box coordinates for every face present in each image. The trained model achieved 95.04% accuracy on previously unseen test data. Keywords: Computer vision, deep learning, face mask detection, SSD

Data

Pretrained model (SSD Model for Face Detection)

Caffe Face Detector (OpenCV Pre-trained Model)

Dataset

Face Mask Detection Dataset

CNN Model for mask detection

Model.h5

Usage

Dependencies

Following packages should be installed:

  1. OpenCV- pip install opencv-python
  2. Keras- pip install keras
  3. NumPy- pip install numpy
  4. MatPlotLib- pip install matplotlib
  5. TensorFlow- pip install tensorflow

Download the CNN model from given link and chnage the value of variable 'saved_model_path' in predict.py to the absolute path of the downloaded file.

Train

Code realted to loading model, preprocessing, architecture is in milestone3.ipynb or milestone3.py

Test

predict.py [options] absolute/path/to/file

Where options can be:

  • photo to predict correctly worn fask masks in a photo
  • video to predict correctly worn fask masks in a video
  • live to predict correctly worn fask masks in a live feed through camera (here absolute/path/to/file is '0' for webcam and '1' for external camera)

For example:

python predict.py live 0
python predict.py video D:/video2.mp4
python test.py image D:/test3.jpeg

Report

Link

Slides

Link

Video

Link

Results


Test Loss for Model: 0.1662766933441162
Test Accuracy for Model: 0.9408695697784424

Model Accuracy:

Model Accuracy

Model Loss:

Model Loss

python predict.py video /path/to/video.extension

predict.py video example

python predict.py live 0

predict.py live example

python predict.py image /path/to/image.extension

predict.py image example

About

Detecting facemasks using SSD and CNN

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published