Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions gfpgan/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down