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

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

parent 7da637ac
Pipeline #36333 passed with stage
in 13 minutes and 39 seconds
from . import Base, bounding_box_to_annotations
from . import Base
class BobIpMTCNN(Base):
"""Annotator using bob.ip.mtcnn"""
"""Annotator using mtcnn in bob.ip.tensorflow_extractor"""
def __init__(self, **kwargs):
super(BobIpMTCNN, self).__init__(**kwargs)
from bob.ip.mtcnn import FaceDetector
self.detector = FaceDetector()
from bob.ip.tensorflow_extractor import MTCNN
self.detector = MTCNN()
def annotate(self, image, **kwargs):
"""Annotates an image using bob.ip.mtcnn
"""Annotates an image using mtcnn
Parameters
----------
......@@ -23,10 +23,7 @@ class BobIpMTCNN(Base):
-------
dict
Annotations contain: (topleft, bottomright, leye, reye, nose,
mouthleft, mouthright).
mouthleft, mouthright, quality).
"""
bounding_box, landmarks = self.detector.detect_single_face(image)
if not landmarks:
return None
landmarks.update(bounding_box_to_annotations(bounding_box))
return landmarks
# return the annotations for the first/largest face.
return self.detector.annotations(image)[0]
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