Skip to content
Snippets Groups Projects
Commit adc8d4a7 authored by Olegs NIKISINS's avatar Olegs NIKISINS
Browse files

Fixed the unit test to match the latets updates in bob.ip.dlib

parent 4d4bcdfc
No related branches found
No related tags found
1 merge request!21Added a face detection functionality in the face cropping preprocessor
Pipeline #
......@@ -167,6 +167,7 @@ def test_video_face_crop():
USE_LOCAL_CROPPER_FLAG = True # Use the local face cropping class (identical to Ivana's paper)
RGB_OUTPUT_FLAG = True # Return RGB cropped face using local cropper
DETECT_FACES_FLAG = True # find annotations locally replacing the database annotations
FACE_DETECTION_METHOD = "dlib"
preprocessor = VideoFaceCrop(cropped_image_size = CROPPED_IMAGE_SIZE,
cropped_positions = CROPPED_POSITIONS,
......@@ -178,7 +179,8 @@ def test_video_face_crop():
min_face_size = MIN_FACE_SIZE,
use_local_cropper_flag = USE_LOCAL_CROPPER_FLAG,
rgb_output_flag = RGB_OUTPUT_FLAG,
detect_faces_flag = DETECT_FACES_FLAG)
detect_faces_flag = DETECT_FACES_FLAG,
face_detection_method = FACE_DETECTION_METHOD)
video, _ = convert_image_to_video_data(image, annotations, 3)
......@@ -187,8 +189,8 @@ def test_video_face_crop():
assert len(faces) == 3
assert faces[0][1].shape == (3, 64, 64)
assert faces[-1][1].shape == (3, 64, 64)
assert np.sum(faces[0][1]) == 1253048
assert np.sum(faces[-1][1]) == 1253048
assert np.sum(faces[0][1]) == 1251500
assert np.sum(faces[-1][1]) == 1251500
#==============================================================================
......
......@@ -12,7 +12,7 @@ import bob.ip.dlib # for face detection functionality
import bob.ip.mtcnn
#==============================================================================
def detect_face_in_image(image, method):
def detect_face_in_image(image, method = "dlib"):
"""
This function detects a face in the input image.
......@@ -55,7 +55,7 @@ def detect_face_in_image(image, method):
#==============================================================================
def detect_faces_in_video(frame_container, method):
def detect_faces_in_video(frame_container, method = "dlib"):
"""
This function detects a face in each farme of the input video.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment