SphereFace: Deep Hypersphere Embedding for Face Recognition


W. Liu, et al., SphereFace: Deep Hypersphere Embedding for Face Recognition, CVPR (2017)


摘要

开集(open-set protocol)面部识别的特征要求:在某个测度空间(metric space)上,使得最大的类内距离(maximal intra-class distance)小于最小类间距离(minimal inter-class distance)。

角度归一化指数损失(angular softmax loss,A-Softmax)直接对超球面流形施加判别约束。

1 引言

面部识别(face recognition)分为面部身份识别(face identification)和面部验证(face verification),前者要求将面部图像分类到特定身份;后者是验证两张面部图像是否属于同一身份。

面部识别的测试协议(testing protocol)分为闭集(closed-set)和开集(open-set)设置:闭集面部识别为多分类问题,仅要求特征可分(separable);而开集协议下,需要将面部图像映射到可辨特征空间中(map faces to a discriminative feature space)。

文献阅读 - SphereFace: Deep Hypersphere Embedding for Face Recognition

开集面部识别本质上是度量学习问题,其关键在于如何学习大余量可辨特征(discriminative large-margin features),使得最大的类内距离(maximal intra-class distance)在特定测度空间(metric space)上小于最小类间距离(minimal inter-class distance)。

面部识别的难点在于:面部图像类内差异大且类间相似度高(large intra-class variation and high inter-class similarity)

文献阅读 - SphereFace: Deep Hypersphere Embedding for Face Recognition

归一化指数损失(softmax loss)只能学习可分特征(seperatable features),其可辨性不足。中心损失(center loss)使类内紧凑;对比损失(contrastive loss)和三元组损失(triple loss)需要设计二元组、三元组挖掘。

归一化指数损失学习的特征呈现角度分布,基于欧氏距离余量的损失与其并不兼容。(the
features learned by softmax loss have intrinsic angular distribution. In some sense, Euclidean margin based losses are incompatible with softmax loss.)

  • 角余量(angular margin)

归一化指数损失下,二分类(binary-class)问题的判决边界为:(W1W2)x+b1b2=0(\mathbf{W}_1 - \mathbf{W}_2) \mathbf{x} + b_1 - b_2 = 0,其中x\mathbf{x}为特征向量(a feature vector)。引入约束条件(constrain)W1=W2)=1\|\mathbf{W}_1\| = \|\mathbf{W}_2)\| = 1b1=b2=0b_1 = b_2 = 0,判决边界改写为x(cosθ1cosθ2)=0\|\mathbf{x}\| (\cos \theta_1 - \cos \theta_2) = 0,其中θi\theta_i为向量Wi\mathbf{W}_ix\mathbf{x}的夹角。这种学习角度分布特征(angularly distributed features)的损失称为修正归一化指数损失(modified softmax loss)。

修正归一化指数损失可辨性依然不足,因此本文提出角度归一化指数函数(angular softmax,A-Softmax):引入整数mmm1m \geq 1)定量控制决策边界(quantitatively control the decision boundary)。二分类情况下,决策边界为:

x(cosmθ1cosθ2)=0\|\mathbf{x}\| (\cos m \theta_1 - \cos \theta_2) = 0

x(cosθ1cosmθ2)=0\|\mathbf{x}\| (\cos \theta_1 - \cos m \theta_2) = 0

优化角度归一化指数损失(A-Softmax loss)能够同时增大类间余量,并压制类内角分布(simultaneously enlarging the inter-class margin and compressing the intra-class angular distribution)。角度归一化指数损失有清晰的几何解释,在其监督下(supervised by A-Softmax loss)习得的特征构造了等价于超球面流形上的测地线距离(a discriminative angular distance metric that is equivalent to geodesic distance on a hypersphere manifold)的判别角距离度量。将角度归一化指数损失应用于面部识别,提取的特征称为球面脸(SphereFace)

2 相关工作

  • 度量学习(metric learning)

  • 深度面部识别(deep face recognition)

3 深度超球面嵌入(Deep Hypersphere Embedding)

3.1 归一化指数损失

归一化指数损失(softmax loss):

(3)L=1NiLi=1Nilogefyijefj\mathcal{L} = \frac{1}{N} \sum_{i} \mathcal{L}_i = \frac{1}{N} \sum_{i} - \log \frac{e^{f_{y_i}}}{\sum_j e^{f_j}} \tag{3}

其中,NN为样本数、fjf_j为类别得分向量(class score vector)f\mathbf{f}的第jj个分量、j[1,K]j \in [1, K]KK为类别总数。

引入约束条件Wj=1\|\mathbf{W}_j\| = 1bj=0b_j = 0,修正归一化指数损失(modified softmax loss)为:

(5)Lmodified=1Nilogexicosθyi,ijexicosθj,i\mathcal{L}_\text{modified} = \frac{1}{N} \sum_{i} - \log \frac{e^{\|\mathbf{x}_i\| \cos \theta_{y_i, i}}} {\sum_j e^{\|\mathbf{x}_i\| \cos \theta_{j, i}}} \tag{5}

