Open ck003 opened 6 years ago
Add multiple images of same person in known people folder by adding _1,2 ....n
at end of name.
While adding label in results remove and numbers after _ by using this
name=known_names[i] end=name.find('_') name=name[:end]
can you please give more clarification? @FurqanMehmood
I was interested in the same point. What i did is:
I used a db to quickly map filepath and name Hope it helps
use this tutorial for more details https://www.pyimagesearch.com/2018/06/18/face-recognition-with-opencv-python-and-deep-learning/
@FurqanMehmood Thanks for the link! I haven't tried yet! I will.
If I make the dataset of 1k images of one person. Do you think that might help me to improve accuracy?
@lordcenzin Can you please give some example of how you did implement in code?
I was looking into this myself and found that there is a KNN example in this repo worth checking out
https://github.com/ageitgey/face_recognition/blob/master/examples/face_recognition_knn.py
I was wondering if there was a way to do this with the face_recognition
library. Perhaps loading n images and then averaging the face_encodings
result tensors?
For example, I have 7 photos of Amy. I want to store a (128-scalar) tensor for Amy - not 7 of them. Can I combine them/average them?
So.. this averaging thing seems to work, but could someone provide an educated opinion?
import face_recognition
import numpy as np
# https://face-recognition.readthedocs.io/en/latest/face_recognition.html
a1 = face_recognition.load_image_file('people/amber1.jpg')
a2 = face_recognition.load_image_file('people/amber2.jpg')
a3 = face_recognition.load_image_file('people/amber3.jpg')
a1_encodings = face_recognition.face_encodings(a1)
a2_encodings = face_recognition.face_encodings(a2)
a3_encodings = face_recognition.face_encodings(a3)
# unknown is amber4
unknown_person = face_recognition.load_image_file('people/unknown.jpg')
unknown_encoding = face_recognition.face_encodings(unknown_person)
two_mean_encodings = np.array((a1_encodings[0] + a2_encodings[0])) / 2
three_mean_encodings = np.array(
(a1_encodings[0] + a2_encodings[0] + a3_encodings[0])) / 3
distance = face_recognition.face_distance(a1_encodings, unknown_encoding[0])
distance2 = face_recognition.face_distance(
[two_mean_encodings], unknown_encoding[0])
distance3 = face_recognition.face_distance(
[three_mean_encodings], unknown_encoding[0])
print('one image', distance)
print('two images', distance2)
print('three images', distance3)
results;
one image [0.38789462]
two images [0.35752516]
three images [0.31829679]
So.. this averaging thing seems to work, but could someone provide an educated opinion?
import face_recognition import numpy as np # https://face-recognition.readthedocs.io/en/latest/face_recognition.html a1 = face_recognition.load_image_file('people/amber1.jpg') a2 = face_recognition.load_image_file('people/amber2.jpg') a3 = face_recognition.load_image_file('people/amber3.jpg') a1_encodings = face_recognition.face_encodings(a1) a2_encodings = face_recognition.face_encodings(a2) a3_encodings = face_recognition.face_encodings(a3) # unknown is amber4 unknown_person = face_recognition.load_image_file('people/unknown.jpg') unknown_encoding = face_recognition.face_encodings(unknown_person) two_mean_encodings = np.array((a1_encodings[0] + a2_encodings[0])) / 2 three_mean_encodings = np.array( (a1_encodings[0] + a2_encodings[0] + a3_encodings[0])) / 3 distance = face_recognition.face_distance(a1_encodings, unknown_encoding[0]) distance2 = face_recognition.face_distance( [two_mean_encodings], unknown_encoding[0]) distance3 = face_recognition.face_distance( [three_mean_encodings], unknown_encoding[0]) print('one image', distance) print('two images', distance2) print('three images', distance3)
results; one image [0.38789462] two images [0.35752516] three images [0.31829679]
Hi, did you find a solution for this?
Description
how can i input more picture to improve the accuracy of identification