Computer Engineering and Applications ›› 2021, Vol. 57 ›› Issue (24): 268-275.DOI: 10.3778/j.issn.1002-8331.2106-0363

• Engineering and Applications • Previous Articles     Next Articles

Real-Time Face Mask Detection and Standard Wearing Recognition Method in Natural Environment

DING Pei, ALIFU·Kuerban, GENG Liting, HAN Wenxuan   

  1. College of Software, Xinjiang University, Urumqi 830046, China
  • Online:2021-12-15 Published:2021-12-13



  1. 新疆大学 软件学院,乌鲁木齐 830046


The novel coronavirus has a strong infectious effect. It can prevent the spread of airborne droplets and aerosols by wearing masks standard. However, some people do not wear masks or wear masks irregularly in public. It is not conducive to the development of epidemic prevention and control work. In order to solve this problem, the article improves YOLOv4 and proposes a real-time face mask detection and standard wearing recognition method in natural environment. For the large number of model parameters and the difficult of deploy, a lightweight backbone network L-CSPDarkNet (Light CSPDarkNet) is proposed to improve the detection speed of the model, and a lightweight feature enhancement module Light-FEB(Light Feature Enhancement Black) and multi-scale attention are proposed. The Multi-Scale-Sam (Multi Scale Sam) module enhances the feature extraction capabilities of the lightweight backbone network. Experimental results show that the accuracy of the proposed method reaches 91.94%, which is 3.55 percentage points higher than the original YOLOv4, and the detection speed reaches 75 frames per second, which is higher than the 35 frames per second of the original YOLOv4, and the false detection has been improved.

Key words: novel coronavirus, face mask detection, lightweight backbone network, feature enhancement, attention mechanism


新冠状病毒具有很强的传染性,规范佩戴口罩可以阻隔病毒通过空气中的飞沫、气溶胶等载体传播,然而在公共场合时有公民不佩戴口罩或不规范佩戴口罩的现象,不利于疫情防控工作的开展。为解决这一问题,提出了一种自然环境下的实时人脸口罩检测与规范佩戴识别方法,采用YOLOv4算法,在自然环境下对公民口罩佩戴情况进行检测。针对模型参数量大,难以部署应用的难题,引入轻量级骨干网络L-CSPDarkNet(LightCSPDarkNet)以提高模型的检测速度,同时提出轻量级特征增强模块Light-FEB(Light Feature Enhancement Black)和多尺度注意力机制Multi-Scale-Sam(MultiScaleSam)增强轻量级主干网络的特征提取能力。实验结果表明,该算法精度可达91.94%,相比于原始YOLOv4算法提高了3.55个百分点,检测速度达到75?frame/s,高于原始YOLOv4的35?frame/s,可满足实际应用的需求。

关键词: 新冠状病毒, 人脸口罩检测, 轻量级骨干网络, 特征增强, 注意力机制