Thanks for such a valuable model.
In order to compute distances between two faces, I used 20180402-114759 (vggface2 dataset) model. Then I computed embeddings for each faces based on contributed/export_embeddings.py file. what's the threshold in this pre-trianed network for recognising the same person?
pre-processing step: ( MTCNN face recognition, image size = 160, margin = 32),
dataset = vggface2_test file
Code: facenet/contributed/export_embeddings.py files
embeddings_vggface2 = np.load("embeddings_vggface2.npy")
labels_vggface2 = np.load("labels_vggface2.npy")
labels_strings_vggface2 = np.load("label_strings_vggface2.npy")
euclidean = lambda x, y: np.sum(np.square(x - y))
cosine = lambda x, y: np.sum(x * y)
for i, label in enumerate((labels_vggface2)):
for j in range(i+1,len(labels_vggface2)):
#cosine and euclidean similarity
dist_cosine= cosine(embeddings_vggface2[i,:], embeddings_vggface2[j,:])
dist_euclidean = euclidean(embeddings_vggface2[i,:], embeddings_vggface2[j,:])
print(" distances between {} and {} images are {} and {} . ".format(i, j, dist_cosine,
dist_euclidean))
model trained on vgg is less accurate. Even unknown face will be detected as known face.
Thanks @Zumbalamambo
which model is more accurate?
Do I myself need to find threshold? Or there is a threshold for the more accurate model?
Solution:
I 've used LFW pairs.txt for 10-fold split and compute the distances between same subjects and different subjects. Each fold contains 300 same subject and 300 different subjects.
Then find the threshold based on accuuracy and F1 score.
Threshold = 1.24
I wonder if LFW dataset is a good enough or not!.
I have the same question with you,and I figured out the same way to solve the problem ,but I wonder if this is a good enough way ?
Most helpful comment
model trained on vgg is less accurate. Even unknown face will be detected as known face.