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
[bug]: Inpaint near image borders creates artifacts along the borders #6349
Comments
Forgot to mention that there was a similar problem in ComfyUI and it was fixed later: And here's how it was fixed: |
The first example does look like an issue I've seen when denoising padded latents, which may be the case if your region dimensions are not multiples of 64. Reflect padding instead of constants usually worked best in my experiments. Your second example confuses me, because pixels far outside of your mask area are being affected. That looks like VAE nondeterminism to me, but the canvas paste-back operation shouldn't allow that. What is your Mask Blur setting at? Seems like it might be way too high. |
Info by dunkeroni: |
Is there an existing issue for this problem?
Operating system
Windows
GPU vendor
Nvidia (CUDA)
GPU model
RTX 3070
GPU VRAM
8GB
Version number
4.2.0
Browser
Chrome 124.0.6367.158
Python dependencies
{
"accelerate": "0.29.2",
"compel": "2.0.2",
"cuda": "12.1",
"diffusers": "0.27.2",
"numpy": "1.26.4",
"opencv": "4.9.0.80",
"onnx": "1.15.0",
"pillow": "10.2.0",
"python": "3.10.11",
"torch": "2.2.2+cu121",
"torchvision": "0.17.2+cu121",
"transformers": "4.39.3",
"xformers": "0.0.25.post1"
}
What happened
SD: SDXL.
Whenever image is generated during img2img/inpaint process, strange artifacts appear along the borders of the image.
Tested on both Tiled img2img (in "Workflows" mode) and in Canvas mode.
You can see a thin artifact line along the border of the image (top arrow), it was caused by tiled img2img:
Then I made a slight inpaint (bottom arrow) and tried to inpant. New artifacts along the border appeared:
These artifacts appear even if masked area (for inpaint) is far away from the border. This is the masked area:
This is before/after inpaint. You can notice that border of the image was changed: https://imgsli.com/MjYyOTkw
What you expected to happen
I expected selected areas to be properly cropped and inpaint to be properly applied without artifacts along borders of the image.
How to reproduce the problem
These steps copy my actions, but there are probably some optional steps like upscaling an image. I will mark them with "*".
Tiled img2img:
1.1. Generate any image.
1.2.* Upscale image with x4 upscaler (I used RealESRGAN x4 Plus (anime 6B)
1.3. Run tiled img2img workflow:
Tiled img2img.json
Canvas inpaint
2.1. Generate any image
2.2.* Upscale image with x4 upscaler (I used RealESRGAN x4 Plus (anime 6B)
2.3. Put upscaled image in Canvas mode.
2.4. Select any area of the image, any of the borders of selection box should align with image border.
2.5.* Mask any area inside the selection box
2.6. Run inpaint.
Additional context
I noticed that these artifacts appear along the borders during preview of the generation:
Discord username
svyaga
The text was updated successfully, but these errors were encountered: