Getting this error when i compare using face_recognition.compare_faces(encoding,person_encoding)
`@shared_task()
def get_encodings_and_compare_with_friends(pk):
photo = Photo.objects.get(pk=pk)
persons = Person.objects.all()
image = face_recognition.load_image_file(photo.image)
encodings = face_recognition.face_encodings(image)
for encoding in encodings:
for person in persons:
person_encoding=np.loads(person.face_encodings)
if face_recognition.compare_faces(encoding,person_encoding):
tag = Tags(photo= photo, tag = person.pk, is_user=True)
tag.save()
return
`
face_recognition.compare_faces([encoding],person_encoding)
hello
i have the same problem
numpy.AxisError: axis2: axis 1 is out of bounds for array of dimension 1
hello
i have the same problem
numpy.AxisError: axis2: axis 1 is out of bounds for array of dimension 1
hi if u see the last comment. it adds [] to encoding on the linewhere he uses .compare_faces
example:
bad one: face_recognition.compare_faces(encoding,person_encoding):
good one: face_recognition.compare_faces([encoding],person_encoding)
NO solution for this
what is the solution then
Most helpful comment
face_recognition.compare_faces([encoding],person_encoding)