# How does FaceNet (Google's facerecognition) handles a new image?

I am currently researching in the facerecognition field.

And I can not understand how the facenet algorithm handels a new image

They use an euclidean space for image representation. Which means that the elements in this space represent the images (faces). To create this space they use triplet's of images (1 Anchor, 1 Image of the same person (ancher) and a foreign image). These triplets are generated via a data-mining method.

In the end result images of the same person are close together and seperated via a margin. Which means that all images outside this margin belong to a foreign person. So similarity is measured by distance.

If we now want to recognize or verify a new image/face, what exactly is done?

It seems we will need again triplets, so a single image is not even possible? And what happens then? This triplet must be compared somehow again to all existing triplets to find a place for this new image in the euclidean space? If it is whithin a margin that this new image got verified, otherwise its unkown?

• The basic idea is to compute the feature vector for your image as provided by the prediction function of the neural net. If you have similar information for a reference set of images, just find the image(s) in that reference set that are closest to your image regarding these features (nearest neighbour). Commented Oct 21, 2016 at 5:50
• without reading the paper, wouldn't recognition just be, compute similarity measure and if it's further away than the margin then it's a foreign image? Is there anything wrong with that solution? Commented May 26, 2019 at 20:16

• @Roman no, after the network is trained, we can feed any image $x$ to the network and get the output of the L2 layer $v$ as its feature vector. so in order to compare the similarity of two images $x_1$ and $x_2$ we can just compare $v_1$ and $v_2$. we don't need the triplet layer anymore after it is trained. Commented Oct 25, 2016 at 10:22