Spaces:
Runtime error
Runtime error
File size: 843 Bytes
c44d66d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
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
|