FaceNet: A Unified Embedding for Face Recognition and Clustering
CVPR 2015
问题
- 在大规模的人脸认证和识别时既要快又要准是一个挑战
- 以前的方法是采用混合模型,最后训练一个分类器,然后从中间某层提取Representation(Vector),这种方法太间接太低效
- 无法从新的脸部图片提取很好的特征
- 即便提炼出来但这个特征通常很大(1000S of dimensions)
- 有些工作提出使用PCA,但是这是一种线性的转化,存在局限性
方法
-
没有复杂的处理,直接从脸图的像素进行End-to-end的学习
- 输出 128-D Embedding Vector(基于计算距离可以完成以下任务)
- 设定Thresholding value ==> Verification
- KNN ==> Recognition
- K-means ==> Clustering
- 输出 128-D Embedding Vector(基于计算距离可以完成以下任务)
-
提出Triplet Loss ∑ i n [ ∣ ∣ f ( x i a ) − f ( x i p ) ∣ ∣ 2 2 − ∣ ∣ f ( x i a ) − f ( x i n ) ∣ ∣ 2 2 + α ] \sum_{i}^n[||f(x_i^a ) - f(x^p_i )||^2_2 - ||f(x_i^a ) - f(x^n_i )||^2_2 +\alpha ] ∑in[∣∣f(xia)−f(xip)∣∣22−∣∣f(xia)−f(xin)∣∣22+α]
- 一组数据包含3个Vector,两个是指向同个人,一个指向不同的人,
- Loss的目标就是尽可能区分正例和负例,通过设置distance margin(SVM里也有)
- 选取的图片是在原图上剪切脸图
- 脸图的处理方式只用放大缩小和平移,不用2D或者3D对齐
-
Triplet Selection
Triplet 我理解的就是Embedding
因为随机选出的Triplet很容易满足$||f(x_i^a ) - f(x^p_i )||^2_2+\alpha < ||f(x_i^a ) - f(x^n_i )||^2_2 $,这样模型就没有学习到东西
- 所以要找出 a r g m a x x i p ∣ ∣ f ( x i a ) − f ( x i p ) ∣ ∣ 2 2 argmax_{x_i^p}||f(x_i^a ) - f(x^p_i )||^2_2 argmaxxip∣∣f(xia)−f(xip)∣∣22(hard negative)和 a r g m i n x i n ∣ ∣ f ( x i a ) − f ( x i n ) ∣ ∣ 2 2 argmin_{x_i^n}||f(x_i^a ) - f(x^n_i )||^2_2 argminxin∣∣f(xia)−f(xin)∣∣22
- 但是要满足$||f(x_i^a ) - f(x^p_i )||^2_2< ||f(x_i^a ) - f(x^n_i )||^2_2 $ 这个条件,不然会陷入局部最小
- 因为数据中本来就存在mislabelled和poorly imaged,要避免这些成为hard negative或者hard positive,所以不在全样本中寻找,而在mini-batch中找
收获
- 大道至简,从complex 方法中寻找能不能改用unified 的方法
- CNN还能当降维用
- 如何把逻辑思想转化成数学表达很重要
- 以后遇到识别问题可以参考Triplet Loss
参考
Targeting Ultimate Accuracy: Face Recognition via Deep Embedding
CVPR 2015
问题
- how data size impacts the result of deep CNN based methods and whether the tricks are essential with different data size
方法
- 作者提出了一种两步学习方法,结合mutil-patch deep CNN和deep metric learning,实现脸部特征提取和识别
- multi-patch deep CNN
- 人脸不同区域通过深度卷积神经网络分别进行特征提取
- deep metric learning
- 深度卷积神经网络提取的特征再经过metric learning将维度降低到128维度
- 在LFW数据集上准确率达0.9977
收获
- multi-patch based feature and metric learning with triplet loss can still bring significant improvement to deep CNN result even the data size increases
参考
http://arxiv.org/abs/1506.07310
Do We Really Need to Collect Millions of Faces for Effective Face Recognition?
ECCV 2016
问题
- CNN应用在人脸识别的时候需要很多训练数据
- 现有最大的用于训练模型的数据集是CASIA,
- in order to avoid the long-tail effect of the CASIA set
- 长尾效应(即数据集增大但是准确率没有上升,造成这种现象的原因是每一类只有很少的图片去让网络学习到类内差异
- 作者提出增加每一类的图片数目,即对CASIA操作,增加每一个人的图片数目的方法
- 在LFW和IJB-A数据集上取得了和百万级人脸数据训练一样好的结果
方法
- Pose: Simulating face image appearances across unseen 3D viewpoints.
- 即通过3d人脸模型数据库合成图像看不见的角度,生成新的角度的人脸
- 首先通过人脸特征点检测(facial landmark detector),获取人脸特征点
- 根据人脸特征点和开放的Basel 3D face set数据库的人脸模板合成3d人脸
- Shape: Producing facial appearances using different 3D generic face shapes.
- 首先,通过Basel 3D face获取10种高质量3d面部扫描数据
- 再将图像数据与不同3d脸型数据结合,生成同一个人不同脸型的图像
- Expression: Specifically, simulating closed mouth expressions.
- 采用中性嘴型将图像中的开口表情换位闭口表情
收获
- 人脸数据库data augmentation的方法
参考
https://arxiv.org/abs/1603.07057
Regressing Robust and Discriminative 3D Morphable Models with a very Deep Neural Network
CVPR 2017
问题
- when applied “in the wild”, their 3D estimates are either unstable and change for different photos of the same subject or they are over-regularized and generic.
- 即当在真实场景中应用3d模拟来增加人脸识别精度,存在两类问题:要么3d模拟不稳定,导致同一个个体的3d模拟差异较大;要么过于泛化,导致大部分合成的图片都类似
方法
本文中,作者提出了一种深度神经网络的方法,该方法可以从随意角度的人脸图片中生成鲁棒的3d人脸模型
- 作者采用了近期发表的多图像3DMM生成方法(M.Piotraschke 2016)
- 首先从CASIA数据集选取500K个图像来估计3DMM参数
- 然后把同一个体不同照片生成的3DMM聚合一起,获取单个个体的3DMM(约10K个体)
- The 3DMM representation
- 采用流行的Basel Face Model (BFM),该模型是开放的目前最好的single view3D模型。对一张脸的生成模型包括两部分:脸型和纹理。
- Single image 3DMM fitting
- 采用了目前最好的人脸特征点检测器(CLNF)来检测人脸特征点和置信度
- 其中,脸部特征点用于在3DMM坐标系中初始化输入人脸的角度
- 然后再对脸型,纹理,角度,光照和色彩进行处理
- Multi image 3DMM fitting
- 多图像3DMM生成通过pool 单个个体不同图片生成的3DMM的脸型和纹理参数来实现
收获
- 通过训练CNN,可以将输入图片转换为3DMM参数,进行3D人脸重建,效果比现有方法好
- 也可以通过生成的3DMM参数为特征,进行人脸识别测试
参考
https://arxiv.org/abs/1612.04904
A Discriminative Feature Learning Approach for Deep Face Recognition
ECCV 2016
问题
- For face recognition task, the deeply learned features need to be not only separable but also discriminative
- the softmax loss only encourage the separability of features. The resulting features are not sufficiently effective for face recognition.
方法
- Softmax loss (如上图第一行):
- L S = − ∑ i = 1 m l o g e W y i T x i + b y i ∑ j = 1 n e W j T x i + b j L_S=-\sum_{i=1}^mlog\frac{e^{W_{y_i}^Tx_i+b_{y_i}}}{\sum_{j=1}^ne^{W_j^Tx_i+b_j}} LS=−∑i=1mlog∑j=1neWjTxi+bjeWyiTxi+byi
- 提出了:Center Loss
- L C = 1 2 ∑ i = 1 m ∣ ∣ x i − c y i ∣ ∣ 2 2 L_C=\frac{1}{2}\sum_{i=1}^m||x_i-c_{y_i}||_2^2 LC=21∑i=1m∣∣xi−cyi∣∣22
- 这个公式就是要类内距离要越小越好
- 总的损失 (如上图第二行):
- L = L S + λ L C = − ∑ i = 1 m l o g e W y i T x i + b y i ∑ j = 1 n e W j T x i + b j + λ 2 ∑ i = 1 m ∣ ∣ x i − c y i ∣ ∣ 2 2 L=L_S+\lambda L_C=-\sum_{i=1}^mlog\frac{e^{W_{y_i}^Tx_i+b_{y_i}}}{\sum_{j=1}^ne^{W_j^Tx_i+b_j}}+\frac{\lambda}{2}\sum_{i=1}^m||x_i-c_{y_i}||_2^2 L=LS+λLC=−∑i=1mlog∑j=1neWjTxi+bjeWyiTxi+byi+2λ∑i=1m∣∣xi−cyi∣∣22
- 具体算法见原文3.2节
收获
- 将Softmax Loss可视化出来后,我们发现特征原来是呈这种放射型分布的,而放射型分布就可以从幅度和角度两个方向来尝试改进分类函数https://www.zhihu.com/question/67919300/answer/304175809
参考
Large-Margin Softmax Loss for Convolutional Neural Networks
ICML 2016
问题
- softmax loss does not explicitly encourage intra-class compactness and inter-class-separability
- 即当前的 Softmax Loss 没有显式的强调 intra-class compactness 和 inter-class-separability。
- 本文是对Softmax Loss 的改进
方法
-
Our key intuition is that the separability between sample and parameter can be factorized into amplitude ones and angular ones with cosine similarity*
-
即把Softmax Loss中的W和x的内积 W c x W_cx Wcx 看成 ∣ ∣ W c ∣ ∣ 2 ∣ ∣ x ∣ ∣ 2 c o s ( θ c ) ||W_c||_2 ||x||_2cos(θ_c ) ∣∣Wc∣∣2∣∣x∣∣2cos(θc)
-
原始的 L i = − l o g e W y i x i ∑ j = 1 n e W j x i L_i=-log\frac{e^{W_{y_i}x_i}}{\sum_{j=1}^ne^{W_jx_i}} Li=−log∑j=1neWjxieWyixi 改成角度表示为 L i = − l o g e ∣ ∣ W y i ∥ ∥ x i ∣ ∣ c o s ( θ y i ) ∑ j e ∣ ∣ W j ∥ ∥ x i ∣ ∣ c o s ( θ j ) L_i=-log\frac{e^{||W_{y_i}\parallel \parallel x_i||cos(θ_{y_i} )}}{\sum_je^{||W_j\parallel \parallel x_i||cos(θ_j )}} Li=−log∑je∣∣Wj∥∥xi∣∣cos(θj)e∣∣Wyi∥∥xi∣∣cos(θyi)
-
对于一个使用 softmax loss 的二分类问题,假定 x 属于类 1,如果我们希望正确分类,则需要满足
- W 1 T x > W 2 T x W_1^Tx>W_2^Tx W1Tx>W2Tx 即 ∣ ∣ W 1 ∥ ∥ x ∣ ∣ c o s ( θ 1 ) > ∣ ∣ W 2 ∥ ∥ x ∣ ∣ c o s ( θ 2 ) ||W_1\parallel \parallel x||cos(θ_1 )>||W_2\parallel \parallel x||cos(θ_2 ) ∣∣W1∥∥x∣∣cos(θ1)>∣∣W2∥∥x∣∣cos(θ2)
-
如果希望分类的判断具有一个大些的 Margin,则需要满足如下
- ∣ ∣ W 1 ∥ ∥ x ∣ ∣ c o s ( θ 1 ) ≥ ∣ ∣ W 1 ∥ ∥ x ∣ ∣ c o s ( m θ 1 ) > ∣ ∣ W 2 ∥ ∥ x ∣ ∣ c o s ( θ 2 ) ||W_1\parallel \parallel x||cos(θ_1 )\geq||W_1\parallel \parallel x||cos(mθ_1 )>||W_2\parallel \parallel x||cos(θ_2 ) ∣∣W1∥∥x∣∣cos(θ1)≥∣∣W1∥∥x∣∣cos(mθ1)>∣∣W2∥∥x∣∣cos(θ2)
-
L-softmax loss的 L i L_i Li式子就可以在原来的softmax loss的 L i L_i Li式子上修改得到:
- L i = − l o g e ∣ ∣ W y i ∥ ∥ x i ∣ ∣ ψ ( θ y i ) e ∣ ∣ W y i ∥ ∥ x i ∣ ∣ ψ ( θ y i ) + ∑ j ≠ y i e ∣ ∣ W y i ∥ ∥ x i ∣ ∣ c o s ( θ y i ) L_i=-log\frac{e^{||W_{y_i}\parallel \parallel x_i||\psi (θ_{y_i} )}}{e^{||W_{y_i}\parallel \parallel x_i||\psi (θ_{y_i} )}+\sum_{j\neq y_i}e^{||W_{y_i}\parallel \parallel x_i||cos(θ_{y_i} )}} Li=−loge∣∣Wyi∥∥xi∣∣ψ(θyi)+∑j̸=yie∣∣Wyi∥∥xi∣∣cos(θyi)e∣∣Wyi∥∥xi∣∣ψ(θyi)
- ψ ( θ ) = c o s ( m θ ) , 0 ≤ θ ≤ π m \psi(θ)=cos(mθ), 0\leqθ\leq\frac{\pi }{m} ψ(θ)=cos(mθ),0≤θ≤mπ
- ψ ( θ ) = D ( θ ) , π m < θ ≤ π \psi(θ)=D(θ),\frac{\pi }{m}<\theta\leq \pi ψ(θ)=D(θ),mπ<θ≤π
收获
- 碰到矩阵乘法时,不能忘了还有角度这个维度
参考
http://proceedings.mlr.press/v48/liud16.pdf
SphereFace: Deep Hypersphere Embedding for Face Recognition
CVPR 2017
问题
- In some sense, Euclidean margin based losses are incompatible with softmax loss, so it is not well motivated to combine these two type of losses.
方法
- we propose to incorporate angular margin instead
- 提出了A-Softmax Loss
- 在L-Softmax Loss基础上增加了两个限定条件
- $||W_1||=||W_2||=1 $
- $b_1 =b_2 =0 $
- 使得预测仅取决于 W W W和 x x x之间的角度
- 在L-Softmax Loss基础上增加了两个限定条件
收获
- 可以从多种距离度量来看待问题
参考