GithubHelp home page GithubHelp logo

niteshctrl / face-mask-detector Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 36.85 MB

Keras/Tensorflow implementation to detect faces wearing masks | | Data from Kaggle | | Used pretrained MobileNetV2 with imagenet weights(Transfer Learning) | | Data Augmentation using Keras ImageDataGenerator class | | Result obtained was 89.42% as validation accuracy | | Used OpenCV for inference on webcam feed

License: MIT License

Jupyter Notebook 97.10% Python 2.90%
opencv-python keras keras-tuner mobilenetv2

face-mask-detector's Introduction

Face Mask Detector

Table of Contents

Setup and Demo

  • To install the dependencies in the current environment:
pip install requirements.txt
  • Unmasked face will be bounded by a 'RED' colored bounding box while masked face with a 'GREEN'. Improperly worn mask will be bounded by 'BLUE' box. Keep the files 'haarcascade_frontalface_default.xml' and 'hypermodel_weights.h5' in the 'files' directory as in the repository and run the mask detector on the webcam by:
python run.py 

Description

  • The mask detection in this project is a two staged process with first one detecting faces and the second one classifying the detected faces into the three classes:'with_mask', 'without_mask' and 'mask_weared_incorrect'.
  • OpenCV's HAARCASCADE FRONTAL FACE is used for face detection.
  • MobileNetV2 is used as the backend architecture for classification of the detected faces.
  • Validation accuracy = 91.76%

Dataset

  • The dataset is available on Kaggle as this date(Jun 25, 2021) with a total of 853 annotated images in PASCAL VOC format with each image having multiple instances of faces belonging to 3 classes:'with_mask', 'without_mask' and 'mask_weared_incorrect'.
  • Upon extraction, a total of 4072 face crops were found.
  • A few samples in the dataset: Samples

Failure Cases and Further Improvements

  • Currently this is a two-staged model with first stage responsible to detect faces and the second for classifying as masked vs unmasked face. The detector often fails to detect the masked face itself as HAARCASCADE FRONTAL FACE(Face Detector) has been trained on unmasked faces. This leads to failure of masked face detection at the end. However unmasked face is mostly detected correctly by the app. The possible solution could be to train a single end-to-end object detection model specifying 'masked-face', 'unmasked-face' and 'mask-worn-incorrect' as three objects. This would remove the confusion for the face detector model on masked faces.

References and Credits:

  1. Data Source - Kaggle
  2. XML parsing in Python

face-mask-detector's People

Contributors

niteshctrl avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.