deepface/api/service.py
Sefik Ilkin Serengil 0d2b94679a api via gunicorn
2023-02-01 18:38:00 +00:00

43 lines
1.1 KiB
Python

from deepface import DeepFace
def represent(img_path, model_name, detector_backend, enforce_detection, align):
result = {}
embedding_objs = DeepFace.represent(
img_path=img_path,
model_name=model_name,
detector_backend=detector_backend,
enforce_detection=enforce_detection,
align=align,
)
result["results"] = embedding_objs
return result
def verify(
img1_path, img2_path, model_name, detector_backend, distance_metric, enforce_detection, align
):
obj = DeepFace.verify(
img1_path=img1_path,
img2_path=img2_path,
model_name=model_name,
detector_backend=detector_backend,
distance_metric=distance_metric,
align=align,
enforce_detection=enforce_detection,
)
return obj
def analyze(img_path, actions, detector_backend, enforce_detection, align):
result = {}
demographies = DeepFace.analyze(
img_path=img_path,
actions=actions,
detector_backend=detector_backend,
enforce_detection=enforce_detection,
align=align,
)
result["results"] = demographies
return result