Skip to content

Commit

Permalink
resolving issue 1099
Browse files Browse the repository at this point in the history
  • Loading branch information
serengil committed Mar 11, 2024
1 parent 9705e6f commit ec4c3cd
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions deepface/detectors/YuNet.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,12 +100,9 @@ def detect_faces(self, img: np.ndarray) -> List[FacialAreaRegion]:
left eye, nose tip, the right corner and left corner of the mouth respectively.
"""
(x, y, w, h, x_re, y_re, x_le, y_le) = list(map(int, face[:8]))
left_eye = (x_re, y_re)
right_eye = (x_le, y_le)

# Yunet returns negative coordinates if it thinks part of
# the detected face is outside the frame.
# We set the coordinate to 0 if they are negative.
# YuNet returns negative coordinates if it thinks part of the detected face
# is outside the frame.
x = max(x, 0)
y = max(y, 0)
if resized:
Expand All @@ -124,8 +121,8 @@ def detect_faces(self, img: np.ndarray) -> List[FacialAreaRegion]:
w=w,
h=h,
confidence=confidence,
left_eye=left_eye,
right_eye=right_eye,
left_eye=(x_re, y_re),
right_eye=(x_le, y_le),
)
resp.append(facial_area)
return resp

0 comments on commit ec4c3cd

Please sign in to comment.