From f379d5b96d135872f84d0593041f6f7a830cdae1 Mon Sep 17 00:00:00 2001 From: Amir MOHAMMADI <amir.mohammadi@idiap.ch> Date: Thu, 12 Apr 2018 13:48:04 +0200 Subject: [PATCH] Handle cases when none of the annotations are valid --- bob/pad/face/preprocessor/FrameDifference.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/bob/pad/face/preprocessor/FrameDifference.py b/bob/pad/face/preprocessor/FrameDifference.py index 05037679..62c4ae9b 100644 --- a/bob/pad/face/preprocessor/FrameDifference.py +++ b/bob/pad/face/preprocessor/FrameDifference.py @@ -21,9 +21,13 @@ import bob.ip.color import bob.ip.facedetect +import logging + #============================================================================== # Main body: +logger = logging.getLogger(__name__) + class FrameDifference(Preprocessor): """ @@ -414,6 +418,10 @@ class FrameDifference(Preprocessor): selected_frames, selected_annotations = self.check_face_size( frames, annotations, self.min_face_size) + if not len(selected_annotations): + logger.warn("None of the annotations are valid.") + return None + diff = self.comp_face_bg_diff( frames=selected_frames, annotations=selected_annotations, -- GitLab