Skip to content
Snippets Groups Projects

Accept an annotator in FaceCrop

Merged Amir MOHAMMADI requested to merge facecrop into master
4 files
+ 171
100
Compare changes
  • Side-by-side
  • Inline
Files
4
@@ -38,9 +38,17 @@ def min_face_size_validator(annotations, min_face_size=(32, 32)):
"""
if not annotations:
return False
bbx = bob.ip.facedetect.bounding_box_from_annotation(
source='direct', **annotations)
if bbx.size < min_face_size:
for source in ('direct', 'eyes', None):
try:
bbx = bob.ip.facedetect.bounding_box_from_annotation(
source=source, **annotations)
break
except Exception:
if source is None:
raise
else:
pass
if bbx.size[0] < min_face_size[0] or bbx.size[1] < min_face_size[1]:
return False
return True
Loading