Advanced Search

ISSN1001-3806 CN51-1125/TN Map

Volume 45 Issue 6
Nov.  2021
Article Contents
Turn off MathJax

Citation:

Face detection algorithm based on improved S3FD network

  • Corresponding author: LÜ Xiaoqi, lxiaoqi@imut.edu.cn
  • Received Date: 2020-12-22
    Accepted Date: 2021-01-23
  • In face detection, the small target face carries less feature information and is relatively fuzzy, which leads to higher detection difficulty. In order to solve this problem, a novel algorithm was designed. The network that combines the single shot scale-invariant face detector (S3FD) network with the channel and the spatial attention mechanism was used as the backbone, and the channel and the spatial establish the weight relationship between the features, which strengthens the feature extraction ability. Then, the receptive field of the original S3FD output feature map was expanded and then up-sampled, so that the output of the feature map of the previous layer includes the features of the feature map of the next layer. Result: The average precision (AP) values of this algorithm on the three different levels of widerface verification datasets are 95.0%, 93.7%, and 86.4%, respectively, which are increased by 1.3%, 1.2%, and 0.5% compared with the original S3FD. The algorithm proposed in this paper has a better detection effect in face detection.
  • 加载中
  • [1]

    ROWLEY H A, BALUJA S, KANADE T. Neural network-based face detection[J]. IEEE Transactions on Pattern Analysis & Machine Intelligence, 2002, 20(1): 23-38.
    [2]

    ROWLEY H A, BALUJA S, KANADE T. Rotation invariant neural network-based face detection[C]// Computer Vision and Pattern Recognition. New York, USA: IEEE, 1998: 38-44.
    [3]

    VIOLA P, JONES M J. Robust real-time face detection[J]. International Journal of Computer Vision, 2004, 57(2): 137-154. doi: 10.1023/B:VISI.0000013087.49260.fb
    [4]

    MATHIAS M, BENENSON R, PEDERSOLI M, et al. Face detection without bells and whistles[C]// European Conference on Computer Vision. Zurich, Switzerland: ECCV, 2014: 720- 735.
    [5]

    YAN J, LEI Z, WEN L, et al. The fastest deformable part model for object detection[C]//Computer Vision and Pattern Recognition. New York, USA: IEEE, 2014: 2497-2504.
    [6]

    ZHU X, RAMANAN D. Face detection, pose estimation, and landmark localization in the wild[C]//Computer Vision and Pattern Re-cognition. New York, USA: IEEE, 2012: 2879-2886.
    [7]

    KRIZHEVSKY A, SUTSKEVER I, HINTON G, et al. ImageNet classification with deep convolutional neural networks ImageNet classification with deep convolutional neural networks[J]. Communications of the ACM, 2017, 60(6): 84-90. doi: 10.1145/3065386
    [8]

    LEI H L, ZHANG B H. Crowd count algorithm based on multi-model deep convolution network integration[J]. Laser Technology, 2019, 43(4): 476-481(in Chinese).
    [9]

    CHEN Q X, WU W Ch, ASKAR H. Detection algorithm based on multi-scale spotted target modeling[J]. Laser Technology, 2020, 44(4): 520-524(in Chinese).
    [10]

    LI H, LIN Z, SHEN X, et al. A convolutional neural network cascade for face detection[C]// Computer Vision and Pattern Recognition. New York, USA: IEEE, 2015: 5325-5334.
    [11]

    QIN H, YAN J, LI X, et al. Joint training of cascaded CNN for face detection[C]// Computer Vision and Pattern Recognition. New York, USA: IEEE, 2016: 3456-3465.
    [12]

    YANG S, LUO P, LOY C C, et al. From facial parts responses to face detection: A deep learning approach[C]//International Confe-rence on Computer Vision. New York, USA: IEEE, 2015: 3676-3684.
    [13]

    ZHANG K, ZHANG Z, LI Z, et al. Joint face detection and alignment using multitask cascaded convolutional networks[J]. IEEE Signal Processing Letters, 2016, 23(10): 1499-1503. doi: 10.1109/LSP.2016.2603342
    [14]

    JIANG H, LEARNED-MILLER E. Face detection with the faster R-CNN[C]//Automatic Face and Gesture Recognition. New York, USA: IEEE, 2017: 650-657.
    [15]

    REN S, HE K, GIRSHICK R, et al. Faster R-CNN: Towards real-time object detection with region proposal networks[J]. IEEE Transactions on Pattern Analysis & Machine Intelligence, 2017, 39(6): 1137-1149.
    [16]

    ZHU C, ZHENG Y, LUU K, et al. CMS-RCNN: Contextual multi-scale region-based CNN for unconstrained face detection[EB/OL]. (2016-06-16)[2020-12-22]. https://arxiv.org/pdf/1606.05413.pdf.
    [17]

    WAN S, CHEN Z, ZHANG T, et al. Bootstrapping face detection with hard negative examples[EB/OL]. (2016-08-07)[2020-12-22]. https://arxiv.org/pdf/1608.02236.pdf.
    [18]

    ZHANG S, ZHU X, LEI Z, et al. S3fd: Single shot scale-invariant face detector[C]//International Conference on Computer Vision. New York, USA: IEEE, 2017: 192-201.
    [19]

    LIU W, ANGUELOV D, ERHAN D, et al. SSD: Single shot multibox detector[C]// European Conference on Computer Vision. Amsterdam, The Netherlands: Springer International Publishing, 2016: 21-37.
    [20]

    ZHU C, TAO R, LUU K, et al. Seeing small faces from robust anchor's perspective[C]// Computer Vision and Pattern Recognition. New York, USA: IEEE, 2018: 5127-5136.
    [21]

    LI J, WANG Y, WANG C, et al. DSFD: Dual shot face detector[C]// Computer Vision and Pattern Recognition. New York, USA: IEEE, 2019: 5055-5064.
    [22]

    GU Y, LU X Q, YANG L D, et al. Automatic lung nodule detection using a 3D deep convolutional neural network combined with a multi-scale prediction strategy in chest CTs[J]. Computers in Biology and Medicine, 2018, 103: 220-231. doi: 10.1016/j.compbiomed.2018.10.011
    [23]

    LI Z, TANG X, HAN J, et al. PyramidBox+ +: High performance detector for finding tiny face[EB/OL]. (2019-08-07)[2020-12-22]. https://arxiv.org/pdf/1904.00386.pdf.
    [24]

    SIMONYAN K, ZISSERMAN A. Very deep convolutional networks for large-scale image recognition[EB/OL]. (2015-04-10)[2020-12-22]. https://arxiv.org/pdf/1409.1556.pdf.
    [25]

    WOO S, PARK J, LEE J Y, et al. CBAM: Convolutional block attention module[C]// European Conference on Computer Vision. Munich, Germany: ECCV, 2018: 3-19.
    [26]

    LIN T Y, DOLLAR P, GIRSHICK R, et al. Feature pyramid networks for object detection[C]//Computer Vision and Pattern Recognition. New York, USA: IEEE, 2017: 936-944.
    [27]

    LIU S, HUANG D, WANG Y. Receptive field block net for accurate and fast object detection[J]. Lecture Notes in Computer Science, 2018, 11215: 404-419.
    [28]

    SZEGEDY C, LIU W, JIA Y, et al. Going deeper with convolutions[C]//Computer Vision and Pattern Recognition. New York, USA: IEEE, 2014: 1-9.
    [29]

    BA J, MNIH V, KAVUKCUOGLU K. Multiple object recognition with visual attention[EB/OL]. (2015-04-23)[2020-12-22]. https://arxiv.org/pdf/1412.7755.pdf.
    [30]

    YANG S, LUO P, LOY C C, et al. Wider face: A face detection benchmark[C]// Computer Vision and Pattern Recognition. New York, USA: IEEE, 2016: 5525-5533.
    [31]

    ZHANG H Sh. Research on key algorithms of face detection and face recognition in video surveillance[D]. Chengdu: University of Electronic Science and Technology of China, 2019: 11-48(in Chinese).
    [32]

    WANG M, SU H S, LIU G H, et al. Classroom face detection algorithm based on convolutional neural network[J]. Laser & Optoelectronics Progress, 2019, 56(21): 211501(in Chinese).
  • 加载中
通讯作者: 陈斌, bchen63@163.com
  • 1. 

    沈阳化工大学材料科学与工程学院 沈阳 110142

  1. 本站搜索
  2. 百度学术搜索
  3. 万方数据库搜索
  4. CNKI搜索

Figures(11) / Tables(2)

Article views(3590) PDF downloads(24) Cited by()

Proportional views

Face detection algorithm based on improved S3FD network

    Corresponding author: LÜ Xiaoqi, lxiaoqi@imut.edu.cn
  • 1. Inner Mongolia Key Laboratory of Pattern Recognition and Intelligent Image Processing, College of Information Engineering, Inner Mongolia University of Science and Technology, Baotou 014010, China
  • 2. Institute of Information Engineering, Inner Mongolia University of Technology, Hohhot 010051, China
  • 3. School of Information Science and Technology, Dalian Maritime University, Dalian 116026, China

Abstract: In face detection, the small target face carries less feature information and is relatively fuzzy, which leads to higher detection difficulty. In order to solve this problem, a novel algorithm was designed. The network that combines the single shot scale-invariant face detector (S3FD) network with the channel and the spatial attention mechanism was used as the backbone, and the channel and the spatial establish the weight relationship between the features, which strengthens the feature extraction ability. Then, the receptive field of the original S3FD output feature map was expanded and then up-sampled, so that the output of the feature map of the previous layer includes the features of the feature map of the next layer. Result: The average precision (AP) values of this algorithm on the three different levels of widerface verification datasets are 95.0%, 93.7%, and 86.4%, respectively, which are increased by 1.3%, 1.2%, and 0.5% compared with the original S3FD. The algorithm proposed in this paper has a better detection effect in face detection.

