diff --git a/gfpgan/utils.py b/gfpgan/utils.py index 74ee5a83..7cd4f7c6 100644 --- a/gfpgan/utils.py +++ b/gfpgan/utils.py @@ -99,7 +99,7 @@ def __init__(self, model_path, upscale=2, arch='clean', channel_multiplier=2, bg self.gfpgan = self.gfpgan.to(self.device) @torch.no_grad() - def enhance(self, img, has_aligned=False, only_center_face=False, paste_back=True, weight=0.5): + def enhance(self, img, has_aligned=False, only_keep_largest=False, paste_back=True, weight=0.5): self.face_helper.clean_all() if has_aligned: # the inputs are already aligned @@ -108,7 +108,7 @@ def enhance(self, img, has_aligned=False, only_center_face=False, paste_back=Tru else: self.face_helper.read_image(img) # get face landmarks for each face - self.face_helper.get_face_landmarks_5(only_center_face=only_center_face, eye_dist_threshold=5) + self.face_helper.get_face_landmarks_5(only_keep_largest=only_keep_largest, resize=840, eye_dist_threshold=5) # eye_dist_threshold=5: skip faces whose eye distance is smaller than 5 pixels # TODO: even with eye_dist_threshold, it will still introduce wrong detections and restorations. # align and warp each face