Answers.Body: <p>Facenet is a Siamese network. It's basic architecture is this:
  <img src="https://i.sstatic.net/BkWbf.png" alt="enter image description here">
  The input(a face) is fed through a deep convolutional neural network and also a fully connected layer at the end. The fully connected layer at the end output an embedding of the input image which is a predefined size. The embedding can contain feature that human understand or maybe not. The embedding represent the input image, just in a "compressed" form. </p>
  
  <p>To further explain that, let me give an example. Let's say that you have to describe a face. What's will you say? You will probably say something like the face is round, the eyes are blue, it is a female face and more. The neural network is doing what you are doing, describing the face, but using numbers instead of words. </p>
  
  <p>To do a face recognition task, the network take an pre taken image of the list of people to recognize and the unknown new data from the people to be recognised. It then feed both images into the network and get the embeddings. The network then calculate the distance of the two embeddings, using some metric such as squared error or absolute error. In the image it uses the squared error. If the error is below a certain threshold, the face is recognised. If not, it then loops through the other pre taken images in the set of faces of the system and do the task again. The system stores embedding of the pre taken images before hand. </p>
  
  <p>For training the FaceNet, triplet loss is used. Triplet loss has been explained in another of your post, by me. <a href="https://ai.stackexchange.com/questions/16311/what-is-the-formula-used-to-calculate-the-accuracy-in-the-facenet-model">What is the formula used to calculate the accuracy in the FaceNet model?</a></p>
  
  <p>Basically, the model is trained using the triplet loss as it can train the network to output a similar embedding for the same person and a very different embedded for a different person. </p>
  
  <p>Sometimes, a binary classification end is also used. It removed the need of the triplet loss and outputs a number from 0 to 1 for similarity instead. This removes the triplet loss part.</p>
  
  <p>Hope my answer can help you and have a nice day!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-03-03T16:47:15.613Z
Answers.Text: Can you answer this question about FaceNet? https://ai.stackexchange.com/questions/39406/how-does-facenet-or-similar-bootstrap-new-faces
Answers.UserDisplayName: Mastiff
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-09T11:49:24.393Z
Answers.LastActivityDate: 2019-11-09T11:49:24.393Z
Answers.UserDisplayName: Clement
Body: <p>Can some one explain how <a href="https://github.com/davidsandberg/facenet" rel="nofollow noreferrer">Facenet</a> model works in detail and simple words .</p>
  
Tags: <neural-networks><deep-learning><facial-recognition>
Title: Detailed explaination of Facenet Model for face recogniton?
UserDisplayName: TheReal__Mike
ThreadText: # Detailed explaination of Facenet Model for face recogniton?
  
  (Asked by: username_0 on 2019-11-08)
  
  Can some one explain how [Facenet](https://github.com/davidsandberg/facenet) model works in detail and simple words .
  
  **Tags:** neural-networks, deep-learning, facial-recognition
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-11-09. Score: 2 | Accepted answer
  
  Facenet is a Siamese network. It's basic architecture is this:
  ![enter image description here](https://i.sstatic.net/BkWbf.png)
  The input(a face) is fed through a deep convolutional neural network and also a fully connected layer at the end. The fully connected layer at the end output an embedding of the input image which is a predefined size. The embedding can contain feature that human understand or maybe not. The embedding represent the input image, just in a "compressed" form.
  
  To further explain that, let me give an example. Let's say that you have to describe a face. What's will you say? You will probably say something like the face is round, the eyes are blue, it is a female face and more. The neural network is doing what you are doing, describing the face, but using numbers instead of words.
  
  To do a face recognition task, the network take an pre taken image of the list of people to recognize and the unknown new data from the people to be recognised. It then feed both images into the network and get the embeddings. The network then calculate the distance of the two embeddings, using some metric such as squared error or absolute error. In the image it uses the squared error. If the error is below a certain threshold, the face is recognised. If not, it then loops through the other pre taken images in the set of faces of the system and do the task again. The system stores embedding of the pre taken images before hand.
  
  For training the FaceNet, triplet loss is used. Triplet loss has been explained in another of your post, by me. [What is the formula used to calculate the accuracy in the FaceNet model?](https://ai.stackexchange.com/questions/16311/what-is-the-formula-used-to-calculate-the-accuracy-in-the-facenet-model)
  
  Basically, the model is trained using the triplet loss as it can train the network to output a similar embedding for the same person and a very different embedded for a different person.
  
  Sometimes, a binary classification end is also used. It removed the need of the triplet loss and outputs a number from 0 to 1 for similarity instead. This removes the triplet loss part.
  
  Hope my answer can help you and have a nice day!
  
  > **Comments:**
  > **username_2**: Can you answer this question about FaceNet? https://ai.stackexchange.com/questions/39406/how-does-facenet-or-similar-bootstrap-new-faces  
  
  ---
  
  