Face Verification vs Face Recognition
Name | Input | Output | Description |
---|---|---|---|
Face Verification | Image and Name / ID | Is the image the person with this given ID? | |
Face Recognition | Image | Is the image one of the K persons? | Has a database of K persons |
One shot Learning
Task
Learn from one example to recognize the person again.
Resolution
Learn “similarity” function
f
f
.
degree of difference between images
X
X
and .
Siamese Network
Parameters of NN define an encoding function from image to vector:
f(X)
f
(
X
)
Learn parameters so that:
1. If
X(i)
X
(
i
)
and
X(j)
X
(
j
)
are the same person,
∥∥f(X(i))−f(X(j))∥∥
‖
f
(
X
(
i
)
)
−
f
(
X
(
j
)
)
‖
is small.
2. Else,
∥∥f(X(i))−f(X(j))∥∥
‖
f
(
X
(
i
)
)
−
f
(
X
(
j
)
)
‖
is large.
Triplet Loss
loss(A,P,N)=max(∥A−P∥2−∥A−N∥2+α,0)
loss
(
A
,
P
,
N
)
=
max
(
‖
A
−
P
‖
2
−
‖
A
−
N
‖
2
+
α
,
0
)
cost=1m∑i=1mloss(A(i),P(i),N(i))
cost
=
1
m
∑
i
=
1
m
loss
(
A
(
i
)
,
P
(
i
)
,
N
(
i
)
)
Choose triplets that hard to train on.
Face Verification and Binay Classification
loss(X,Y)=sigmoid(∑kwk|f(x)k−f(y)k|+b) loss ( X , Y ) = sigmoid ( ∑ k w k | f ( x ) k − f ( y ) k | + b )