Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ Request ] Integration of an upscaler and face restoration #56

Closed
Anandarani opened this issue Sep 4, 2023 · 12 comments
Closed

[ Request ] Integration of an upscaler and face restoration #56

Anandarani opened this issue Sep 4, 2023 · 12 comments

Comments

@Anandarani
Copy link

Anandarani commented Sep 4, 2023

Thank you Moonride303 for this fantastic upgrade of Fooocus. It is gold. The only thing which is still missing in Fooocus is an integration of an upscaler like Esrgan and a face restoration like Codeformer/Gfpgan. Thank you for your work!

@Acephalia
Copy link

Acephalia commented Sep 11, 2023

I think something along the lines of A1111's Hires fix would really hit the sweet spot. Amazing work @MoonRide303, also recommend adding a coffee/donate button somewhere so we can pitch in to support the work.

@MoonRide303
Copy link
Owner

Upscaling is now possible in v2.0.12 via Image-2-Image - see example in Wiki.

@Acephalia
Copy link

Upscaling is now possible in v2.0.12 via Image-2-Image - see example in Wiki.

What a legend! Thank you.

@MoonRide303
Copy link
Owner

@Acephalia With support for img2img and custom resolutions already in place I just needed to add some small tweaks in code preparing img2img input - I should think of it earlier, to be honest :).

@Acephalia
Copy link

@Acephalia With support for img2img and custom resolutions already in place I just needed to add some small tweaks in code preparing img2img input - I should think of it earlier, to be honest :).

The fact that you already had it partially implemented = legend x2

I gave it a go and it works pretty well. Is it possible to extend it to perhaps use an upscaler model? Or do you reckon running it back purely through SDXL and the refiner gives better results?

@MoonRide303
Copy link
Owner

@Acephalia Simple upscaler models I tested so far are unable to understand broader context of the image, and they tend to introduce bad-looking artifacts (like sharpening areas of the image that shouldn't be sharpened) - so for the time being I'd just stick to img2img method powered by full SDXL models.

Bonus feature of this approach: you can also play with img2img parameters, seed, prompt, and Control-LoRAs to check different variants :).

@Acephalia
Copy link

@Acephalia Simple upscaler models I tested so far are unable to understand broader context of the image, and they tend to introduce bad-looking artifacts (like sharpening areas of the image that shouldn't be sharpened) - so for the time being I'd just stick to img2img method powered by full SDXL models.

Bonus feature of this approach: you can also play with img2img parameters, seed, prompt, and Control-LoRAs to check different variants :).

Yep that does make sense and I'm definitely liking this approach.

The only thing I'm finding a tad tedious is to manually calculate the upscale values and enter it in.

How complex would it be to add a slider for the upscale size? ex 1x-2x range? or even a simple checkbox for 2x to just double it? Not a deal breaker in any way but definitely be a nice QOL add on.

@MoonRide303
Copy link
Owner

@Acephalia Yeah, it should be simpler - people shouldn't have to manually calculate resolutions. I will try figuring something out.

@Acephalia
Copy link

@Acephalia Yeah, it should be simpler - people shouldn't have to manually calculate resolutions. I will try figuring something out.

I have to sign off for the evening but I was tinkering around a bit and might be able to help. Just need to figure out how to get the math function to overwrite the selected gradio value. Will report back tomorrow.

@MoonRide303
Copy link
Owner

MoonRide303 commented Sep 15, 2023

@Acephalia It's not the math or Gradio - I was rather wondering how perfect UI for it should look like - cause it's pretty crowded already, and pushing even more stuff in there will just slowly turn it into another SD web UI, full of buttons and slider everywhere.

@Acephalia
Copy link

@MoonRide303 ah yes. The ui problem. It’s inevitable with more customisation options. Happy mediums I guess.

Could you potentially group all extra parameters under a expander that is contracted by default to clean it up?

My suggestions would be to :
1.Revision settings to go under one group.
2. Control Net Canny could be one group
3. CN depth another.
4. Move CN model selection to respective group in CN tab? (I know the models tab is for models but it might be more intuitive to have them with the CN settings.
5. Loras could be contracted by default?

Irrespectively; adding a slider to upscale either under the resolution or image2image tab isn’t going to make it an eye sore imho. It’s still very streamlined and far away from auto1111 territory.

@MoonRide303
Copy link
Owner

Higher resolutions don't really work too well in txt2img (SDXL needs to stay around 1 MP when generating from scratch), so I made dedicated Image-2-Image Scale slider, working only in img2img mode - should be much more convenient to use, now :).

1 + 2 + 3 good idea, 4 +5 keeping as it is (at least for now).

Done as commit 426088e (part of v2.0.18).

No plans for face restorations in nearby future, so nothing more left to do in this issue - closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants