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

Removed forced overlay #14727

Closed
wants to merge 1 commit into from
Closed

Removed forced overlay #14727

wants to merge 1 commit into from

Conversation

Beyondo
Copy link

@Beyondo Beyondo commented Jan 22, 2024

Description

Currently, the WebUI overlays the original image over the AI-generated output, which can sometimes lead to noticeable discrepancies, especially around the mask's edges. This behavior limits the user's ability to fully appreciate and utilize the AI's creativity.

To improve this, I propose removing the overlay entirely, till we've a proper UI option for it, preferably unchecked by default. Or maybe no overylay at all; it is not really useful at all except for destroying what the AI generates.

Removing the overlay actually addresses many issues people were having on reddit with Inpainting somehow "not blending". They've no idea that WebUI was altering the generated output under the hood all this time.

Screenshots/videos:

Here are the results with me trying to outpaint hair for a character:

Initial:
image
Mask:
image

(Output BEFORE) Current WebUI (Overlays the raw output without informing the user):

image
Might look good at first glance, but look closely at the edges of the mask.. oh, there shouldn't be edges in the first place. This becomes much more noticeable when outpainting limbs and complex structures instead of hair.
.
.

(Output AFTER) After removing the overlay code:

image
RAW image out of the model. Seemless blend. Much smoother. That's how the AI generated it, so why mess it up with some weird cropped overylay, whoever decided that was a great idea?

Notice how the AI modified the unmasked part of the initial, like the eyes and face, but it can easily be fixed with 2 seconds of a photoshop eraser:

Final:

image
Erase the parts of the inpaint you don't want with a smooth photoshop brush with the original behind it.

Note: Removing overlay could be useful in cases where the user also liked the face or eyes (or any features) that the AI generated, so we should give users full control over the generated image instead of forcing them to have their AI-gen's overlayed in WebUI and destroy what the model originally got us.

Checklist:

@w-e-w
Copy link
Collaborator

w-e-w commented Jan 22, 2024

I believe what you're trying to achieve can be also achieved by using built in extension Soft Inpainting

also your statement of

Nobody would miss this line.

is not true because removing that would break inpaint Only masked mode not to mention Soft Inpainting


also please read wiki/Contributing
you based your PR on master branch and also targeting the PR at master

@Beyondo
Copy link
Author

Beyondo commented Jan 23, 2024

I believe I haven't made it clear that the point of this merge is to internally remove Soft Inpainting; my bad.

Soft Inpainting is horrible for many people's needs from Outpainting without the masked parts interferring with the generation to having a seemless output from the AI which then people can work with so they can choose what to keep and what to exclude of what the AI generated.

Forcing the initial image into the output which looks very out-of-place in many generations almost never works the first time (Or at all). Well, at least for my tasks.

If there's an option to disable Soft Inpainting that I failed to see, I'm honestly all for it. Until then, I'd just keep it disabled in my copy of WebUI, enjoying the freedom of generating real inpaints and putting my own overlays.

Do feel free to close the merge if it is troublesome to other features.

@AUTOMATIC1111
Copy link
Owner

I don't get a hard edge like this when I inpaint. Anyway, it's not an unreasonable request and I added an option for this in de5a8c5.

As for your question why this is in, you already answered in with the eyes example.

@AUTOMATIC1111
Copy link
Owner

If you want to add this option to your img2img UI for fast access, use "Settings in UI" setting page. I'm closing this.

@w-e-w w-e-w mentioned this pull request Feb 17, 2024
@CodeHatchling
Copy link
Contributor

CodeHatchling commented Feb 18, 2024

If there's an option to disable Soft Inpainting that I failed to see

I believe that the check-mark box can be toggled to enable or disable soft inpainting. In the latter case, the legacy behaviour is enabled.

If you use a hard mask (with no blurring) with legacy inpainting, you'll see compositing seams as shown in your example.

Soft inpainting instead generates a unique mask based on differences between the initial and final latent pixels. Latent pixels represent an 8x8 block of pixels, so the worst case scenario should be an abrupt change across 8 pixels. The intended use for soft inpainting in these situations is to define a transition zone in your mask (e.g. by blurring).

While simply disabling the overlay is a valid option, do be aware that the VAE is lossy and there will be a loss of quality in unmasked regions. Of course, it would be useful to do have the raw output from the diffuser so that you can composite the two images however you wish in an external program.

@pawel665j pawel665j mentioned this pull request Apr 16, 2024
ruchej pushed a commit to ruchej/stable-diffusion-webui that referenced this pull request Sep 30, 2024
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

Successfully merging this pull request may close these issues.

4 participants