|
from deepface import DeepFace |
|
|
|
DISTANCE_METRIC = "cosine" |
|
MODEL_NAME = 'ArcFace' |
|
DETECTOR_BACKEND = "opencv" |
|
|
|
|
|
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 |
|
|
|
|
|
|