During the verification,
if d(img1, img2) then “same”
if d(img1, img2) then “different”
Siamese network is a good way to input two faces and tell how similar or how different they are.
Parameters of NN define an encoding which is 128 dimensions. Learn parameters so that: if and are the same person, is small
We want: for above example.
is added to make sure that the neural network doesn’t just output zero for all the encoding. is also called margin.
Given 3 images A, P, and N,
So if then
and cost will be
If 10K pictures of 1K person, then you classify 10K to A, P, or N for 1K person.
During training, if A,P, and N are chosen randomly, is easily satisfied.
So to train the neural networ, choose triplets that are hard to train on. Choose
Where is 0 or 1
Instead of feeding in two separate encodings, alternatively,
where is the encoding of image the substitute means to just select out the components of this vector.
Another way to obtain 128 numbers is formula
Y. Taigman, M. Yang, M. Ranzato and L. Wolf, (2014). DeepFace: Closing the Gap to Human-Level Performance in Face Verification, 2014 IEEE Conference on Computer Vision and Pattern Recognition, Columbus, OH, pp. 1701-1708. doi: 10.1109/CVPR.2014.220