From 12e27e317ba2e821b1b3e4beb6124974937e0410 Mon Sep 17 00:00:00 2001
From: Amir MOHAMMADI <amir.mohammadi@idiap.ch>
Date: Sun, 11 Mar 2018 09:06:28 +0100
Subject: [PATCH] Add documentations

---
 bob/bio/face/annotator/bobipdlib.py       | 15 +++++++++++++++
 bob/bio/face/annotator/bobipfacedetect.py | 20 +++++++++++++++++++-
 bob/bio/face/annotator/bobipflandmark.py  |  2 +-
 bob/bio/face/annotator/bobipmtcnn.py      | 15 +++++++++++++++
 4 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/bob/bio/face/annotator/bobipdlib.py b/bob/bio/face/annotator/bobipdlib.py
index ffd6d27c..5b9aac8c 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 42012ab2..46bd27cd 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 556d0c40..cd1552af 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 58d3a2a9..b207c685 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
-- 
GitLab