stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

GFPGAN not working as it should based on previous use

Open midihex opened this issue 2 years ago • 2 comments

Describe the bug I used GFPGAN quite a bit before SD came around so I'm familiar with it's 'look'. Somehow its never quite looked right to me in Web-ui So I thought I'd try and figure it out. Based on GFPGAN v1.4 - Here's the findings.. To Reproduce I loaded a small 256x256 face into Extras, Set the resize to 4 and none as an upscaler, and turned GFPGAN up to 1. I would expect it to do a basic resize and apply GFPGAN and produce a picture of 1024x1024 - which it does - but if you look around the picture you'll see that it's pixelated (The hair, forehead skin detail and teeth are good tells)

00109

Now. If I loaded a small 256x256 face into Extras, Set the resize to 1 this time and none as an upscaler, and turned GFPGAN up to 1. And edited gfpgan_model.py line 39 upscale= and set that to 4 - then restart SD I would expect it to do a basic resize but this time using the setting in gfpgan_model.py and apply GFPGAN and produce a picture of 1024x1024 - which it does - but if you look around the picture you'll see that it's not pixelated like before

00108

This is what I'd expect as a correct result.

Desktop (please complete the following information): Win 10 Browser Chrome/Edge version ab3f997c0c4a1423a82623ae1d4d3c66005bb8da

midihex avatar Oct 18 '22 03:10 midihex

I've noticed something similar. Sometimes you can see a hard straight horizontal line where the pixilation ends, usually through the top of the hair.

cvar66 avatar Oct 18 '22 21:10 cvar66

I've noticed that too cvar66, think that is a direct gfpgan 1.4 issue- it's a pain when doing thin plate spline upscales

For the main issue above I'm thinking its an order of operations issue If I put the 256x256 in and set resize to 4 with it set to none for upscaler and no gfpgan and then take the resulting low quality 1024x1024 image and then put that in, with resize set to 1, none for upscaler and gfpgan set to 1

I get the correct 1024x1024 high detail result.

256x256 headin_000027

resize 4, none for upscale, no gfpgan = 1024x1024 result

00115

result 1024x1024 resize 1, none for upscale, gfpgan set to1

00116

midihex avatar Oct 18 '22 23:10 midihex

Fixed in PR #3874 as far as the extras tab goes, still needs fixing when using highres.fix

midihex avatar Oct 29 '22 09:10 midihex

IMG-20231008-WA0002

SHAHSAKHI avatar Oct 11 '23 19:10 SHAHSAKHI