Skip to content
Snippets Groups Projects

WIP: Added mtcnn along with dlib.

2 files
+ 142
61
Compare changes
  • Side-by-side
  • Inline

Files

@@ -41,11 +41,41 @@ import random
def test_detect_face_landmarks_in_image():
def test_detect_face_landmarks_in_image_mtcnn():
img = load(datafile('testimage.jpg', 'bob.bio.face.test'))
assert len(img) == 3
annotations = face_detection_utils.detect_face_landmarks_in_image(img, method = 'mtcnn')
assert len(annotations['landmarks']) == 68
assert len(annotations['left_eye']) == 2
assert len(annotations['right_eye']) == 2
assert len(annotations['topleft']) == 2
assert len(annotations['bottomright']) == 2
#assert len(annotations['left_eye']) == (176, 220)
def test_detect_face_landmarks_in_video_mtcnn():
img = load(datafile('testimage.jpg', 'bob.bio.face.test'))
assert len(img) == 3
frame_container= bob.bio.video.FrameContainer()
frame_container.add(1,img)
frame_container.add(2,img)
annotations = face_detection_utils.detect_face_landmarks_in_video(frame_container, method = 'mtcnn')
assert len(annotations) == 2
assert len(annotations['1']['landmarks']) == 68
def test_detect_face_landmarks_in_image_dlib():
img = load(datafile('testimage.jpg', 'bob.bio.face.test'))
assert len(img) == 3
annotations = face_detection_utils.detect_face_landmarks_in_image(img)
annotations = face_detection_utils.detect_face_landmarks_in_image(img, method = 'dlib')
assert len(annotations['landmarks']) == 68
assert len(annotations['left_eye']) == 2
assert len(annotations['right_eye']) == 2
@@ -56,7 +86,7 @@ def test_detect_face_landmarks_in_image():
def test_detect_face_landmarks_in_video():
def test_detect_face_landmarks_in_video_dlib():
img = load(datafile('testimage.jpg', 'bob.bio.face.test'))
assert len(img) == 3
@@ -64,7 +94,7 @@ def test_detect_face_landmarks_in_video():
frame_container.add(1,img)
frame_container.add(2,img)
annotations = face_detection_utils.detect_face_landmarks_in_video(frame_container)
annotations = face_detection_utils.detect_face_landmarks_in_video(frame_container, method = 'dlib')
assert len(annotations) == 2
assert len(annotations['1']['landmarks']) == 68
Loading