[论文解读] CosFace: Large Margin Cosine Loss for Deep Face Recognition
CosFace 通过对特征和权重进行归一化并添加余弦边界,推出了 Large Margin Cosine Loss (LMCL),在 LFW、YTF 和 MegaFace 基准测试上实现了最先进的结果。
Face recognition has made extraordinary progress owing to the advancement of deep convolutional neural networks (CNNs). The central task of face recognition, including face verification and identification, involves face feature discrimination. However, the traditional softmax loss of deep CNNs usually lacks the power of discrimination. To address this problem, recently several loss functions such as center loss, large margin softmax loss, and angular softmax loss have been proposed. All these improved losses share the same idea: maximizing inter-class variance and minimizing intra-class variance. In this paper, we propose a novel loss function, namely large margin cosine loss (LMCL), to realize this idea from a different perspective. More specifically, we reformulate the softmax loss as a cosine loss by $L_2$ normalizing both features and weight vectors to remove radial variations, based on which a cosine margin term is introduced to further maximize the decision margin in the angular space. As a result, minimum intra-class variance and maximum inter-class variance are achieved by virtue of normalization and cosine decision margin maximization. We refer to our model trained with LMCL as CosFace. Extensive experimental evaluations are conducted on the most popular public-domain face recognition datasets such as MegaFace Challenge, Youtube Faces (YTF) and Labeled Face in the Wild (LFW). We achieve the state-of-the-art performance on these benchmarks, which confirms the effectiveness of our proposed approach.
研究动机与目标
- 动机:解释在传统 softmax 之外,为人脸识别需要更强的判别特征。
- 提出 LMCL,以在余弦空间中最大化类间方差、最小化类内方差。
- 展示同时对特征和权重进行归一化如何在高维球面上创建具有大角度边界的特征分布。
- 证明使用 CosFace 在标准基准(LFW、YTF、Megaface)上达到最先进的性能。
- 提供关于边界参数与归一化对学习动力学影响的理论见解。
提出的方法
- 通过对特征和类别权重向量进行 L2 归一化,将 softmax 重新表述为余弦损失。
- 引入余弦边界 m,在余弦空间中创建大-margin 的决策边界。
- 定义 LMCL 目标:L_lmc = (1/N) sum_i -log( e^{s(cos(theta_{y_i,i})-m)} / ( e^{s(cos(theta_{y_i,i})-m)} + sum_{j≠y_i} e^{s cos(theta_{j,i})} ) ), 其中 W 和 x 归一化并由 s 进行缩放。
- 对特征和权重进行归一化,使特征置于一个超球面上,并使用固定的缩放参数 s(设为 64)。
- 将 LMCL 与 Softmax、Normalized Softmax (NSL) 和 A-Softmax 进行对比,强调在余弦空间中的一致边界以及对扰动的鲁棒性。
- 提供对边界 m 的界限的理论分析,并讨论 LMCL 在超球面特征空间中的几何解释。

实验结果
研究问题
- RQ1与先前提出的角度边界或欧几里得边界相比,LMCL 通过在角空间强制固定的余弦边界是否提高了辨别能力?
- RQ2同时对特征和权重进行归一化对训练动力学和在超球面上形成的特征几何有何影响?
- RQ3相对于最先进的损失函数,LMCL 在标准人脸识别基准(LFW、YTF、MegaFace)上的表现如何?
- RQ4在实际应用中,关于如何选择余弦边界参数 m 和缩放 s,有哪些指导?
主要发现
| 方法 | LFW (Rank1) | YTF (Veri) | MF1 (Rank1) | MF1 (Veri) |
|---|---|---|---|---|
| Softmax Loss | 97.88 | 93.1 | 54.85 | 65.92 |
| Softmax+Contrastive | 98.78 | 93.5 | 65.21 | 78.86 |
| Triplet Loss | 98.70 | 93.4 | 64.79 | 78.32 |
| L-Softmax Loss | 99.10 | 94.0 | 67.12 | 80.42 |
| Softmax+Center Loss | 99.05 | 94.4 | 65.49 | 80.14 |
| A-Softmax | 99.42 | 95.0 | 72.72 | 85.56 |
| A-Softmax-NormFea | 99.32 | 95.4 | 75.42 | 88.82 |
| LMCL (CosFace) | 99.33 | 96.1 | 77.11 | 89.88 |
- 与先前的损失相比,LMCL 在主要基准(LFW、YTF、MegaFace)上通常具有竞争力甚至更优的结果。
- 在特征归一化和固定尺度 s=64 的条件下,LMCL 在所引实验中实现了 LFW 99.33 和 YTF 96.1(使用 CASIA-WebFace)。
- 在报道的比较中,LMCL 在 YTF 和 MegaFace 上的表现超过了带特征归一化的 A-Softmax。
- CosFace 在 LFW 和 YTF 上的结果超越了许多竞争方法,包括单补丁和集成配置,显示出强泛化性。
- 特征归一化显著提升 Megaface 的性能,如所报告的 MF1 分数(Rank1 和 Veri)所示。
- CosFace 在较大基准测试中在 LFW(99.73)和 YTF(97.6)达到 State-of-the-art。

更好的研究,从现在开始
从论文设计到论文写作,大幅缩短您的研究时间。
无需绑定信用卡
本解读由 AI 生成,并经人工编辑审核。