Answers.Body: <p>The facenet model is just the head of the model. The architecture is similar to the enocdr part of an autoencoder, but it uses supervised learning instead of unsupervised learning. The network is called a siamese network The triplet loss helps make the embeddings more representative of the input image/person, with the embedding distance being as large as possible for difference people and vice versa. </p>
  
  <p>However the embeddings is just the representation of the people. It doesn't contain information directly mapping to what person it is. The classification head is used after the Face Net feature extraction top is used.</p>
  
  <h1>One-shot learning method for person classfication</h1>
  
  <p>This method saves the calculated embeddings of people in a database. The face recognition system first calculates the embeddings of the new, unknown image to be classified. The system loop through the embeddings database and calculates the Euclidean distance of the unknown embeddings and the embeddings in the database. </p>
  
  <p>After computing, it chooses the smallest distance of all and compares it to a threshold set by you. If the distance is larger than the threshold, the classified class is <code>unknown</code> , or else the resulting class will be the embeddings which results to the lowest distance.</p>
  
  <p>Example code from the deeplearning.ai coursera course (great course on AI btw):
  <a href="https://github.com/enggen/Deep-Learning-Coursera/blob/master/Convolutional%20Neural%20Networks/Week4/Face%20Recognition/Face%20Recognition%20for%20the%20Happy%20House%20-%20v2.ipynb" rel="nofollow noreferrer">Example code of one shot face recognition</a></p>
  
  <h2>Advantages and disadvantages of the system</h2>
  
  <p>The system have advantages ranging from no training needed and can classify <code>unknown</code> class. However, once the number of people in the database becomes huge, the system will run slower. It's performance may also differ depending on the quality of the reference image.</p>
  
  <h1>SVM (Support Vector Machine) method</h1>
  
  <p>This is the method used in the github repository of your previous posts. It uses a one layer nn classifying head to output the classified class.</p>
  
  <h2>Advantages and disadvantages of the system</h2>
  
  <p>The system have the flexibility of adapting to multiple photo environment and no affecting of performance due to reference images. This method also works well for larger database of people. Triplet loss can also be removed using this method. You can train the network directly from propagating the loss with the probability predicted. However, This method requires re-training when a new person is added to the system. Multiple images of a person is also needed.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-12T16:28:27.317Z
Answers.Text: Just one more doubt , SVM classifies (0 or 1) but does not returns probability but method used in GitHub repository returns probability ?
Answers.UserDisplayName: TheReal__Mike
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-12T16:29:08.343Z
Answers.Text: can SVM return probability also ?
Answers.UserDisplayName: TheReal__Mike
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-12T16:52:05.290Z
Answers.Text: Can you tell what method that repository uses to convert classification to probability  ?
Answers.UserDisplayName: TheReal__Mike
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-12T16:55:56.743Z
Answers.Text: Also what is relation between SVM and triplet Loss ?
Answers.UserDisplayName: TheReal__Mike
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-13T00:48:31.590Z
Answers.Text: For the first question, the SVM return a confidence value from 0 to 1, with 1 being most confidence and 0 being not. It does not return an integer value. The probability of the repository is the probability of the most confidence class.
Answers.UserDisplayName: Clement
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-13T00:49:15.300Z
Answers.Text: The SVM is using the features previously trained using triplet loss on the feature extraction model. @Mike hope I answer your question
Answers.UserDisplayName: Clement
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-11-11T14:42:57.950Z
Answers.LastActivityDate: 2019-11-11T14:42:57.950Z
Answers.UserDisplayName: Clement
Body: <p>This question is related to <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> . I know how loss is calculated in the FaceNet model , but how the loss function is used to calculate probability that this unknown person is , say Bob (0.70). Also  we don't know which is positive or negative image , we only know the Anchor (so how FaceNet finds which image is positive or negative ?) . How probability is calculated in FaceNet Model using triplet loss ?</p>
  
  <p>Can we know what is the exact formula or CNN is like black box which uses some unknown method to calculate probability  ?</p>
  
Tags: <neural-networks><objective-functions><facial-recognition>
Title: How is the percentage or the probablity calculated using Loss function in Facenet Model?
UserDisplayName: TheReal__Mike
ThreadText: # How is the percentage or the probablity calculated using Loss function in Facenet Model?
  
  (Asked by: username_0 on 2019-11-11)
  
  This question is related to [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) . I know how loss is calculated in the FaceNet model , but how the loss function is used to calculate probability that this unknown person is , say Bob (0.70). Also we don't know which is positive or negative image , we only know the Anchor (so how FaceNet finds which image is positive or negative ?) . How probability is calculated in FaceNet Model using triplet loss ?
  
  Can we know what is the exact formula or CNN is like black box which uses some unknown method to calculate probability ?
  
  **Tags:** neural-networks, objective-functions, facial-recognition
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-11-11. Score: 1 | Accepted answer
  
  The facenet model is just the head of the model. The architecture is similar to the enocdr part of an autoencoder, but it uses supervised learning instead of unsupervised learning. The network is called a siamese network The triplet loss helps make the embeddings more representative of the input image/person, with the embedding distance being as large as possible for difference people and vice versa.
  
  However the embeddings is just the representation of the people. It doesn't contain information directly mapping to what person it is. The classification head is used after the Face Net feature extraction top is used.
  
  # One-shot learning method for person classfication
  
  This method saves the calculated embeddings of people in a database. The face recognition system first calculates the embeddings of the new, unknown image to be classified. The system loop through the embeddings database and calculates the Euclidean distance of the unknown embeddings and the embeddings in the database.
  
  After computing, it chooses the smallest distance of all and compares it to a threshold set by you. If the distance is larger than the threshold, the classified class is `unknown` , or else the resulting class will be the embeddings which results to the lowest distance.
  
  Example code from the deeplearning.ai coursera course (great course on AI btw):
  [Example code of one shot face recognition](https://github.com/enggen/Deep-Learning-Coursera/blob/master/Convolutional%20Neural%20Networks/Week4/Face%20Recognition/Face%20Recognition%20for%20the%20Happy%20House%20-%20v2.ipynb)
  
  ## Advantages and disadvantages of the system
  
  The system have advantages ranging from no training needed and can classify `unknown` class. However, once the number of people in the database becomes huge, the system will run slower. It's performance may also differ depending on the quality of the reference image.
  
  # SVM (Support Vector Machine) method
  
  This is the method used in the github repository of your previous posts. It uses a one layer nn classifying head to output the classified class.
  
  ## Advantages and disadvantages of the system
  
  The system have the flexibility of adapting to multiple photo environment and no affecting of performance due to reference images. This method also works well for larger database of people. Triplet loss can also be removed using this method. You can train the network directly from propagating the loss with the probability predicted. However, This method requires re-training when a new person is added to the system. Multiple images of a person is also needed.
  
  > **Comments:**
  > **username_0**: Just one more doubt , SVM classifies (0 or 1) but does not returns probability but method used in GitHub repository returns probability ?  
  > **username_0**: can SVM return probability also ?  
  > **username_0**: Can you tell what method that repository uses to convert classification to probability  ?  
  > **username_0**: Also what is relation between SVM and triplet Loss ?  
  > **username_1**: For the first question, the SVM return a confidence value from 0 to 1, with 1 being most confidence and 0 being not. It does not return an integer value. The probability of the repository is the probability of the most confidence class.  
  > **username_1**: The SVM is using the features previously trained using triplet loss on the feature extraction model. @Mike hope I answer your question  
  
  ---
  
  