Skip to content
Snippets Groups Projects

Update FaceNet.py -- Add an example preprocessor

Merged Amir MOHAMMADI requested to merge p1 into master
1 file
+ 17
0
Compare changes
  • Side-by-side
  • Inline
@@ -52,6 +52,23 @@ class FaceNet(object):
class FaceNetExtractor(FaceNet, Extractor):
pass
extractor = FaceNetExtractor()
And for a preprocessor you can use::
from bob.bio.face.preprocessor import FaceCrop
# This is the size of the image that this model expects
CROPPED_IMAGE_HEIGHT = 160
CROPPED_IMAGE_WIDTH = 160
# eye positions for frontal images
RIGHT_EYE_POS = (46, 53)
LEFT_EYE_POS = (46, 107)
# Crops the face using eye annotations
preprocessor = FaceCrop(
cropped_image_size=(CROPPED_IMAGE_HEIGHT, CROPPED_IMAGE_WIDTH),
cropped_positions={'leye': LEFT_EYE_POS, 'reye': RIGHT_EYE_POS},
color_channel='rgb'
)
"""
def __init__(self,
Loading