louisfacun / facemask-detection-yolov4

Detecting different wearing of face masks using YOLOv4.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wearing of Face Mask Detection Using YOLOv4

This repository contains the specific files and YOLOv4 implementation we used in our research paper.

Prerequisites

How to use

The following files are specific in this study:

  1. facemask.weights (244 MB)

  2. facemask.cfg

    width=640
    height=640

  3. facemask.data

    classes = 3
    names = facemask.names

  4. facemask.names

Files and directory structure

Put facemask.weights facemask.cfg facemask.data facemask.names in the same folder of compiled YOLOv4's darknet.

.
.
darknet (created after compiling darknet)
.
.
facemask.weights
facemask.cfg
facemask.data
facemask.names
darknet_image.py
darknet_video.py

Running an inference from different source

  • Single image: python darknet_image.py --input "<image location>"

  • PC webcam: python darknet_video.py

  • Video file: python darknet_video.py --input "<video location>"

  • IP camera: python darknet_video.py --input "<rstp ip>"

Tools and libraries we used

Model info

Labels

Label id Label Description Box Color
0 NWM Not Wearing a Mask Red
1 WM Wearing a Mask Green
2 IWM Improperly Wearing a Mask Yellow

Dataset stats

Label Instances Min Dimension Max Dimension
NWM 1,006 14x17 235x265
WM 1,012 14x15 614x605
IWM 1,007 22x53 559x577

Results

Average inference time mean Average Precision (PASCAL VOC 2012)
73 ms 94%

*Using GTX 1650 Super (CUDA Enabled Inference Time)

Confusion matrix

image

None row in the predictions means, for example, that there is 3 ground-truth of IWM that is not predicted.

Sample detections

image

image

Citation

If you use our study as a reference in a scientific publication, we would appreciate citations to the following:

Object Detection Frameworks fo Real-Time, Scale-Invariant Face Mask Detection, Facun et al., IJFCC vol. 11, no. 1, pp. 12-17, 2022.

@article{facun_facemask_2022,
    title={Object Detection Frameworks for Real-Time, Scale-Invariant Face Mask Detection},
    author={Facun, Louis Philippe B. and Baculo, Maria Jeseca C. and Libao, Marlon F.
            and Eisma, Ceazar M. and Fredeluces, Christian B. and Garlejo, Rigzor A.
            and Idio, Raymart S.},
    journal={International Journal of Future Computer and Communication},
    volume={11},
    number={1},
    pages={12-17},
    year={2022}
}

About

Detecting different wearing of face masks using YOLOv4.


Languages

Language:Python 100.0%