Understanding FaceNet

来源:互联网 发布:联通云数据待遇怎么样 编辑:程序博客网 时间:2024/05/16 03:15
FaceNet: A Unified Embedding for Face Recognition and Clustering
From Google
arXiv:1503.03832v3 [cs.CV] 17 Jun 2015

本文提出一个叫FaceNet的系统,可以直接学习从face images 到 a compact Euclidean space的映射,使得在space中 squared L2 distances 可以直接对应face similarity的度量。在映射到这个Euclidean space之后,tasks such as face recognition, verification and clustering就变得很直接了。

FaceNet使用LMNN中的triplet loss 来直接训练得到128维的output。 这里的tripelts 有两张匹配的(同一人的)人脸图和一张不匹配的人脸图租成,, 构造的loss 在于将positive pair 和negative分开并保持一定的distance margin. 那么选择使用哪些triplets对取得好的效果的就变得尤其重要,受到curriculum learning的启发,本文提出一种新的online negative exemplar mining strategy。


Triplet loss


如图所示,其中f为每张图像在Euclidean space的表示。文中希望对于每张图片xa, 它与所有同类的图片xp的距离都比不同累的距离更近。
由此,Triplet loss可表示为

在所有可能的triplets中,有很多是很容易满足上述约束的,这些triplets对训练既没有贡献,又会减缓收敛。因此,选择hard triplets很重要。

Triplet Selection
为了能够快速收敛,选择违反triplet constraint (1) 的triplets是至关重要的。因此对于xa, 我们要选择那些最不满足约束的,即
hard positive:
        
hard negative:
        
在整个训练集中计算argmin and argmax是不可行的,此外,一些错标的和糟糕的人脸图片会主导the hard positives and negatives,导致pool training。
两种避免该问题的选择:
1,用最近的network checkpoint, 每n steps ,从子数据集中离线计算argmin and argmax
2,在线生成。从mini-batch中选择hard positive/negative exemplars
本文采用第二种,在线生成,使用包含几千个exemplars的大mini-batch,确保每类identity都有少量exemplers包含在mini-batch中。
本文使用所有的anchor-positive pairs来代替hard positive,而同时还是使用hard negative .
本文也尝试将在线和离线方法结合来生成triplets,能够允许samller batch sizes, 但是实验结果不确定。
选择hard negative在实际中会导致bad local minima, 甚至会导致a collapsed model (i.e. f(x) = 0). 为了缓解该问题,以下面的方式选择xn:

文中称这些negative exemplars 为semi-hard。Those negatives lie inside the margin  .
正如前面所述,correct triplet selection 对于快速收敛是至关重要的。一方面,小的batch size 会improve convergece. 另一方面, implementation details make batches of tens to hundreds of exemplars more efficient。在大多的实验中,我们使用1800左右的batch size。

Deep Convolutional Networks
用了两个ConvNet,一个是Inception, 另一个不清楚,具体看论文吧。
实验和其他就不细说了。


0 0