Commit be7d2b41 authored by Amir MOHAMMADI's avatar Amir MOHAMMADI
Browse files

Always return None instead of empty dict

parent 49a61fa6
from . import Base, bounding_box_to_annotations
from bob.ip.facedetect import bounding_box_from_annotation
import bob.ip.facedetect
class BobIpDlib(Base):
......@@ -13,7 +13,8 @@ class BobIpDlib(Base):
def annotate(self, image, **kwargs):
landmarks = self.detector(image)
if not landmarks:
return {}
bounding_box = bounding_box_from_annotation(source='eyes', **landmarks)
return None
bounding_box = bob.ip.facedetect.bounding_box_from_annotation(
source='eyes', **landmarks)
landmarks.update(bounding_box_to_annotations(bounding_box))
return landmarks
......@@ -12,7 +12,7 @@ class BobIpFlandmark(Base):
self.flandmark = Flandmark()
def annotate(self, image, annotations, **kwargs):
"""Annotates a gray-scale image
"""Annotates an image.
Parameters
----------
......@@ -46,4 +46,4 @@ class BobIpFlandmark(Base):
(landmarks[2][1] + landmarks[6][1]) / 2.)
}
else:
return {}
return None
......@@ -12,6 +12,6 @@ class BobIpMTCNN(Base):
def annotate(self, image, **kwargs):
bounding_box, landmarks = self.detector.detect_single_face(image)
if not landmarks:
return {}
return None
landmarks.update(bounding_box_to_annotations(bounding_box))
return landmarks
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment