-
与先生成RPN再进行目标检测的算法不同,SSD算法可直接预测目标类别和检测框位置,具有较高的检测精度和很快的检测速度。该算法通过在不同尺度特征图上进行
$ {\rm{3}} \times {\rm{3}} $ 尺寸的滑动卷积,可实现精度较高的尺度不变人脸检测结果。基于SSD基础检测网络的人脸检测模型如图1所示。由图1可知,
$ {\rm{Conv1\_1}}-{\rm{Conv5\_3}} $ 是$ {\rm{VGG16}} $ 的前5个卷积层,$ {\rm{Conv6}} $ 和$ {\rm{Conv7}} $ 是由$ {\rm{VGG16}} $ 的2个全连接层FC6和FC7改造的卷积层,$ {\rm{Conv8\_2}}-{\rm{Conv11\_2}} $ 是新增的4个卷积层。该模型的输入是包含一个或多个面部的图像,输出是一系列人脸检测框及其对应的面部得分,当所有人脸检测框执行非最大值抑制后,得到最终的人脸检测结果。该SSD人脸检测模型的损失函数包含了人脸/背景分类的softmax损失
$ {L_{conf}} $ 和人脸检测框回归的smooth L1损失$ {L_{loc}} $ :$$ {L_{face}}(x,c,t,{t^ * }) = \frac{1}{N}\left( {{L_{conf}}(x,c) + \lambda {L_{loc}}(x,{t_i},t_i^ * )} \right) $$ (1) 式中:
$ N $ 为匹配到人脸检测框的数量;$ x $ 为检测框属于人脸的得分,是则取1,不是则取0;$ c $ 为检测目标的人脸置信度;$ {t_i} $ 为人脸预测框;$ t_i^ * $ 为人脸真实框;$ \lambda $ 为平衡softmax损失和smooth L1损失的权重。在训练时,为了提高运行效率和检测效果,对正负训练样本比例进行控制。首先计算先验框和真实框的交并比
$ (\rm{Intersection\;over \;Union, IoU}) $ ,取$ {\rm{IoU}} > 0.5 $ 的先验框为正样本,其余先验框为负样本。接着,将检测框与负样本集进行一一匹配,删除匹配失败的检测框以平衡正负样本数量,提高训练的收敛速度。 -
文中提出的基于增强卷积神经网络的尺度不变人脸检测模型如图2所示,该模型主要分为基础卷积层、特征增强网络、增强特征层和多任务损失层4个部分。
基础卷积层采用SSD模型从Conv3_3~Conv7_2的6个多尺度卷积层,每层对应生成的特征图为f_1(160×160)、f_2(80×80)、f_3(40×40)、f_4(20×20)、f_5(10×10)和f_6(5×5)。其中,前2个特征图f_1和f_2被送入特征增强网络进行特征增强。后4个特征图直接被用来进行人脸/背景分类和人脸边界框位置回归。
图 2 基于增强卷积神经网络的尺度不变人脸检测模型
Figure 2. Scale-invariant face detection model based on enhanced convolutional neural network
特征增强网络负责协调组合当前层特征图和前后两层特征图的上下文信息。对这3层特征图进行归一化卷积、上采样、下采样、点乘、连接和扩张卷积等操作后,得到当前层特征图的增强特征图,并且它们的尺寸与当前层特征图保持一致。由于浅层特征图更适合进行小尺寸目标检测,因此增强特征图ef_1和ef_2被用来进行小尺寸人脸检测。另外,在训练时还为ef_1和ef_2加入了负样本筛选,通过增加分类的难度来降低由小尺寸锚框引起的人脸检测假正率升高,进一步提高了人脸检测精度。
-
参考文献[13]指出,浅层特征图更适合被用来检测小尺寸人脸,因此,文中提出了特征增强网络来增强浅层特征图f_1和f_2的鉴别性和稳健性,以进一步提高对小尺寸人脸的检测精度。在增强第k层特征图时,需要协调组合第k−1层、第k层和第k+1层特征图的上下文信息,其网络结构如图3所示。
由图3可以看出,第k−1层、第k层和第k+1层特征图的尺寸和维度均不相同,此时不能直接进行特征图的增强融合。因此,可先遍历采用1×1尺寸卷积核对上述特征图进行尺寸和维度的归一化处理,使3层特征图的维度相同。然后分别对第k−1层特征图进行下采样,对第k+1层特征图进行上采样,使3层特征图的尺寸也都为2l×2l。接着,对第k−1层特征图和第k层特征图进行逐元素点乘,对第k层特征图和第k+1层特征图进行逐元素点乘,并将点乘后的2个新特征图连接,得到2l×2l大小的融合特征图。最后,对融合特征图进行扩张卷积(扩张率分别是2、3、4),得到特征图f_k的增强特征图ef_k。以上步骤可归纳如下:
$$\begin{array}{l} {{nf}}\_{{k - 1}} = {f_{{\rm{Dot}}}}\left( {{f_{{\rm{down}}}}({f_{{\rm{conv1}}}}({{f}}\_{{k - 1}})), {f_{{\rm{conv1}}}}({{f}}\_{{k}})} \right)\\ {{nf}}\_{{k}} + 1 = {f_{{\rm{Dot}}}}\left( {{f_{{\rm{up}}}}({f_{{\rm{conv1}}}}({{f}}\_{{k}} + 1)), {f_{{\rm{conv1}}}}({{f}}\_{{k}})} \right)\\ {{ef}}\_{{k}} = {f_{{\rm{2,3,4 - dilated\_conv3}}}}\left( {{f_{{\rm{connect}}}}\left( {{{nf}}\_{{k - 1}}, {{nf}}\_{{k}} + 1} \right)} \right) \end{array}$$ (2) 式中:
$ {f_{{\rm{conv1}}}} $ 表示遍历采用1×1尺寸卷积核执行归一化卷积;$ {f_{{\rm{down}}}} $ 表示对第k-1层特征图进行下采样;$ {f_{{\rm{up}}}} $ 表示对第k+1层特征图进行上采样;$ {f_{{\rm{Dot}}}} $ 表示对两个特征图进行逐元素点乘;$ {f_{{\rm{connect}}}} $ 表示对两个新特征图${{nf}}\_{{k}}{\rm{ - 1}}$ 和${{nf}}\_{{k}} + 1$ 进行连接;$ {f_{{\rm{2,3,4 - dilated\_conv3}}}} $ 表示扩张率分别是2、3、4,卷积核大小为3×3的扩张卷积。 -
基于锚框的人脸检测方法可以被视为一个二元分类问题,即确定锚框所包围的区域是人脸还是背景。由于人脸在整张图像上所占的面积较小,这会导致正负训练样本的严重不匹配,只有一小部分锚框对应的是人脸,而绝大多数锚框对应的是背景,这会增加人脸检测的假正率。这种严重的正负训练样本不匹配主要是由小尺寸人脸检测引起,为了检测小尺寸人脸,必须在图像上密集平铺数量庞大的小尺寸锚框,这会导致负训练样本的急剧增加。为了解决这个问题,文中对ef_1和ef_2这两个检测小尺寸人脸的增强特征图,进行了负样本筛选,通过增加分类的难度来降低由小尺寸锚框引起的人脸检测假正率升高,该过程的示意图如图4所示。
由图4可知,对于ef_1和ef_2这两个增强特征图,输出通道数设置为(Nc+1)+4,其中Nc+1对应Nc个负样本概率和1个正样本概率,4对应人脸边界框回归的位置坐标[x, y, Δx, Δy]。对于每个匹配到真实人脸框的锚框,同时预测Nc个该锚框的背景锚框,然后选择其中得分最高的背景锚框作为负样本与正样本一起完成softmax二分类:
$$ b' = \max ({b_1}, \cdots ,{b_{{N_{\rm{c}}}}}) $$ (3) 式中:
$ b' $ 表示得分最高背景锚框的概率;$ {b_1} $ ~$ {b_{{N_{\rm{c}}}}} $ 表示Nc个预测背景锚框的概率。通过这种局部优化方法,可以降低负训练样本比例,同时增强对小尺寸人脸的检测能力。对于从f_3~f_6这四个特征层,输出通道数设置为2+4,其中2表示人脸/背景的二元分类概率,4表示人脸边界框回归的位置坐标。 -
在浅层特征图上更适合进行小尺寸人脸检测,因此,文中算法在训练时为ef_1和ef_2这两层增强特征图,设置了基于小尺寸锚框
$ {\hat r_i} $ 的损失函数,为f_3、f_4、f_5和f_6这四层特征图设置了基于正常尺寸锚框$ {r_i} $ 的损失函数,并通过加权求和来融合上述两种损失函数。ef_1和ef_2这两层增强特征图对应的损失函数为:
$$ \begin{split} {L_{ef}}({p_i},{t_i},{{\hat r}_i}) =& \frac{1}{{{N_{conf}}}}\left( {\sum\limits_i {{L_{conf}}({p_i},p_i^ * )} } \right) + \\ &\frac{\alpha }{{{N_{loc}}}}\left( {\sum\limits_i {p_i^ * {L_{loc}}({t_i},t_i^ * ,{{\hat r}_i})} } \right) \end{split} $$ (4) 式中:
$ {N_{conf}} $ 表示正负样本锚框数量;$ {L_{conf}} $ 表示对人脸和背景的分类损失;$ {p_i} $ 表示预测为人脸的概率;$ p_i^ * $ 表示正负样本标签;$ {N_{loc}} $ 表示正样本锚框的数量;$ {L_{loc}} $ 表示使用锚框$ {\hat r_i} $ 时人脸预测框$ {t_i} $ 和真实框$ t_i^ * $ 之间的参数化$ {\rm{smooth }}{L_1} $ 损失,当$ p_i^ * = 1 $ 时,激活$ {L_{loc}} $ ,并通过权重$ \alpha $ 来平衡$ {L_{conf}} $ 和$ {L_{loc}} $ 。f_3、f_4、f_5和f_6这四层特征图对应的损失函数为:
$$ \begin{split} {L_f}({p_i},{t_i},{r_i}) =& \frac{1}{{{N_{conf}}}}\left( {\sum\limits_i {{L_{conf}}({p_i},p_i^ * )} } \right) +\\ & \frac{\alpha }{{{N_{loc}}}}\left( {\sum\limits_i {p_i^ * {L_{loc}}({t_i},t_i^ * ,{r_i})} } \right) \end{split} $$ (5) 式中:锚框
$ {r_i} $ 的尺寸是$ {\hat r_i} $ 的两倍。将ef_1和ef_2的损失函数与f_3、f_4、f_5和f_6的损失函数加权融合,得到均衡化处理后的新损失函数$ {L_{Sum}} $ :$$ {L_{Sum}} = {L_{ef}}({p_i},{t_i},{\hat r_i}) + \beta {L_f}({p_i},{t_i},{r_i}) $$ (6) 式中:
$\; \beta $ 表示均衡$ {L_{ef}}({p_i},{t_i},{\hat r_i}) $ 和$ {L_f}({p_i},{t_i},{r_i}) $ 的权重。
Scale-invariant face detection method based on enhanced convolutional neural network
-
摘要: 针对非约束场景下小尺寸人脸检测困难的问题,提出了一种基于增强卷积神经网络的尺度不变人脸检测方法。首先,在SSD基础检测网络的两个浅层特征图上,通过协调聚合当前层特征图和前后两层特征图的特征信息,对当前层特征图的鉴别性和稳健性进行增强。然后,对两个增强特征图进行负样本筛选,通过增加分类的难度来降低由小尺寸锚框引起的人脸检测假正率上升。最后,为原始特征图和增强特征图设置了两种基于锚框尺寸的损失函数,并通过加权求和的方式对其进行融合。在FDDB和WIDER FACE数据集上的测试结果表明,文中所提方法比目前主流人脸检测方法具有更高的检测精度。Abstract: Aiming at the difficulty of small-scale face detection in unconstrained scenes, the proposes a scale-invariant face detection method based on enhanced convolutional neural networks. Firstly, On the two shallow feature maps of the SSD basic detection network, the discrimination and robustness of the current layer feature map was enhanced by blending the feature information of the current layer feature map and adjacent layer feature map. Then, the negative sample screening was performed on the two enhanced feature maps, and the false positive rate of face detection caused by the small-scale anchor box was reduced by increasing the difficulty of classification. Finally, two loss function based on anchor boxes size were set for the original feature map and the enhanced feature map, and they were merged by weighted summation. The test results on the FDDB and WIDER FACE datasets show that the proposed method has higher detection accuracy than the current mainstream face detection methods.
-
-
[1] Bruno R. Humans are visual experts at unfamiliar face recognition [J]. Trends in Cognitive Sciences, 2018, 22(6): 471-472. doi: 10.1016/j.tics.2018.03.002 [2] Dadgostar F, Sarrafzadeh A. Gesture-based human-machine interfaces: a novel approach for robust hand and face tracking [J]. Iran Journal of Computer Science, 2018, 1(1): 47-64. doi: 10.1007/s42044-018-0005-6 [3] Lai H, Xiao S, Pan Y, et al. Deep recurrent Regression for facial landmark detection [J]. IEEE Transactions on Circuits and Systems for Video Technology, 2018, 28(5): 1144-1157. doi: 10.1109/TCSVT.2016.2645723 [4] Li H Y, Dong W M, Hu B G. Facial image attributes transformation via conditional recycle generative adversarial networks [J]. Journal of Computer Science & Technology, 2018, 33(3): 511-521. [5] Jiang H, Learned M E. Face detection with the faster R-CNN[C]//International Conference on Automatic Face Gesture Recognition, 2016: 650-657. [6] Yan Mengkai, Qian Jianjun, Yang Jian. Weakly aligned cross-spectral face detection [J]. Acta Automatica Sinica, 2022, 48(8): 1-13. [7] Zhou Yan, Xiang Yang, Zeng Fanzhi, et al. Tiny face recognition algorithm based on super-resolution reconstruction [J]. Journal of Chinese Computer Systems, 2020, 11: 2340-2346. [8] Cheng Shuhong, Ma Xiaofei, Zhang Shijun, et al. Smoking deteciton algorithm based on multitask classification [J]. Acta Metrologica Sinica, 2020, 41(5): 538-543. [9] 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 [10] Najibi M, Samangouei P, Chellappa R, et al. SSH: Single stage headless face detector[C]//Proceedings of the IEEE International Conference on Computer Vision, 2017: 4885-4894. [11] Yang S, Luo P, Loy C C, et al. Faceness-Net: Face detection through deep facial part responses [J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2018, 40(8): 1845-1859. doi: 10.1109/TPAMI.2017.2738644 [12] Li H, Lin Z, Shen X, et al. A convolutional neural network cascade for face detection[C]//IEEE Conference on Computer Vision and Pattern Recognition. Boston: IEEE Computer Society, 2015: 5325-5334. [13] 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 and Machine Intelligence, 2015, 39(6): 1137-1149. [14] Liu W, Anguelov D, Erhan D, et al. SSD: Single shot multibox detector[C]//Proceedings of the European Conference on Computer Vision, 2016: 21-37. [15] Hu P, Ramanan D. Finding tiny faces[C]//IEEE Conference on Computer Vision and Pattern Recognition, 2017: 1522-1530. [16] Zhang S, Zhu X, Lei Z, et al. S³FD: Single shot scale-invariant face detector[C]//Proceedings of the IEEE International Conference on Computer Vision, 2017: 192-201. [17] Tang X, Du D K, He Z, et al. Pyramidbox: A context-assisted single shot face detector[C]//Proceedings of the European Conference on Computer Vision, 2018: 797-813. [18] Jain V, Learned-miller E. Fddb: A benchmark for face detection in unconstrained settings[R].Amherst: University of Massachusetts, 2010. [19] Yang S, Luo P, Chen C L, et al. WIDER FACE: A face detection benchmark[C]//IEEE Conference on Computer Vision and Pattern Recognition, 2016: 5525-5533. [20] Glorot X, Bengio Y. Understanding the difficulty of training deep feedforward neural networks[C]//Proceedings of the Thirteenth International Conference on Artificial Intelligence and Statistics, 2010: 249-256.