引言
  • 人脸检测是计算机视觉领域主要关注点,在人脸对齐、人脸分析、人脸识别和人脸跟踪等领域有着广泛的应用。给定一幅图像,人脸检测的目标是确定是否存在任何人脸。如果有,则返回每个人脸的边界框。早期人脸检测采用模板匹配技术与手工特征,其代表性成果是ROWLEY等人提出的方法[1-2]。ROWLEY的方法有不错的精度,但由于分类器的设计和密集滑动窗口的采样设计导致速度太慢。2001年, VIOLA和JONES[3]设计了Viola-Jones(VJ)框架。之后部分可变形模型(deformable part models,DPM)被一些工作[4-6]用来处理人脸检测任务。随着机器学习以及深度学习在计算机视觉领域的不断发展,且卷积神经网络(convolutional neural networks,CNN)在ImageNet分类任务[7]取得进展,利用神经网络进行目标检测逐步成为主流技术方法[8-9]。级联网络(CascadeCNN)[10]延续了VIOLA和JONES的想法, 实现了不错的检测效果。QIN等人[11]提出整体训练CascadeCNN,从而实现优化。Faceness利用人脸属性分类的卷积神经网络来检测部分遮挡的人脸[12]。多任务卷积神经网络(multi-task convolutional neural networks, MTCNN)[13]进一步拓展了级联CNN的思想, 还有部分采用目标检测领域的思想,将整体网络结构分为P-Net, R-Net和O-Net。JIANG等人[14]将faster R-CNN[15]应用到人脸检测取得较好的效果。基于上下文的多尺度区域的卷积神经网络(contextual multi-scale region-based CNN, CMS-R-CNN)[16]采用上下文信息帮助进行人脸检测从而提升了性能,将网络整体分为上部分采用区域生成网络(region proposal network,RPN)进行检测, 下部分结合人体的人脸长宽等信息进行检测。WAN等人[17]将faster R-CNN与困难负样本优化结合取得了不错的效果。在含有大场景的少量的人脸图像中准确率已取得较高水平, 但在小场景的大量的人脸图像中准确率较低。针对多尺度人脸检测,2017年, ZHANG提出尺度不变人脸检测器(single shot scale-invariant face detector,S3FD),结合了faster R-CNN中的RPN和SSD[19](single shot multibox detector)中的锚点机制。2018年, ZHU等人[20]、LI等人[21]将人脸检测准确性进一步提高,同年GU等人[22]利用多尺度的目标检测在3-D方面取得了不错的效果。2019年, LI和TANG等人[23]提出PyramidBox++

    针对人脸检测中因目标特征信息较少、检测困难的问题,本文中提出一种基于S3FD的人脸检测算法。使用以视觉几何组(visual geometry group, VGG)VGG16[24]网络为主干的S3FD[18]进行特征提取,在整体网络结构的中间加入卷积注意力模块[25](convolutional block attention module,CBAM),利用空间和通道注意力来进行不同特征通道和特征图位置的权重系数,对后续的网络机构进行特征强化,最后利用特征金字塔网络[26](feature pyramid network,FPN)结构的形式,将其中FPN网络结构的卷积部分替换成为感受野模块(receptive field block,RFB)网络结构,利用RFB[27]中扩大感受野的效果作用于不同尺度下的特征图,从而减少目标特征信息的丢失,并且在不大量增加额外参数量的情况下完成人脸检测。

