Giter VIP home page Giter VIP logo

fasterrcnn-based-face-mask-detection's Introduction

Face-Mask-Detection

Haolin Zhang

人脸口罩检测(中文)/ Face mask detection (English)

Update 2021/01/01: Faster R-CNN based Face Mask Detector

Face-Mask-Detection-Demo

Environment

We recommend to use anaconda to create a python3 environment to manage the pytorch-GPU environment.
You can use the following commands to configure your environment:

conda create -n {your environment name} python=3.7

Then anaconda will solve the dependencies automatically for you. (Make sure you have successfully installed the NVIDIA driver.)

Then you need to install following dependencies in your conda environment:

pytorch-GPU or pytorch > 1.0  
python-opencv > 3.0  
torchvision
numpy

Getting Started

  1. Download the AIZOO Face Mask Detection Dataset (or you can use your own dataset, make sure in same format) (link) and copy the dataset AIZOO into the root folder as /Face-Mask-Detection/AIZOO. The files in AIZOO are as follow:
    /AIZOO/
     ├── train
     ├── val
     └── readme.md

2.Process the Dataset by running 'dataset_copy.py'. In our demo, we use 800 images for training and 500 images for validation.
Then processed train folder and val folder will show in the root folder as follow:

   /ROOT/  
    ├── train  
    │   ├── Annotations  
    │   ├── JPEGImages  
    │   └── train.txt  
    └── val  
        ├── Annotations  
        ├── JPEGImages  
        └── val.txt  
note: you can choose how many images you want to use for training and validation by revising 'dataset_copy.py'.  
  1. Traing the Faster R-CNN based Face Mask Detection Model. Run train_faster_rcnn.py (you can set customized parameters)

Evaluation and Demo

  1. After the trained models are saved in checkpoints_faster_rcnn, you can run evaluation_faster_rcnn to calculate mAP for both Face With mask and Face Without Mask.
  2. After the trained models are saved in checkpoints_faster_rcnn, you can run demo_faster_rcnn.py to visualize the detection result by changing demo.jpg.

Experimental Results

epoches = 10, Adam Optimizer, learning rate = 0.0001
800 images (400: with mask 400: without mask) for training
500 images (250: with mask 250: without mask) for testing

Face Without Mask

IoU threshold 0.5 0.7 0.9
mAP 0.83 0.69 0.10

Face With Mask

IoU threshold 0.5 0.7 0.9
mAP 0.90 0.80 0.01

Reference

https://github.com/AIZOOTech/FaceMaskDetection
https://github.com/aky15/AIZOO_torch
Ren, Shaoqing, Kaiming He, Ross Girshick, and Jian Sun. "Faster r-cnn: Towards real-time object detection with region proposal networks." IEEE transactions on pattern analysis and machine intelligence 39, no. 6 (2016): 1137-1149. Chowdary, G. Jignesh, Narinder Singh Punn, Sanjay Kumar Sonbhadra, and Sonali Agarwal. "Face Mask Detection using Transfer Learning of InceptionV3." arXiv preprint arXiv:2009.08369 (2020). Jiang, Mingjie, and Xinqi Fan. "RetinaMask: A Face Mask detector." arXiv preprint arXiv:2005.03950 (2020).

fasterrcnn-based-face-mask-detection's People

Contributors

osu-haolin avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

huxufeng666

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.