mirror of
https://github.com/serengil/deepface.git
synced 2025-06-06 19:45:21 +00:00
add unit test to check left eye is on the left with respect to the person instead of observer
This commit is contained in:
parent
ad80a31807
commit
519c48e58d
@ -19,6 +19,12 @@ def test_different_detectors():
|
|||||||
assert "y" in img_obj["facial_area"].keys()
|
assert "y" in img_obj["facial_area"].keys()
|
||||||
assert "w" in img_obj["facial_area"].keys()
|
assert "w" in img_obj["facial_area"].keys()
|
||||||
assert "h" in img_obj["facial_area"].keys()
|
assert "h" in img_obj["facial_area"].keys()
|
||||||
|
# is left eye set with respect to the person instead of observer
|
||||||
|
assert "left_eye" in img_obj["facial_area"].keys()
|
||||||
|
assert "right_eye" in img_obj["facial_area"].keys()
|
||||||
|
right_eye = img_obj["facial_area"]["right_eye"]
|
||||||
|
left_eye = img_obj["facial_area"]["left_eye"]
|
||||||
|
assert left_eye[0] > right_eye[0]
|
||||||
assert "confidence" in img_obj.keys()
|
assert "confidence" in img_obj.keys()
|
||||||
|
|
||||||
img = img_obj["face"]
|
img = img_obj["face"]
|
||||||
|
@ -57,7 +57,7 @@ for df in dfs:
|
|||||||
logger.info(df)
|
logger.info(df)
|
||||||
|
|
||||||
|
|
||||||
expand_areas = [0, 25]
|
expand_areas = [0]
|
||||||
img_paths = ["dataset/img11.jpg", "dataset/img11_reflection.jpg"]
|
img_paths = ["dataset/img11.jpg", "dataset/img11_reflection.jpg"]
|
||||||
for expand_area in expand_areas:
|
for expand_area in expand_areas:
|
||||||
for img_path in img_paths:
|
for img_path in img_paths:
|
||||||
@ -86,6 +86,15 @@ for expand_area in expand_areas:
|
|||||||
assert isinstance(face_obj["facial_area"]["right_eye"][0], int)
|
assert isinstance(face_obj["facial_area"]["right_eye"][0], int)
|
||||||
assert isinstance(face_obj["facial_area"]["right_eye"][1], int)
|
assert isinstance(face_obj["facial_area"]["right_eye"][1], int)
|
||||||
|
|
||||||
|
# left eye is really the left eye of the person
|
||||||
|
if (
|
||||||
|
face_obj["facial_area"]["left_eye"] is not None
|
||||||
|
and face_obj["facial_area"]["right_eye"] is not None
|
||||||
|
):
|
||||||
|
re_x = face_obj["facial_area"]["right_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 isinstance(face_obj["confidence"], float)
|
assert isinstance(face_obj["confidence"], float)
|
||||||
assert face_obj["confidence"] <= 1
|
assert face_obj["confidence"] <= 1
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user