1.   基本原理
  • 针对小目标人脸特征较少,以及在图像获取中因采集设备等因素导致的图片精度不高的小目标难以检测的问题,提出基于S3FD网络结构的人脸检测方法。采用VGG16网络作为检测主体,强化针对人脸的特征提取力,引入CBAM注意力机制建立时间和空间的依赖关系;使用RFB来获得较大的感受野,让网络结构对目标图片的感受野扩大从而能获得更多的信息,而且在此基础之上还使用FPN网络结构,使得网络结构在不同尺度下都可以扩大感受野和在不大量增加额外参数量的情况之下网络能够保留更多的图像细节特征。基于S3FD网络结构的人脸检测算法模型S3FD-CBAM-RFB如图 1所示,其中conv表示卷积层,convfc表示全连接层,up表示上采样过程。

    Figure 1.  Network structure diagram of S3FD-CBAM-RFB

  • RFB网络模块是2018年由LIU等人[27]提出,仿照人类的视觉增大在神经网络训练中的感受野,从而获得更多的信息提高检测效果。RFB由不同尺寸卷积核的卷积层构成多分支结构, 类似于SZEGEDY等人在2014年提出的inception结构[28],并在此基础之上加入空洞卷积层,使得RFB的感受野进一步扩大, 获取的特征信息更多,如图 2所示。

    Figure 2.  Network structure diagram of RFB

    在RFB的基础之上LIU等人还改进出RFB-s,RFB-s于RFB相比主要存在两个方面的改进,一方面是将3×3的卷积层代替5×5的卷积层,另一方面是将3×3的卷积层改换为1×3和3×1卷积层,主要目的应该是减少计算量,RFB-s网络结构如图 3所示。

    Figure 3.  Network structure diagram of RFB-s

  • CBAM是由WOO等人[25]在2018年提出的网络结构,目的是对训练过程中的特征进行干预,将更多训练时的注意力分配到更能够区分图片特征的地方。CBAM与BA等人[29]提出的注意力机制不同,其中包含通道注意力机制和空间注意力机制,CBAM总体结构如图 4所示。

    Figure 4.  Network structure diagram of CBAM

    特征图F在通道注意力中计算过程如下式所示:

    式中,Mc(F)表示经过通道注意力后的特征图,avgpool和maxpool分别表示均值池化和最大值池化运算。(1)式经过计算后得到下式:

    式中,σ为sigmoid操作,r表示减少率,C表示通道数,R表示下降率,Fc, avg, Fc, max以及Fs, avg, Fs, max表示特征图F分别在通道注意力和空间注意力两个模块中经过均值池化和最大值池化后的特征图。W0, W1是多层感知器(multi-layer perceptron,MLP)运算中的权重,共享输入和W0的线性整流函数(rectified linear unit, ReLU)激活函数。通道注意力产生的特征图通过空间注意力的过程如下所示:

    式中,Ms(F)表示通过空间注意力之后的特征图,f7×7表示卷积核大小为7×7的卷积层。

