mirror of
https://github.com/TencentARC/GFPGAN.git
synced 2026-02-14 13:24:36 +00:00
how can i change the face area to be cropped larger? #58
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @nowfalsalahudeen on GitHub (Aug 27, 2021).
@shubhamcodez commented on GitHub (Aug 28, 2021):
There should be some cropping & scaling options for that or just crop before input.
@xinntao commented on GitHub (Aug 29, 2021):
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~
@Kazioo commented on GitHub (Oct 27, 2022):
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:
@Svytta commented on GitHub (Oct 26, 2024):
ths u so much, this helped me a lot, i wrote a code with ur guidance that automatice this, u just need to add the new files to ur directory, ie:
D:\AI\GFPGAN\gfpgan u add the new file utils_modificado.py
D:\AI\GFPGAN u add the new file inference_gfpgan_hair.py
when u execute: python inference_gfpgan_hair.py -i inputs/upload -o Result_GFPGAN -v 1.4 -s 1 --bg_upsampler realesrgan --bg_tile 800
GFPGAN will create 2 different files:
Result_GFPGAN
> Original
> Modified
Im not really good coding un python but ultimatly it works, hopefully someday I will fix this properly
files.zip