hafriedlander / stable-diffusion-grpcserver

An implementation of a server for the Stability AI Stable Diffusion API
Apache License 2.0
172 stars 23 forks source link

Inpainting: contrast in surrounding #4

Closed imperator-maximus closed 2 years ago

imperator-maximus commented 2 years ago

Hi,

Inpainting works. But all the surrounding pixels are getting a contrast change. Example (zoomed-in): image

In comparison to Img2Img vom Automatic1111 with Latent Noise ( all ok): image

I am using strength 1.0 btw

hafriedlander commented 2 years ago

Yeah, I know why this is happening. The whole image is moved through the latent space and back, even the protected portions, and that results in a slight change in the protected portion.

The fix is to mask the protected portion back in afterwards. Note that you will get some changes in the partially protected portion - only the completely protected portion will be masked in (otherwise you get ghosting in the partially protected portion where the latent space has shifted to accommodate the inpaint).

I'll prioritize fixing this, because it annoys me too :).

hafriedlander commented 2 years ago

This should be fixed now. Not that it only will be fixed when strength is exactly 1 (thinking about it, we probably want it for lower strength in inpaint-over-pixels mode too, just not for greater than 1)

imperator-maximus commented 2 years ago

This works fine now. Thank you!