/COVID19-Facemask-Detection

An app to detect face mask from a video or an image. It classifies into three categories: with mask, without mask and incorrectly weared mask.

Primary LanguagePython

Mask Gif

Datasets That I Used

  • Cabani, Adnane, et al. “MaskedFace-Net -- A Dataset of Correctly/Incorrectly Masked Face Images in the Context of COVID-19.” Smart Health, vol. 19, Mar. 2021, p. 100144. arXiv.org, doi:10.1016/j.smhl.2020.100144.

  • "Face Mask Detection". kaggle.com. https://www.kaggle.com/andrewmvd/face-mask-detection, 2021

Accuracy and Train Time

If you have more than one GPU, train.py automatically runs it in parallel but the training times reported below is for single NVIDIA V100 GPU.

Accuracy and Train Time

Installation

pip install -r requirements.txt

Creating a virtual environment is recommended. Images are expected to be under "train" folder. Expected structure:

train/
    0/      # images with mask
    1/      # images without mask
    2/      # images with incorrectly weared mask

Usage

To train:

python train.py

To test video (if you want to test on your laptop's camera, give video_path as 0):

python test.py --video=<video_path> --model-path=<path_to_the_model>

To test an image:

python test.py --image=<image_path> --model-path=<path_to_the_model>