Giter Site home page Giter Site logo

zouxiangxiang / facemaskdetection Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aizootech/facemaskdetection

0.0 1.0 0.0 54.12 MB

开源人脸口罩检测模型和数据 Detect faces and determine whether people are wearing mask.

Home Page: https://demo.aizoo.com/face-mask-detection.html

License: MIT License

Python 33.19% Jupyter Notebook 66.81%

facemaskdetection's Introduction

FaceMaskDetection

中文版 | English version

We open source all the popular deep learning frameworks' model and inference code to do face mask detection.

  • PyTorch
  • TensorFlow(include tflite and pb model)
  • Keras
  • MXNet
  • Caffe

** Detect faces and determine whether they are wearing mask. **

** First of all, we hope the people in the world defeat COVID-2019 as soon as possible. Stay strong, all the countries in the world.**

  • We make face mask detection models with five mainstream deep learning frameworks (PyTorch、TensorFlow、Keras、MXNet和caffe) open sourced, and the corresponding inference codes.

  • We published 7959 images to train the models. The dataset is composed of WIDER Face and MAFA, we verified some wrong annotations. You can download here from Google drive, if you can not visit Google, you can download it from BaiduDisk, click here to know how to download.

We deployed a web page, you can click the link to experience it. The page is writen by Tensorflow.js.

AIZOO face mask detection

Model structure

We used the structure of SSD. However, in order to make it run quickly in the browser, the backbone network is lite. The total model only has 1.01M parametes.

Input size of the model is 260x260, the backbone network only has 8 conv layers. The total model has only 24 layers with the location and classification layers counted.

SSD anchor configurtion is show bellow:

multibox layers feature map size anchor size aspect ratio)
First 33x33 0.04,0.056 1,0.62,0.42
Second 17x17 0.08,0.11
Third 9x9 0.16,0.22 1,0.62,0.42
Forth 5x5 0.32,0.45 1,0.62,0.42
Fifth 3x3 0.64,0.72 1,0.62,0.42

How to run

pytorch

on image:

python pytorch_infer.py  --img-path /path/to/your/img

on video:

python pytorch_infer.py --img-mode 0 --video-path /path/to/video  
# If you want to run with camera video, set  video_path to be 0
python pytorch_infer.py --img-mode 0 --video-path 0

TensorFlow/Keras/MXNet/Caffe

The other four frameworks running method is similar to pytorch, just replace pytorchwith tensorflow, keras,caffemxnet, if you want to use tensorflow, just run:

python tensorflow_infer.py  --img-path /path/to/your/img

Attention,for caffe's inference ,we use permute layer,so that we should use caffe-ssd,you can use opencv-dnn to do the inference.

Appendix

Feedback

If you use wechat, you can follow us.

** If you use Wechat, scan the code to add me on wechat **

Model structure

We merge the BN to Conv layers in order to accelerate the inference speed.

Testset PR curve

Our demo page

aizoo.com face mask detection demo

facemaskdetection's People

Contributors

daniellchiang avatar aizootech avatar

Watchers

James Cloos 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.