Open ferasawadi opened 3 years ago
You problem definition is much vague though but I will drop a couple of suggestion here.
If you are following the example available here then you need to follow it through the end.
Here encodings are extracted:
# Find encodings for faces in the test iamge
faces_encodings = face_recognition.face_encodings(X_img, known_face_locations=X_face_locations)
This line of code get 1-nn (in your case: 4-nn).
# Use the KNN model to find the best matches for the test face
closest_distances = knn_clf.kneighbors(faces_encodings, n_neighbors=1)
Next, The points below a threshold are being discarded. (Which you are doing in your code)
are_matches = [closest_distances[0][i][0] <= distance_threshold for i in range(len(X_face_locations))]
Now, knn_clf.predict(faces_encodings)
is being called to predict the label of encodings here.
# Predict classes and remove classifications that aren't within the threshold
return [(pred, loc) if rec else ("unknown", loc) for pred, loc, rec in zip(knn_clf.predict(faces_encodings), X_face_locations, are_matches)]
knn_classifier.predict gives the expected label for a given encoding. You can also try knn_classifier.predict_prob() function to get probability estimates for each neighbor.
That's Seems to be awesome @omerasif57 warm regards Feras
Description
after a lot of digging trying to get multiple results for an unknown person am getting the same results for everyone. my dataset is 26 person about 170 images for all of them
What I Did
I would appreciate any help