2.   实验
  • 数据集采用widerface数据集[30],widerface数据集分为easy,medium和hard 3种不同难度的图像,widerface数据集包含32203个图像,其中有393703个人脸,而这些人脸在尺度、姿态、遮挡方面都有很大的变化范围,存在大量的小目标人脸。本模型使用widerface数据集中的训练集作为模型的训练集,验证集作为最后模型检测的测试集。widerface数据集如图 5所示,在实验中将widerface数据集的图像进行颜色扭曲,将图片裁剪到640×640大小, 且以0.5的概率进行左右翻转进行数据增强。

    Figure 5.  widerface data set

  • 本文中的模型是采取pytorch框架进行实现,实验平台是基于系统Ubuntu18.04,GPU为TeslaV100。实验中的训练迭代次数为300次,学习率是跟随着迭代次数的不断进行而逐渐减小的,从初始学习率0.001~ 0.00001变化3次,实验中批次样本数设置为18,优化器选择随机梯度下降法(stochastic gradient descent,SGD)。

  • 为了评价人脸检测性能,本文中主要采取精准率-召回率(precision-recall,PR)曲线来进行评价,精准率P指在以预测成为正样本的结果中实际为正样本的概率,召回率R指在实际上应为正样本的样本被预测成为正样本的概率。在预测的结果中预测为正样本的且与实际相符的样本数用真正例Tp表示,在预测的结果中预测为负样本的且与实际相符的样本数用假正例Fp表示;相反,在某一类中预测为正样本但与实际不符则用假负例Fn表示,预测为负样本且与实际相符则用真负例Tn表示。PR曲线所覆盖的面积称为平均精准率(average precision,AP),AP值越高则分类器的效果越好,其计算方式是将PR曲线所覆盖的面积分解成矩形进行计算面积。准确率P和召回率R的计算公式如下所示:

  • 本文中损失函数分为两部分,分类损失选用交叉熵损失,用于判断分类类别是否准确,如下式所示:

    式中,L表示交叉熵损失的值,N表示样本总数,i表示第几个样本,Li表示每一个样本的损失,yi表示样本i的标签,pi表示样本i预测为正的概率,选取平滑最小绝对值偏差损失L1来判断当前锚点是否合适,回归损失SL1如下式所示:

    式中,x表示预测框与真实值之间的差异。

  • S3FD-CBAM结构是在VGG16网络与extra conversion结构连接处添加CBAM结构以此来调整空间和通道的特征比重,如图 6所示。S3FD-double-stage-max则是在原有双通路基础上全面加入max-out结构使得负样本比例减少,如图 7所示。S3FD-double-stage结构是在原本S3FD-CBAM的基础上,将输入变为双通道,一条为VGG16, 另一条是由RFB模块构成,利用两条不同的网络结构来构建不同的特征图,然后进行叠加使网络整体能够获得的特征变多,如图 8所示。图 7图 8中的concat表示为数据的拼接,S3FD-CBAM-RFB结构如图 1所示。

    Figure 6.  Network structure diagram of S3FD-CBAM

    Figure 7.  Network structure diagram of S3FD-double-stage-max

    Figure 8.  Network structure diagram of S3FD-double-stage

  • 3种不同结构网络在widerface数据集上的表现如图 9所示。图 9a表示4种不同网络结构在easy难度数据集下的模型表现,图 9b表示4种不同网络结构在medium难度下的模型表现,图 9c表示4种不同网络结构在hard难度下的模型表现情况。

    Figure 9.  Curve of model effect

    通过图 9表 1可以看出, S3FD-CBAM-RFB在widerface数据集上的表现在3个不同难度的分类都有一定程度的提高,S3FD-CBAM网络结构体现出CBAM在网络结构中的正向作用,使得网络精确度在3种不同难度下均有了一定程度的提高,在此基础之上将此网络结构修改为以RFB为第2条通路的双通路网络结构,但由于此结构无法减少在卷积过程中对小目标特征信息的丢失,所以效果反而有一定程度的下降,S3FD-CBAM-RFB则是仿照FPN网络模块,将FPN中的卷积层变为RFB之后进行上采样,在使用RFB扩充感受野的同时将小目标的信息尽可能地保留,使得在人脸预测上S3FD-CBAM-RFB的结果有了一定程度的提高,但是在难度较高且人脸数量较多的hard难度下的图像中该网络结构没有在S3FD-CBAM原有的基础上改善。本文中的模型在widerface数据集的检测效果如图 10所示。正如图 10a~图 10d中所示,本文中算法对小型、密集、难度较大的人脸检测效果较好,但是图 10b中有部分人脸由于人脸角度以及人脸遮挡导致存在漏检情况,图 10e中存在一定的误检,将原本的手检测成为人脸,主要原因是图片本身在较远的部分相对模糊,所以将手误检成为人脸。

    methods AP/%
    easy medium hard
    S3FD 93.7 92.5 85.9
    S3FD-CBAM 93.8 92.7 86.4
    S3FD-double-stage 92.9 91.3 82.1
    S3FD-double-stage-max 92.8 91.1 82.6
    S3FD-CBAM-RFBNet 95.0 93.7 86.4

    Table 1.  Results of three methods

    Figure 10.  Test results

  • 为了说明本文中方法的有效性,选取了在widerface数据集上的其它方法进行比较,如表 2所示。IS3FD和IS3FD-fast这两种网络结构[31]与本文中模型是同种数据集且是同种骨干网络模型S3FD,IS3FD是采取上下文特征关系,采取局部特征金字塔网络(local feature pyramid networks, LFPN)以及将max-out扩展至所有特征预测层,IS3FD-fast是将激活函数改用ReLU的变形函数CRelU,将本文方法以及上述两种方法与原网络S3FD进行比较,从表 2可以看出, 本文中方法在hard难度下AP值介于IS3FD和IS3FD-fast两者之间,但是优于S3FD,在easy以及medium两个难度下本文算法均优于其它3种同类型的算法,与原S3FD相比分别提高了1.3%,1.2%,0.5%。

    methods AP/%
    easy medium hard
    S3FD[18] 93.7 92.5 85.9
    ZHU[20] 94.9 93.3 86.1
    IS3FD[31] 94.4 93.5 87.9
    IS3FD-fast[31] 93.1 92.4 86.4
    WANG[32] 93.0 87.3 58.3
    S3FD-CBAM-RFB(proposed method) 95.0 93.7 86.4

    Table 2.  Comparison of face detection results with the relevant methods

    本文中算法在3种不同难度下的人脸检测中均优于WANG等人[32]和ZHU等人所提出的算法,主要在于扩大了特征图在网络中的感受野以及加入注意力机制使得通道和空间的权重对结果产生影响。图 11所示是本文中算法在视频流检测效果。图 11a表示在简单情况下检测效果,图 11b表示在复杂情况下的检测效果。综上所述,本文中模型在widerface数据集上表现出相对较高的准确率和相对较少的运算成本和时间成本。

    Figure 11.  Video test results

3.   结论
  • 为解决在小目标人脸的检测准确率相对较差的问题,本文中利用S3FD网络结构为主干进行针对小目标人脸的检测算法研究。为解决在卷积过程中目标特征丢失以及图像清晰度不够的问题,该方法将S3FD、通道和空间注意力机制、RFB扩大感受野模块和多尺度特征金字塔相结合,减少目标特征在卷积过程中的损失,使得网络的整体准确率得到提高。本文中模型在参量方面没有进行大范围的增加,使得网络模型在检测过程中具有较好的速度,在一定程度上满足了对目标检测快速处理的需求。人脸检测中检测速度和检测准确率是一对矛盾体,如何在提高速度的同时提高人脸检测的准确率一直是人脸检测这一领域的重点,随着网络结构的不断优化以及硬件设备的不断提高,各种理论的不断发展和成熟,在不久的将来更快更准的人脸检测将会出现,本文中模型在保证一定速度的基础之上依旧保持较好的准确度,可促进更快更准的人脸检测技术的发展。

Reference (32)

Catalog

    /

    DownLoad:  Full-Size Img  PowerPoint
    Return
    Return