InvokeAI icon indicating copy to clipboard operation
InvokeAI copied to clipboard

Is GFPGAN really working in new version (1.12)? Image is not upscaled

Open LipcaCZ opened this issue 4 years ago • 9 comments

Hi, GFPGAN should be now automatically activated if companion folder is found (which is), but is it really working? In the console everything looks ok, after image generation I see something like

* GFPGAN - Restoring Faces: young female warrior holding flaming sword, red hair, beautiful caucasian face, dramatic lighting, fire sparks flying in the air, lava in background, character art, wide shot, digital painting, art by Kim Junghun : seed:3128109951
Usage stats:
   1 image(s) generated in 20.97s
   Max VRAM used for this generation: 4.39G
   Max VRAM used since script start:  4.39G
Outputs:
outputs/img-samples\000413.3128109951.png: "young female warrior holding flaming sword, red hair, beautiful caucasian face, dramatic lighting, fire sparks flying in the air, lava in background, character art, wide shot, digital painting, art by Kim Junghun" -s50 -b1 -W512 -H512 -C7.5 -mplms -G0.5 -S3128109951

...but the image is still 512x512 (was 1024x1024 in previous version when I used GFPGAN) and also the faces are pretty bad. So it's maybe not actually doing anything, or maybe are there some new parameters that has to be used?

LipcaCZ avatar Aug 28 '22 21:08 LipcaCZ

-G is now specifically for face restoration. If you want to upscale, you need to pass -U2 (for 2x) or -U4 (for 4x)

namion avatar Aug 28 '22 22:08 namion

-U takes two values. First is the model and second is the strength.

Type -U 2 0.6 in that format.

blessedcoolant avatar Aug 28 '22 22:08 blessedcoolant

OK, thanks. So it's working then, but I'm actually using web interface, because it's more user friendly and there's no option for upscaling, so it would be nice to see it there in next version. Thanks.

LipcaCZ avatar Aug 28 '22 22:08 LipcaCZ

I'm not a web developer, but I think I can add support for upscaling later this evening. Just doing a few bugfixes first.

lstein avatar Aug 28 '22 22:08 lstein

OK, thanks. So it's working then, but I'm actually using web interface, because it's more user friendly and there's no option for upscaling, so it would be nice to see it there in next version. Thanks.

I am currently working on a few other features. I will make a full fledged interactive UI once this repo has a good set of features going on so I don't have to keep redesigning the UI.

Maybe someone else can add the upscale option to the barebones UI in the meantime. Shouldn't be too hard.

blessedcoolant avatar Aug 28 '22 22:08 blessedcoolant

I'm working on adding upscaling controls to the web UI. Should be ready soon.

lstein avatar Aug 29 '22 01:08 lstein

Upscaling should be working on the WebUI now. Do a pull from the "main" branch.

lstein avatar Aug 29 '22 11:08 lstein

How can I tell if upscaling is working? When I do a diff between an image with and without upscaling from the web UI, there is no difference at the byte level. esrgan is installed and I see no error messages in the terminal. Is there something I can do on my end to tell if upscaling is being attempted?

The request is being logged with upscaling level and strength:

{"prompt": "a pumpkin pizza", "iterations": "1000", "steps": "30", "cfgscale": "8", "sampler": "k_euler_a", "width": "512", "height": "512", "seed": "246827", "initimg": "", "strength": "0.4", "fit": "on", "gfpgan_strength": "0.8", "upscale_level": "4", "upscale_strength": "0.75"}

carbocation avatar Sep 05 '22 05:09 carbocation

Actually, if I run file [filename], I see that it's upscaled by the expected value. The preview on the web server is not upscaled (and right-click / downloading yields the non-upscaled version). So it seems that what I was encountering is mostly a UI issue.

carbocation avatar Sep 05 '22 05:09 carbocation