diff --git a/bob/bio/face/annotator/bobipdlib.py b/bob/bio/face/annotator/bobipdlib.py index ffd6d27c0a56ac6bff114be2d49115e26c1c18c7..5b9aac8c1a3b709dc27b5a1ef658f4413de2ce29 100644 --- a/bob/bio/face/annotator/bobipdlib.py +++ b/bob/bio/face/annotator/bobipdlib.py @@ -11,6 +11,21 @@ class BobIpDlib(Base): self.detector = DlibLandmarkExtraction(bob_landmark_format=True) def annotate(self, image, **kwargs): + """Annotates an image using bob.ip.dlib + + Parameters + ---------- + image : numpy.array + An RGB image in Bob format. + **kwargs + Ignored. + + Returns + ------- + dict + Annotations contain: (topleft, bottomright, leye, reye, nose, + mouthleft, mouthright). + """ landmarks = self.detector(image) if not landmarks: return None diff --git a/bob/bio/face/annotator/bobipfacedetect.py b/bob/bio/face/annotator/bobipfacedetect.py index 42012ab2e085db93f7900ec08a925b51b6485635..46bd27cdce528f0fd0b8e6b06dba3d59997667b3 100644 --- a/bob/bio/face/annotator/bobipfacedetect.py +++ b/bob/bio/face/annotator/bobipfacedetect.py @@ -32,7 +32,7 @@ class BobIpFacedetect(Base): Parameters ---------- image : array - Image is Bob format RGB image. + Image in Bob format RGB image. **kwargs Ignored. @@ -56,6 +56,24 @@ class BoundingBoxToEyes(Base): """ def annotate(self, image, annotations, **kwargs): + """Converts bounding boxes of bob.ip.facedetect to eye locations. + + Parameters + ---------- + image : numpy.array + Ignored. + annotations : dict + The annotations that are given by :any:`BobIpFacedetect`. + **kwargs + Ignored. + + Returns + ------- + dict + The annotations with reye and leye locations added. + """ bbx = bounding_box_from_annotation(source='direct', **annotations) + # make a copy of the annotations + annotations = dict(annotations) annotations.update(expected_eye_positions(bbx)) return annotations diff --git a/bob/bio/face/annotator/bobipflandmark.py b/bob/bio/face/annotator/bobipflandmark.py index 556d0c40332a9c019be86a524135b7b1da3033ba..cd1552af8157aa0460a8f66d04c4d42d8412bfbc 100644 --- a/bob/bio/face/annotator/bobipflandmark.py +++ b/bob/bio/face/annotator/bobipflandmark.py @@ -26,7 +26,7 @@ class BobIpFlandmark(Base): Returns ------- dict - Annotations with reye and leye keys or an empty dict if it fails. + Annotations with reye and leye keys or None if it fails. """ image = rgb_to_gray(image) top, left = annotations['topleft'] diff --git a/bob/bio/face/annotator/bobipmtcnn.py b/bob/bio/face/annotator/bobipmtcnn.py index 58d3a2a989032d2c87d61ba8a86807d51112b38f..b207c685fcf1796cc75727afffee62af69b7d290 100644 --- a/bob/bio/face/annotator/bobipmtcnn.py +++ b/bob/bio/face/annotator/bobipmtcnn.py @@ -10,6 +10,21 @@ class BobIpMTCNN(Base): self.detector = FaceDetector() def annotate(self, image, **kwargs): + """Annotates an image using bob.ip.mtcnn + + Parameters + ---------- + image : numpy.array + An RGB image in Bob format. + **kwargs + Ignored. + + Returns + ------- + dict + Annotations contain: (topleft, bottomright, leye, reye, nose, + mouthleft, mouthright). + """ bounding_box, landmarks = self.detector.detect_single_face(image) if not landmarks: return None