just in case, if location or encoding is null when GenFace is run then return None, and catch this in person and show error on GUI -- for now uploading from a phone does odd things to the image format and fails to work in face_recognition.load_image()

This commit is contained in:
2022-07-10 16:22:35 +10:00
parent 6b7694f382
commit 9f2ecb1901
3 changed files with 10 additions and 2 deletions

View File

@@ -141,7 +141,7 @@ def GenFace(fname, model):
img = face_recognition.load_image_file(fname)
location = face_recognition.face_locations(img, model=model)
encodings = face_recognition.face_encodings(img, known_face_locations=location)
if len(encodings):
if len(encodings) and len(location):
return encodings[0].tobytes(), location[0]
else:
return None, None