lshqqytiger / stable-diffusion-webui-amdgpu

Stable Diffusion web UI
GNU Affero General Public License v3.0
1.8k stars 186 forks source link

[Bug]: Inpainting affects unmasked areas #156

Open kraddoc opened 1 year ago

kraddoc commented 1 year ago

Is there an existing issue for this?

What happened?

Inpainting heavily degrades image quality and adds heavy blurriness in the unmasked area, no matter the settings. It's not connected to mask not being cleared out properly, as the bug occurs even in the fresh installation. The effect on unmasked areas always stays the same, no matter the settings, sampling method, resolution etc.

Before and after results, with mask applied only to extra arm:

The settings used, among many: Screenshot-2023-06-08-160636

Steps to reproduce the problem

  1. Go to inpainting
  2. Add a mask to the image
  3. Press generate

What should have happened?

Image regenerated with only the mask area affected.

Commit where the problem happens

ebf229bd1727a0f8f0d149829ce82e2012ba7318

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

Windows

What device are you running WebUI on?

AMD GPUs (RX 6000 above)

What browsers do you use to access the UI ?

Mozilla Firefox

Command Line Arguments

--medvram --precision full --no-half --no-half-vae --opt-split-attention --opt-sub-quad-attention --disable-nan-check

List of extensions

Adetailer. The problem persists without it.

Console logs

venv "D:\Data\Stable DIffusion\stable-diffusion-webui-directml\venv\Scripts\Python.exe"
fatal: No names found, cannot describe anything.
Python 3.10.6 (tags/v3.10.6:9c7b4bd, Aug  1 2022, 21:53:49) [MSC v.1932 64 bit (AMD64)]
Version: <none>
Commit hash: ebf229bd1727a0f8f0d149829ce82e2012ba7318
Installing requirements

Launching Web UI with arguments: --medvram --precision full --no-half --no-half-vae --opt-split-attention --opt-sub-quad-attention --disable-nan-check
No module 'xformers'. Proceeding without it.
Warning: caught exception 'Torch not compiled with CUDA enabled', memory monitor disabled
[-] ADetailer initialized. version: 23.6.2, num models: 8
Checkpoint sxzLuma_099VAE.safetensors [b4e58922cc] not found; loading fallback allboymix.safetensors [9694b69e2b]
Loading weights [9694b69e2b] from D:\Data\Stable DIffusion\stable-diffusion-webui-directml\models\Stable-diffusion\allboymix.safetensors
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`.
Startup time: 7.3s (import torch: 1.7s, import gradio: 1.2s, import ldm: 0.5s, other imports: 0.8s, load scripts: 2.0s, create ui: 0.5s, gradio launch: 0.4s).
Creating model from config: D:\Data\Stable DIffusion\stable-diffusion-webui-directml\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying optimization: Doggettx... done.
Textual inversion embeddings loaded(4): badhandv4, easynegative, negative_hand-neg, verybadimagenegative_v1.3
Model loaded in 3.8s (load weights from disk: 1.1s, create model: 0.3s, apply weights to model: 2.3s).
100%|██████████████████████████████████████████████████████████████████████████████████| 16/16 [01:58<00:00,  7.38s/it]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 16/16 [01:53<00:00,  7.11s/it]
Total progress: 100%|██████████████████████████████████████████████████████████████████| 16/16 [01:53<00:00,  6.58s/it]

Additional information

I have 8 gb VRAM rx 6600, if that's relevant.

LucasJackrabbit commented 1 year ago

Have you tried to select Whole Image in Inpaint Area? I've had many problems with inpainting myself including inpainting the wrong way and sometimes settings are saying something but result feels opposite. Also try to test Mask Mode and mask everything else except the arm.

kraddoc commented 1 year ago

Have you tried to select Whole Image in Inpaint Area? I've had many problems with inpainting myself including inpainting the wrong way and sometimes settings are saying something but result feels opposite. Also try to test Mask Mode and mask everything else except the arm.

Setting Inpaint Area to Whole Image doesn't affect the issue, but switching Mask Mode to Inpaint not masked actually produces expected result. I wonder what's the fundamental difference between Mask Modes is. I still consider this issue open, since Inpaint masked still has unexpected behavior no matter the other settings.