Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ModelZoo
arcface_pytorch
Commits
acfcfdd7
Commit
acfcfdd7
authored
May 31, 2024
by
dongchy920
Browse files
Update README.md
parent
6c0b8381
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
7 deletions
+3
-7
README.md
README.md
+3
-7
No files found.
README.md
View file @
acfcfdd7
...
...
@@ -10,13 +10,9 @@
## 算法原理
通过训练深度卷积神经网络嵌入 (DCNN Embedding) 来进行人脸识别。
ArcFace训练流程:
设类别数(人脸ID数量)为 $n$,DCNN的最后一个FC 层的权重为$W
\s
ubset {
\m
athbb{R}}^{d
\t
imes n}$,输入$W$的特征$x_i$的维度为$d$。
1、分别归一化输入特征$x_i
\s
ubset {
\m
athbb{R}}^{b}$和FC层权重$W_j
\i
n {
\m
athbb{R}}^{1
\t
imes b}$(张量除以欧几里得范数标量),令所得归一化特征$
\f
rac{x_i}{
\|
x_i
\|
}$与第$j
\i
n {1,2,...,y_i,...,n}$个类别的FC层权重$
\f
rac{{W_j}^T}{
\|
W_j
\|
}
\i
n {
\m
athbb{R}}^{1
\t
imes d}$点乘得到FC层的第$j$个输出$cos
\t
heta_j
\i
n {
\m
athbb{R}}^{1
\t
imes1}$(数量积公式:${W_j}^{T}
\c
dot x_i=
\|
W_j
\|\|
x_i
\|
cos
\t
heta_j$),表示
**将特征$x_i$预测为第$j$类的预测值**
。
2、设特征$x_i$的真实类别为第$y_j$个类别,单独取出Target权重$
\f
rac{{W_{y_j}}^T}{
\|
W_{y_i}
\|
}$计算$
\t
heta_{y_i}=arccos(cos
\t
heta_{y_i})=arccos(
\f
rac{{W_{y_j}}^T}{
\|
W_{y_i}
\|
}
\c
dot
\f
rac{x_i}{
\|
x_i
\|
})$可得归一化特征$
\f
rac{x_i}{
\|
x_i
\|
}$与归一化
**target权重**
$
\f
rac{{W_{y_j}}^T}{
\|
W_{y_i}
\|
}$之间的夹角——
**Target角度$\theta_{y_i}$**
3、通过把一个自定义的
**加性角度边距 (additive angular margin)**
$m$加到$
\t
heta_{y_i}$,得到$
\t
heta_{y_i}+m$,用于
**调整Target角度**
。
4、计算经调整的Target角度的余弦,得到仅关于特征$x_i$的真实类别$y_i$的
**新Target Logit $cos(\theta_{y_i}+m)$**
。
5、通过自定义的特征范数$s$重缩放所有Logit(除Target Logit变为$cos(
\t
heta_{y_i}+m)$)外其余原Logit仍为$cos
\t
heta_j$,矩阵运算时需用相当于 0/1 mask的one-hot labels区分)得到新 Logit $s∗cos
\t
heta_j, j
\i
n{1,2,..,y_i,..,n}$。
6、对上述过程得到的
**新Logit**
按通常方式计算Softmax Loss。
<div
align=
center
>
<img
src=
"yuanli.png"
/>
</div>
<div
align=
center
>
<img
src=
"./docs/train.jpg"
/>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment