This repository contains the specific files and YOLOv4 implementation we used in our research paper.
- To keep this repository simple we won't include the source code of YOLOv4.
- Install YOLOv4's darknet. See YOLOv4's install guide https://github.com/AlexeyAB/darknet#requirements-for-windows-linux-and-macos
- If darknet (YOLOv4) is successfully installed, start running model inference using our files:
facemask.weights
facemask.cfg
facemask.data
facemask.names
The following files are specific in this study:
-
facemask.weights (244 MB)
-
facemask.cfg
facemask-detection-yolov4/facemask.cfg
Lines 4 to 5 in 86405f6
-
facemask.data
facemask-detection-yolov4/facemask.data
Lines 1 to 2 in a4cd233
-
facemask.names
facemask-detection-yolov4/facemask.names
Lines 1 to 3 in d8098be
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
-
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>"
- LabelImg: https://github.com/tzutalin/labelImg (labelling and drawing bounding boxes on images)
- Albumentations: https://albumentations.ai/docs/getting_started/installation/ (applying augmentations)
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 |
Label | Instances | Min Dimension | Max Dimension |
---|---|---|---|
NWM | 1,006 | 14x17 | 235x265 |
WM | 1,012 | 14x15 | 614x605 |
IWM | 1,007 | 22x53 | 559x577 |
Average inference time | mean Average Precision (PASCAL VOC 2012) |
---|---|
73 ms | 94% |
*Using GTX 1650 Super (CUDA Enabled Inference Time)
None row in the predictions means, for example, that there is 3 ground-truth of IWM that is not predicted.
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}
}