unit test extended for centerface

This commit is contained in:
Sefik Ilkin Serengil 2024-04-12 14:49:07 +01:00
parent 6b3a4eff22
commit 4577b43051

View File

@ -34,9 +34,10 @@ detector_backends = [
"retinaface", "retinaface",
"yunet", "yunet",
"yolov8", "yolov8",
"centerface",
] ]
"""
# verification # verification
for model_name in model_names: for model_name in model_names:
obj = DeepFace.verify( obj = DeepFace.verify(
@ -59,7 +60,7 @@ dfs = DeepFace.find(
) )
for df in dfs: for df in dfs:
logger.info(df) logger.info(df)
"""
expand_areas = [0] expand_areas = [0]
img_paths = ["dataset/img11.jpg", "dataset/img11_reflection.jpg"] img_paths = ["dataset/img11.jpg", "dataset/img11_reflection.jpg"]
@ -75,7 +76,7 @@ for expand_area in expand_areas:
) )
for face_obj in face_objs: for face_obj in face_objs:
face = face_obj["face"] face = face_obj["face"]
logger.info(detector_backend) logger.info(f"testing {img_path} with {detector_backend}")
logger.info(face_obj["facial_area"]) logger.info(face_obj["facial_area"])
logger.info(face_obj["confidence"]) logger.info(face_obj["confidence"])
@ -99,7 +100,10 @@ for expand_area in expand_areas:
le_x = face_obj["facial_area"]["left_eye"][0] le_x = face_obj["facial_area"]["left_eye"][0]
assert re_x < le_x, "right eye must be the right eye of the person" assert re_x < le_x, "right eye must be the right eye of the person"
assert isinstance(face_obj["confidence"], float) type_conf = type(face_obj["confidence"])
assert isinstance(
face_obj["confidence"], float
), f"confidence type must be float but it is {type_conf}"
assert face_obj["confidence"] <= 1 assert face_obj["confidence"] <= 1
plt.imshow(face) plt.imshow(face)