Abstract
COVID-19 has dramatically changed people’s daily life. Wearing masks is considered as a simple but effective way to defend the spread of the epidemic. Hence, a real-time and accurate mask wearing detection system is important. In this paper, a deep learning-based mask wearing detection system is developed to help people defend against the terrible epidemic. The system consists of three important functions, which are image detection, video detection and real-time detection. To keep a high detection rate, a deep learning-based method is adopted to detect masks. Unfortunately, according to the suddenness of the epidemic, the mask wearing dataset is scarce, so a mask wearing dataset is collected in this paper. Besides, to reduce the computational cost and runtime, a simple online and real-time tracking method is adopted to achieve video detection and monitoring. Furthermore, a function is implemented to call the camera to real-time achieve mask wearing detection. The sufficient results have shown that the developed system can perform well in the mask wearing detection task. The precision, recall, mAP and F1 can achieve 86.6%, 96.7%, 96.2% and 91.4%, respectively.
Introduction
During the COVID-19 pandemic, mask-wearing emerged as a primary defense against viral spread. However, manual enforcement of these rules is labor-intensive and increases the risk of infection for inspectors. While computer vision offers an automated alternative, several hurdles persist: environmental complexity (such as "tiny targets" in crowds), a lack of high-quality labeled datasets, and the high computational cost of processing high-resolution video in real-time.
This paper presents a high-speed, deep learning-based system designed to automate mask-wearing compliance. By integrating the YOLOv3 object detector with the SORT (Simple Online and Real-time Tracking) algorithm, the system achieves high accuracy while maintaining the speed necessary for real-time monitoring.
System Architecture and Methodology
The developed system is designed for versatility, supporting static images, uploaded video files, and live camera feeds. The core architecture follows a modular approach to ensure flexibility in deployment.
Detection with YOLOv3
The system utilizes YOLOv3 (You Only Look Once, version 3) as its primary detector. Unlike "two-stage" models such as Faster R-CNN, YOLOv3 is a "one-stage" detector, making it significantly faster and better suited for real-time applications. The model employs a ResNet53 backbone and Leaky ReLU activation functions to balance depth and processing speed.
Efficient Tracking with SORT
To optimize video processing, the authors integrated Simple Online and Real-time Tracking (SORT). Rather than performing a computationally expensive detection on every single frame, the system uses a Kalman filter to predict the movement of faces between frames. This implicit relationship allows the system to maintain high accuracy with significantly lower computational overhead, enabling processing speeds of over 80 frames per second (FPS).
Dataset and Training
To address the scarcity of mask-wearing data, a balanced dataset of 2,370 images was curated from the internet. This dataset includes 1,182 "mask" samples and 1,188 "unmask" samples, covering both simple scenarios (single person) and complex environments (crowds). Images were manually annotated using the LabelImg tool to ensure high-quality ground truth data.
Experimental Results
The system was evaluated on a Tesla P100 GPU, demonstrating both high accuracy and impressive speed. The model achieved a mean Average Precision (mAP) of 96.2% and an F1-score of 91.4%. Notably, the system prioritized recall (96.7%) over precision (86.6%), which is advantageous in public health contexts where missing a non-compliant individual (a false negative) is more critical than a false alarm.
In terms of performance, the average processing time was recorded at 12.7 ms per image, equating to approximately 80.65 FPS. This speed allows the system to run effectively on standard personal computers without requiring specialized industrial hardware.
Conclusion and Future Work
The developed system provides a robust and efficient solution for mask-wearing detection. Future work will focus on expanding the system's capabilities to include crowd-counting and dangerous action recognition. Additionally, the authors aim to further optimize the model architecture for deployment on low-power edge devices, such as Raspberry Pi or Jetson Nano, to facilitate wider accessibility.
Summary updated