Exemplo n.º 1
0
def crop_faces(img, face_detector):
    """Returns: Tuple(Tuple(face_crop, bbox), img_without_faces)"""
    preds = face_detector.predict(img, dilate_bbox=True)
    cutout_faces = F.cutout(img, holes=[bbox.astype(int) for bbox in preds])
    face_crops = [(face_detector.crop(img, bbox), bbox) for bbox in preds]

    return face_crops, cutout_faces
Exemplo n.º 2
0
 def apply(self, image, fill_value=0, holes=(), **params):
     return F.cutout(image, holes, fill_value)
Exemplo n.º 3
0
 def apply_to_mask(self, image, fill_value=0, holes=[], **params):
     return F.cutout(image, holes, fill_value)