GFPGAN icon indicating copy to clipboard operation
GFPGAN copied to clipboard

how can i change the face area to be cropped larger?

Open nowfalsalahudeen opened this issue 4 years ago • 4 comments

nowfalsalahudeen avatar Aug 27 '21 05:08 nowfalsalahudeen

There should be some cropping & scaling options for that or just crop before input.

shubhamcodez avatar Aug 28 '21 06:08 shubhamcodez

GFPGAN currently requires cropped and aligned face.
The cropping and aligning procedures are the same as FFHQ dataset.

I think if you want to use larger cropped face area, you also need to re-train the model~

xinntao avatar Aug 29 '21 16:08 xinntao

Not sure if this is the best way to do it, but it works. You can make the cropped area bigger, by editing lines 81 nad 82 in in utils.py. It will improve hair and ears (if they are cut in 1.0 crop) but it will degrade the face identity. So you may need to overlay a properly upscaled face on top of it later in editing software.

For example:

face_size=512,            crop_ratio=(1, 1)                # original, the only correct one!
face_size=420,            crop_ratio=(1.22, 1.22),
face_size=394,            crop_ratio=(1.3, 1.3),          
face_size=320,            crop_ratio=(1.6, 1.6),         # good for hair and ears, but will mess the face up really badly

Kazioo avatar Oct 27 '22 18:10 Kazioo