@article{wang2018cosface:,
title={CosFace: Large Margin Cosine Loss for Deep Face Recognition},
author={Wang, Hao and Wang, Yitong and Zhou, Zheng and Ji, Xing and Gong, Dihong and Zhou, Jingchao and Li, Zhifeng and Liu, Wei},
pages={5265–5274},
year={2018}}
概
本文从angular margin角度提出了对交叉熵损失的一个改进.
主要内容
一般的softmax交叉熵损失为
L
s
=
1
N
∑
i
=
1
N
−
log
e
f
y
i
∑
j
=
1
C
e
f
y
j
,
L_s = \frac{1}{N}\sum_{i=1}^N -\log \frac{e^{f_{y_i}}}{\sum_{j=1}^C e^{f_{y_j}}},
Ls=N1i=1∑N−log∑j=1Cefyjefyi,
其中
f
j
=
W
j
T
x
=
∥
W
j
∥
∥
x
∥
cos
θ
j
,
f_j = W^T_jx=\|W_j\| \|x\| \cos \theta_j,
fj=WjTx=∥Wj∥∥x∥cosθj,
固定
∥
W
j
∥
=
1
,
∥
x
∥
=
s
\|W_j\|=1, \|x\|=s
∥Wj∥=1,∥x∥=s, 则
L
n
s
=
1
N
∑
i
−
log
e
s
cos
(
θ
y
i
,
i
)
∑
j
e
s
cos
(
θ
y
j
,
i
)
L_{ns} = \frac{1}{N} \sum_i -\log \frac{e^{s\cos(\theta_{y_i},i)}}{\sum_j e^{s \cos(\theta_{y_j}, i)}}
Lns=N1i∑−log∑jescos(θyj,i)escos(θyi,i)
只与角度angular margin有关, 所以实际上, 一个类别属于
i
i
i就是当
cos
θ
i
>
cos
θ
j
,
∀
j
≠
i
,
\cos \theta_i > \cos \theta_j, \forall j\not = i,
cosθi>cosθj,∀j=i,
为了给其增加一些难度, 我们可以
cos
θ
i
−
m
>
cos
θ
j
,
∀
j
≠
i
,
\cos \theta_i - m > \cos \theta_j, \forall j\not = i,
cosθi−m>cosθj,∀j=i,
即我们在
cos
θ
i
>
cos
θ
j
\cos \theta_i > \cos \theta_j
cosθi>cosθj的基础上, 进一步要求其angular margin进一步提高, 这就是large angular margin的思想.
于是本文的损失为: