Skip to content
Snippets Groups Projects

[mtcnn-annotator] replace it bob.ip.mtcnn with bob.ip.tensorflow_extractor

Merged Amir MOHAMMADI requested to merge mtcnn into master
1 file
+ 8
11
Compare changes
  • Side-by-side
  • Inline
from . import Base, bounding_box_to_annotations
from . import Base
class BobIpMTCNN(Base):
class BobIpMTCNN(Base):
"""Annotator using bob.ip.mtcnn"""
"""Annotator using mtcnn in bob.ip.tensorflow_extractor"""
def __init__(self, **kwargs):
def __init__(self, **kwargs):
super(BobIpMTCNN, self).__init__(**kwargs)
super(BobIpMTCNN, self).__init__(**kwargs)
from bob.ip.mtcnn import FaceDetector
from bob.ip.tensorflow_extractor import MTCNN
self.detector = FaceDetector()
self.detector = MTCNN()
def annotate(self, image, **kwargs):
def annotate(self, image, **kwargs):
"""Annotates an image using bob.ip.mtcnn
"""Annotates an image using mtcnn
Parameters
Parameters
----------
----------
@@ -23,10 +23,7 @@ class BobIpMTCNN(Base):
@@ -23,10 +23,7 @@ class BobIpMTCNN(Base):
-------
-------
dict
dict
Annotations contain: (topleft, bottomright, leye, reye, nose,
Annotations contain: (topleft, bottomright, leye, reye, nose,
mouthleft, mouthright).
mouthleft, mouthright, quality).
"""
"""
bounding_box, landmarks = self.detector.detect_single_face(image)
# return the annotations for the first/largest face.
if not landmarks:
return self.detector.annotations(image)[0]
return None
landmarks.update(bounding_box_to_annotations(bounding_box))
return landmarks
Loading