Computer Engineering and Applications ›› 2020, Vol. 56 ›› Issue (12): 1-7.DOI: 10.3778/j.issn.1002-8331.2002-0402

Previous Articles     Next Articles

Improved Algorithm of RetinaFace for Natural Scene Mask Wear Detection

NIU Zuodong, QIN Tao, LI Handong, CHEN Jinjun   

  1. College of Electrical Engineering, Guizhou University, Guiyang 550025, China
  • Online:2020-06-15 Published:2020-06-09



  1. 贵州大学 电气工程学院,贵阳 550025


The 2019-nCoV can be transmitted through airborne droplets, aerosols, and other carriers. Correctly wearing a mask in public places can effectively prevent the infection of the virus. A face mask wearing detection method in a natural scene is proposed. The RetinaFace algorithm is improved to add the task of face mask wearing detection by optimizing the loss function. An improved self-attention mechanism is introduced into the feature pyramid network to enhance the expressive ability of the feature map. A data set containing 3, 000 pictures is created and manually annotated for network training. The experimental results show that the algorithm can effectively detect the wearing of masks, and has achieved good detection results in natural scene videos.

Key words: 2019-nCoV, mask wear detection, feature pyramid network, self-attention mechanism, loss function


新型冠状病毒可以通过空气中的飞沫、气溶胶等载体进行传播,在公共场所下正确佩戴口罩可以有效地防止病毒的传播。提出了一种自然场景下人脸口罩佩戴检测方法,对RetinaFace算法进行了改进,增加了人脸口罩佩戴检测任务,优化了损失函数。在特征金字塔网络中引入了一种改进的自注意力机制,增强了特征图的表达能力。建立了包含3 000张图片的数据集,并进行手工标注,用于网络训练。实验结果表明该算法可以有效进行口罩佩戴检测,在自然场景视频中也取得了不错的检测效果。

关键词: 新型冠状病毒, 口罩佩戴检测, 特征金字塔网络, 自注意力机制, 损失函数