3.2 归一化指数损失中引入角度余量(angular margin)

对于二分类问题,类别1的样本强制要求cosmθ1>cosθ2\cos m \theta_1 \gt \cos \theta_2;类别2的样本强制要求cosmθ2>cosθ1\cos m \theta_2 \gt \cos \theta_1m2m \geq 2。此时角度余量为:

m1m+1θ21\frac{m - 1}{m + 1} \theta_2^1

其中,θ21\theta_2^1W1\|\mathbf{W}_1\|W2\|\mathbf{W}_2\|间的夹角。

角度归一化指数损失(A-Softmax loss)为:

(7)Lang=1Nilogexiψ(θyi,i)exiψ(θyi,i)+j̸=yiexicosθj,i\mathcal{L}_\text{ang} = \frac{1}{N} \sum_{i} - \log \frac{e^{\|\mathbf{x}_i\| \psi(\theta_{y_i, i})}} {e^{\|\mathbf{x}_i\| \psi(\theta_{y_i, i})} + \sum_{j \not=y_i} e^{\|\mathbf{x}_i\| \cos \theta_{j, i}}} \tag{7}

其中,ψ(θyi,i)=(1)kcos(mθyi,i)2k\psi(\theta_{y_i, i}) = (-1)^k \cos(m \theta_{y_i, i}) - 2kθyi,i[kπm,(k+1)πm]\theta_{y_i, i} \in [\frac{k \pi}{m}, \frac{(k + 1) \pi}{m}]k[0,m1]k \in [0, m - 1]

文献阅读 - SphereFace: Deep Hypersphere Embedding for Face Recognition

3.3 角度归一化指数损失(A-Softmax Loss)的超球面解释

角度归一化指数损失等价于超球流形上的可辨特征,欧式余量损失为欧式空间中的特征。

二分类问题中,θ1\theta_1θ2\theta_2等价于其在单位超球面(unit hypersphere,{vj,jjvj2=1,v0}\{v_j, \forall j | \sum_j v_j^2 = 1, v \geq 0 \})上对应的弧长(arc length)ω1\omega_1ω2\omega_2(最矩测地距离,shortest geodesic distance),则类别1样本的判决边界为mω1=ω2m \omega_1 = \omega_2

文献阅读 - SphereFace: Deep Hypersphere Embedding for Face Recognition

3.4 角度归一化指数损失性质

  • 性质1:角度归一化指数损失定义了难度可调的角度余量学习任务。mm越大,角度余量越大,流形上的约束区域越小,相应的学习任务越难。

  • 定义1:mminm_{\min}为满足可辨条件的最小值,即当m>mminm > m_{\min}时,在角度归一化指数损失监督下,类内最大角度特征距离小于类间最小角度特征距离。

  • 性质2:二分类问题,mmin2+3m_{\min} \geq 2 + \sqrt{3}

  • 性质3:多分类问题,假设Wi,i\mathbf{W}_i, \forall i均匀分布在欧氏空间中,则mmin3m_{\min} \geq 3

通常可取m=4m = 4

3.5 讨论

角余量直接将可辨性与流形联系,其本质与面部图像同样位于流形之上的先验一致。

4 实验

4.1 实验设定

  • 预处理

MTCNN面部对齐、截取,样本规范化((x127.5)/128(x - 127.5) / 128

  • 网络结构

文献阅读 - SphereFace: Deep Hypersphere Embedding for Face Recognition

  • 训练集

CASIA-WebFace(490万张面部图像,规模较小)

文献阅读 - SphereFace: Deep Hypersphere Embedding for Face Recognition

  • 测试

FC1层输出作为深度特征,对原始面部图像及水平翻转后的图像做特征提取,将提取的特征连接后作为最终面部表示(representation)。评分(score)、度量(metric)为余弦距离(cosine distace),

4.2 结果分析

  • 余量mm的影响

文献阅读 - SphereFace: Deep Hypersphere Embedding for Face Recognition

文献阅读 - SphereFace: Deep Hypersphere Embedding for Face Recognition

  • CNN结构的影响

文献阅读 - SphereFace: Deep Hypersphere Embedding for Face Recognition

4.3 LFW、YTF

文献阅读 - SphereFace: Deep Hypersphere Embedding for Face Recognition

4.4 MegaFace

文献阅读 - SphereFace: Deep Hypersphere Embedding for Face Recognition

文献阅读 - SphereFace: Deep Hypersphere Embedding for Face Recognition

5 结论

附录

相关文章:

  • 2021-12-15
  • 2021-04-27
  • 2021-09-03
  • 2021-04-15
  • 2021-10-13
  • 2021-09-20
  • 2022-01-08
  • 2021-06-24
猜你喜欢
  • 2021-04-13
  • 2021-12-21
  • 2021-12-05
  • 2021-06-20
  • 2021-06-01
  • 2021-10-31
相关资源
相似解决方案