Spaces:
Runtime error
Runtime error
from deepface import DeepFace | |
DISTANCE_METRIC = "cosine" # cosine, euclidean, euclidean_l2 | |
MODEL_NAME = 'ArcFace' # VGG-Face, Facenet, OpenFace, DeepFace, DeepID, Dlib, ArcFace or Ensemble | |
DETECTOR_BACKEND = "opencv" # Retinaface, mtcnn, opencv, ssd or dlib | |
def face_verfication(image_array): | |
""" | |
Checking user's face image with user face history images | |
If one check is True -> True | |
""" | |
result = False | |
verifications = DeepFace.verify(img1_path=image_array, | |
model_name=MODEL_NAME, | |
distance_metric=DISTANCE_METRIC, | |
detector_backend=DETECTOR_BACKEND) | |
for k, verification in verifications.items(): | |
if verification["verified"]: | |
result = True | |
break | |
return result | |