Skip to content
Snippets Groups Projects
Commit 009e21a8 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Test min_face_size_validator

parent 1e8e19f2
No related branches found
No related tags found
1 merge request!41Add annotators
Pipeline #
...@@ -36,7 +36,9 @@ def min_face_size_validator(annotations, min_face_size=(32, 32)): ...@@ -36,7 +36,9 @@ def min_face_size_validator(annotations, min_face_size=(32, 32)):
bool bool
True, if the face is large enough. True, if the face is large enough.
""" """
bbx = bob.ip.facedetect.bounding_box_from_annotations( if not annotations:
return False
bbx = bob.ip.facedetect.bounding_box_from_annotation(
source='direct', **annotations) source='direct', **annotations)
if bbx.size < min_face_size: if bbx.size < min_face_size:
return False return False
......
...@@ -2,7 +2,8 @@ import bob.io.base ...@@ -2,7 +2,8 @@ import bob.io.base
import bob.io.base.test_utils import bob.io.base.test_utils
import bob.io.image import bob.io.image
from bob.bio.face.annotator import ( from bob.bio.face.annotator import (
BobIpFacedetect, BoundingBoxToEyes, BobIpFlandmark) BobIpFacedetect, BoundingBoxToEyes, BobIpFlandmark,
min_face_size_validator)
from bob.bio.base.annotator import FailSafe from bob.bio.base.annotator import FailSafe
import numpy import numpy
...@@ -46,3 +47,20 @@ def test_bob_ip_flandmark(): ...@@ -46,3 +47,20 @@ def test_bob_ip_flandmark():
_assert_bob_ip_facedetect(annot) _assert_bob_ip_facedetect(annot)
assert [int(x) for x in annot['reye']] == [183, 127], annot assert [int(x) for x in annot['reye']] == [183, 127], annot
assert [int(x) for x in annot['leye']] == [174, 223], annot assert [int(x) for x in annot['leye']] == [174, 223], annot
def test_min_face_size_validator():
valid = {
'topleft': (0, 0),
'bottomright': (32, 32),
}
assert min_face_size_validator(valid)
not_valid = {
'topleft': (0, 0),
'bottomright': (28, 32),
}
assert not min_face_size_validator(not_valid)
assert not min_face_size_validator(None)
assert not min_face_size_validator({})
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment