Commit fda0ad1a authored by Olegs NIKISINS's avatar Olegs NIKISINS
Browse files

Merge branch 'reye' into 'master'

Use our common right eye and left eye names instead

See merge request !58
parents 1567ca3f 18d5300c
Pipeline #17509 passed with stages
in 26 minutes and 57 seconds
...@@ -32,10 +32,10 @@ def get_eye_pos(lm): ...@@ -32,10 +32,10 @@ def get_eye_pos(lm):
**Returns:** **Returns:**
``right_eye`` ``reye``
A tuple containing the location of right eye, A tuple containing the location of right eye,
``left_eye`` ``leye``
A tuple containing the location of left eye A tuple containing the location of left eye
""" """
...@@ -71,7 +71,7 @@ def detect_face_landmarks_in_image(image, method="dlib"): ...@@ -71,7 +71,7 @@ def detect_face_landmarks_in_image(image, method="dlib"):
``annotations`` : :py:class:`dict` ``annotations`` : :py:class:`dict`
A dictionary containing annotations of the face bounding box, eye locations and facial landmarks. A dictionary containing annotations of the face bounding box, eye locations and facial landmarks.
Dictionary must be as follows ``{'topleft': (row, col), 'bottomright': (row, col), 'left_eye': (row, col), 'right_eye': (row, col), 'landmarks': [(col1,row1), (col2,row2), ...]}``. Dictionary must be as follows ``{'topleft': (row, col), 'bottomright': (row, col), 'leye': (row, col), 'reye': (row, col), 'landmarks': [(col1,row1), (col2,row2), ...]}``.
If no annotations found an empty dictionary is returned. If no annotations found an empty dictionary is returned.
Where (rowK,colK) is the location of Kth facial landmark (K=0,...,67). Where (rowK,colK) is the location of Kth facial landmark (K=0,...,67).
""" """
...@@ -147,9 +147,9 @@ def detect_face_landmarks_in_image(image, method="dlib"): ...@@ -147,9 +147,9 @@ def detect_face_landmarks_in_image(image, method="dlib"):
annotations['landmarks'] = points annotations['landmarks'] = points
annotations['left_eye'] = left_eye annotations['leye'] = left_eye
annotations['right_eye'] = right_eye annotations['reye'] = right_eye
return annotations return annotations
...@@ -174,7 +174,7 @@ def normalize_image_size_in_grayscale(image, annotations, ...@@ -174,7 +174,7 @@ def normalize_image_size_in_grayscale(image, annotations,
A dictionary containing annotations of the face bounding box, A dictionary containing annotations of the face bounding box,
eye locations and facial landmarks. eye locations and facial landmarks.
Dictionary must be as follows: ``{'topleft': (row, col), 'bottomright': (row, col), Dictionary must be as follows: ``{'topleft': (row, col), 'bottomright': (row, col),
'left_eye': (row, col), 'right_eye': (row, col)}``. 'leye': (row, col), 'reye': (row, col)}``.
``face_size`` : :py:class:`int` ``face_size`` : :py:class:`int`
The size of the face after normalization. The size of the face after normalization.
...@@ -198,7 +198,7 @@ def normalize_image_size_in_grayscale(image, annotations, ...@@ -198,7 +198,7 @@ def normalize_image_size_in_grayscale(image, annotations,
crop_size=(face_size, face_size), crop_size=(face_size, face_size),
eyes_center=(face_size / 4., (face_size - 0.5) / 2.)) eyes_center=(face_size / 4., (face_size - 0.5) / 2.))
right_eye, left_eye = annotations['right_eye'], annotations['left_eye'] right_eye, left_eye = annotations['reye'], annotations['leye']
normalized_image = face_eyes_norm( image, right_eye = right_eye, left_eye = left_eye ) normalized_image = face_eyes_norm( image, right_eye = right_eye, left_eye = left_eye )
...@@ -240,7 +240,7 @@ def normalize_image_size(image, annotations, face_size, ...@@ -240,7 +240,7 @@ def normalize_image_size(image, annotations, face_size,
A dictionary containing annotations of the face bounding box, A dictionary containing annotations of the face bounding box,
eye locations and facial landmarks. eye locations and facial landmarks.
Dictionary must be as follows: ``{'topleft': (row, col), 'bottomright': (row, col), Dictionary must be as follows: ``{'topleft': (row, col), 'bottomright': (row, col),
'left_eye': (row, col), 'right_eye': (row, col)}``. 'leye': (row, col), 'reye': (row, col)}``.
``face_size`` : :py:class:`int` ``face_size`` : :py:class:`int`
The size of the face after normalization. The size of the face after normalization.
......
...@@ -42,12 +42,12 @@ def test_detect_face_landmarks_in_image_mtcnn(): ...@@ -42,12 +42,12 @@ def test_detect_face_landmarks_in_image_mtcnn():
annotations = detect_face_landmarks_in_image( annotations = detect_face_landmarks_in_image(
img, method='mtcnn') img, method='mtcnn')
assert len(annotations['landmarks']) == 68 assert len(annotations['landmarks']) == 68
assert len(annotations['left_eye']) == 2 assert len(annotations['leye']) == 2
assert len(annotations['right_eye']) == 2 assert len(annotations['reye']) == 2
assert len(annotations['topleft']) == 2 assert len(annotations['topleft']) == 2
assert len(annotations['bottomright']) == 2 assert len(annotations['bottomright']) == 2
#assert len(annotations['left_eye']) == (176, 220) #assert len(annotations['leye']) == (176, 220)
def test_detect_face_landmarks_in_image_dlib(): def test_detect_face_landmarks_in_image_dlib():
...@@ -57,12 +57,12 @@ def test_detect_face_landmarks_in_image_dlib(): ...@@ -57,12 +57,12 @@ def test_detect_face_landmarks_in_image_dlib():
annotations = detect_face_landmarks_in_image( annotations = detect_face_landmarks_in_image(
img, method='dlib') img, method='dlib')
assert len(annotations['landmarks']) == 68 assert len(annotations['landmarks']) == 68
assert len(annotations['left_eye']) == 2 assert len(annotations['leye']) == 2
assert len(annotations['right_eye']) == 2 assert len(annotations['reye']) == 2
assert len(annotations['topleft']) == 2 assert len(annotations['topleft']) == 2
assert len(annotations['bottomright']) == 2 assert len(annotations['bottomright']) == 2
#assert len(annotations['left_eye']) == (176, 220) #assert len(annotations['leye']) == (176, 220)
#============================================================================== #==============================================================================
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment