Skip to content

This repository contains code that implemented Mask Detection using MobileNet as the base model and Neural Network as the head model. Code draws a rectangular box over the person's face in red if no mask, green if the mask is on, with 99% accuracy in real-time using a live webcam. Refer to README for demo

License

Tejas-TA/Face-Mask-Detection-Real-Time-Computer-Vision

Repository files navigation

Face Mask Detection Real Time / Computer Vision / Object Detection


Detecting whether a person is wearing a mask or not in real-time using Python, Keras, OpenCV, TensorFlow, NumPy, etc. The folder consists of 1900 masked images and unmasked images.

Project Walkthrough -

Data Preprocessing

  1. Created 2 lists – data [] and labels []
  2. In data [], arrays of all the images will be appended and in labels [], arrays of “with_mask” and “without_mask” which is converted using LabelBinarizer from the scikit learn library is appended
  3. All the images are listed using load_img function from Keras library, and then attached corresponding labels to it
  4. The target size is set to 224*224(width and height) so that model is perfect
  5. Using img_to_array from Keras, all the images are converted to arrays.
  6. MobileNet is applied so preprocess_input is used.
  7. Train Test split is done.

Building the network

image

Train the Model -

The below graph summarizes the training image
There is a reduction in loss as the number of epochs increases

Face Detection using Camera (Real-Time)

Using deploy .prototxt and res10_300x300_ssd_iter_140000.caffemodel face is detected and using our deep learning model mask is detected. Please refer to the “Detect Mask Video.ipynb” for the code.


Email - tejasta@gmail.com
LinkedIn - https://www.linkedin.com/in/tejas-ta/
Blogs - https://tejasta.medium.com/

About

This repository contains code that implemented Mask Detection using MobileNet as the base model and Neural Network as the head model. Code draws a rectangular box over the person's face in red if no mask, green if the mask is on, with 99% accuracy in real-time using a live webcam. Refer to README for demo

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published