-
Notifications
You must be signed in to change notification settings - Fork 27.6k
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
Removed forced overlay #14727
Conversation
I believe what you're trying to achieve can be also achieved by using built in extension Soft Inpainting also your statement of
is not true because removing that would break inpaint also please read wiki/Contributing |
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. |
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. |
If you want to add this option to your img2img UI for fast access, use "Settings in UI" setting page. I'm closing this. |
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. |
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](https://private-user-images.githubusercontent.com/58893646/298551562-25b32fed-018b-4f56-a685-b97c244c1d25.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MDE5MjYsIm5iZiI6MTczOTYwMTYyNiwicGF0aCI6Ii81ODg5MzY0Ni8yOTg1NTE1NjItMjViMzJmZWQtMDE4Yi00ZjU2LWE2ODUtYjk3YzI0NGMxZDI1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDA2NDAyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTY5MGMwMDdkOGRlYzk4YzBmZDI2OTQzM2NlMDNlMjBiODRhYTQyOGJlOTk1MjM2NGM0MDM2N2NjZDM5MDRkMjgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.YPD3PW8J5RzCV16ba2HZEEI0kMv_JoGePccP2lP9Ac0)
![image](https://private-user-images.githubusercontent.com/58893646/298553336-34bd8f2c-fe3c-43ce-85d9-d2d6965ee39d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk2MDE5MjYsIm5iZiI6MTczOTYwMTYyNiwicGF0aCI6Ii81ODg5MzY0Ni8yOTg1NTMzMzYtMzRiZDhmMmMtZmUzYy00M2NlLTg1ZDktZDJkNjk2NWVlMzlkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTUlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjE1VDA2NDAyNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWViMzRjMTRkM2Y5NjA3NDNjMmFkOTEyODNjMTVmMDAwY2E2MTMwZjE0NDZiMTQ5MTMwNzI3NTNmZWRhOTg1NmEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.eaiQUbVso4cGDQOFZQxFGXDvZmtJyEYZa09wGI1Ubxs)
Mask:
(Output BEFORE) Current WebUI (Overlays the raw output without informing the user):
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:
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:
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: