Giter Club home page Giter Club logo

face-mask-detector's Introduction

Face Mask Detection

GitHub PyPI - Python Version

Detecting face mask with OpenCV and TensorFlow. Using simple CNN or model provided by TensorFlow as MobileNetV2, VGG16, Xception.

Demo

Data

Raw data collected from kaggle and script crawl_image.py, split to 'Mask' and 'Non Mask' class.

Using build_data.py to extract faces from raw dataset and resize to 64x64.

Installation

Clone the repo

git clone [email protected]:ksvbka/face-mask-detector.git

cd to project folder and create virtual env

virtualenv .env
source .env/bin/activate
pip install -r requirements.txt

Download raw dataset and execute script build_dataset.py to preprare dataset for training

cd data
bash download_data.sh
cd -
python3 build_dataset.py --data-dir data/dataset_raw/ --output-dir data/64x64_dataset

Training

Execute train.py script and pass network architecture type dataset dir and epochs to it. Default network type is MobileNetV2.

python3 train.py --net-type MobileNetV2 --data-dir data/64x64_dataset --epochs 20

View tensorboard

tensorboard --logdir logs --bind_all

Testing

python3 mask_detect_image.py -m results/MobileNetV2-size-64-bs-32-lr-0.0001.h5 -i demo_image/2.jpg

Result

Hyperparameter: - batch size: 32 - Learing rate: 0.0001 - Input size: 64x64x3

Model result

Model Test Accuracy Size Params Memory consumption
CNN 87.67% 27.1MB 2,203,557 72.58 MB
VGG16 93.08% 62.4MB 288,357 18.06 MB
MobileNetV2 (fine tune) 97.33% 20.8MB 1,094,373 226.67 MB
Xception 98.33% 96.6MB 1,074,789 368.18 MB

Download pre-trained model: link

Demo

Using MobileNetV2 model

Demo Demo Demo Demo Demo Demo Demo Demo Demo

face-mask-detector's People

Contributors

dependabot[bot] avatar ksvbka 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.