Bing-su / adetailer

Auto detecting, masking and inpainting with detection model.
GNU Affero General Public License v3.0
4.1k stars 318 forks source link

[Bug]: 더 낮은 점수의 얼굴부터 수정하는 문제 #668

Closed Ineman closed 1 month ago

Ineman commented 2 months ago

Describe the bug

adetailer가 신뢰도 숫자가 낮은 얼굴을 수정합니다. 확장에 오류가 있는건지, 아니면 옵션을 어떻게 수정해야 하는건지 도저히 모르겠어서 글을 남깁니다. 수정하고 싶은 얼굴이 항상 신뢰도 숫자가 적게 나오면 SEP라도 쓰겠는데, 신뢰도 숫자가 높아도 수정을 안하니 미칠것 같습니다 도와주세요.

Steps to reproduce

t2i에서 hires fix 사용. 확장은 tiled vae와 adetailer 사용 1.10.0 RC버전

Screenshots

Screenshot_20240726-212711_Chrome Screenshot_20240726-212724_Chrome Screenshot_20240726-212744_Chrome Screenshot_20240726-212603_Chrome

Console logs, from start to end.

Service List
Log Viewer
Process Manager
Container Logs...

78%|███████▊  | 39/50 [00:24<00:08,  1.37it/s]
Total progress:  65%|██████▍   | 40/62 [00:25<00:15,  1.38it/s]
80%|████████  | 40/50 [00:25<00:07,  1.38it/s]
Total progress:  66%|██████▌   | 41/62 [00:26<00:15,  1.38it/s]
82%|████████▏ | 41/50 [00:25<00:06,  1.38it/s]
Total progress:  68%|██████▊   | 42/62 [00:26<00:14,  1.36it/s]
84%|████████▍ | 42/50 [00:26<00:05,  1.36it/s]
Total progress:  69%|██████▉   | 43/62 [00:27<00:13,  1.38it/s]
86%|████████▌ | 43/50 [00:27<00:05,  1.38it/s]
Total progress:  71%|███████   | 44/62 [00:28<00:13,  1.38it/s]
88%|████████▊ | 44/50 [00:28<00:04,  1.38it/s]
Total progress:  73%|███████▎  | 45/62 [00:29<00:12,  1.38it/s]
90%|█████████ | 45/50 [00:28<00:03,  1.38it/s]
Total progress:  74%|███████▍  | 46/62 [00:29<00:11,  1.38it/s]
92%|█████████▏| 46/50 [00:29<00:02,  1.38it/s]
Total progress:  76%|███████▌  | 47/62 [00:30<00:10,  1.38it/s]
94%|█████████▍| 47/50 [00:30<00:02,  1.38it/s]
Total progress:  77%|███████▋  | 48/62 [00:31<00:10,  1.38it/s]
96%|█████████▌| 48/50 [00:30<00:01,  1.38it/s]
Total progress:  79%|███████▉  | 49/62 [00:31<00:09,  1.38it/s]
98%|█████████▊| 49/50 [00:31<00:00,  1.38it/s]
Total progress:  81%|████████  | 50/62 [00:32<00:08,  1.38it/s]
100%|██████████| 50/50 [00:32<00:00,  1.38it/s]
100%|██████████| 50/50 [00:32<00:00,  1.54it/s]
[Tiled VAE]: input_size: torch.Size([1, 4, 152, 104]), tile_size: 128, padding: 11
[Tiled VAE]: split to 2x1 = 2 tiles. Optimal tile size 96x96, original tile size 128x128
[Tiled VAE]: Fast mode enabled, estimating group norm parameters on 87 x 128 image
[Tiled VAE]: Executing Decoder Task Queue:   0%|          | 0/246 [00:00[Tiled VAE]: Executing Decoder Task Queue:  50%|█████     | 124/246 [00:00<00:00, 252.99it/s]
[Tiled VAE]: Executing Decoder Task Queue: 100%|██████████| 246/246 [00:00<00:00, 341.49it/s]
[Tiled VAE]: Done in 1.646s, max VRAM alloc 8686.284 MB
tiled upscale:   0%|          | 0/35 [00:00tiled upscale:   3%|▎         | 1/35 [00:00<00:07,  4.36it/s]
tiled upscale:   6%|▌         | 2/35 [00:00<00:07,  4.35it/s]
tiled upscale:   9%|▊         | 3/35 [00:00<00:07,  4.35it/s]
tiled upscale:  11%|█▏        | 4/35 [00:00<00:07,  4.35it/s]
tiled upscale:  14%|█▍        | 5/35 [00:01<00:06,  4.35it/s]
tiled upscale:  17%|█▋        | 6/35 [00:01<00:06,  4.34it/s]
tiled upscale:  20%|██        | 7/35 [00:01<00:06,  4.34it/s]
tiled upscale:  23%|██▎       | 8/35 [00:01<00:06,  4.34it/s]
tiled upscale:  26%|██▌       | 9/35 [00:02<00:05,  4.34it/s]
tiled upscale:  29%|██▊       | 10/35 [00:02<00:05,  4.34it/s]
tiled upscale:  31%|███▏      | 11/35 [00:02<00:05,  4.34it/s]
tiled upscale:  34%|███▍      | 12/35 [00:02<00:05,  4.34it/s]
tiled upscale:  37%|███▋      | 13/35 [00:02<00:05,  4.34it/s]
tiled upscale:  40%|████      | 14/35 [00:03<00:04,  4.34it/s]
tiled upscale:  43%|████▎     | 15/35 [00:03<00:04,  4.33it/s]
tiled upscale:  46%|████▌     | 16/35 [00:03<00:04,  4.33it/s]
tiled upscale:  49%|████▊     | 17/35 [00:03<00:04,  4.33it/s]
tiled upscale:  51%|█████▏    | 18/35 [00:04<00:03,  4.32it/s]
tiled upscale:  54%|█████▍    | 19/35 [00:04<00:03,  4.33it/s]
tiled upscale:  57%|█████▋    | 20/35 [00:04<00:03,  4.32it/s]
tiled upscale:  60%|██████    | 21/35 [00:04<00:03,  4.32it/s]
==> /var/log/supervisor/serviceportal.log <==
INFO:     222.102.206.168:0 - "POST /ajax/logs HTTP/1.1" 200 OK
INFO:     222.102.206.168:0 - "GET /favicon.ico HTTP/1.1" 307 Temporary Redirect
INFO:     222.102.206.168:0 - "GET / HTTP/1.1" 200 OK
INFO:     ('222.102.206.168', 0) - "WebSocket /ai-dock/logtail.sh" [accepted]
INFO:     connection open
==> /var/log/supervisor/webui.log <==
tiled upscale:  63%|██████▎   | 22/35 [00:05<00:03,  4.33it/s]
tiled upscale:  66%|██████▌   | 23/35 [00:05<00:02,  4.30it/s]
tiled upscale:  69%|██████▊   | 24/35 [00:05<00:02,  4.31it/s]
tiled upscale:  71%|███████▏  | 25/35 [00:05<00:02,  4.32it/s]
tiled upscale:  74%|███████▍  | 26/35 [00:06<00:02,  4.32it/s]
tiled upscale:  77%|███████▋  | 27/35 [00:06<00:01,  4.33it/s]
tiled upscale:  80%|████████  | 28/35 [00:06<00:01,  4.34it/s]
tiled upscale:  83%|████████▎ | 29/35 [00:06<00:01,  4.34it/s]
tiled upscale:  86%|████████▌ | 30/35 [00:06<00:01,  4.34it/s]
tiled upscale:  89%|████████▊ | 31/35 [00:07<00:00,  4.34it/s]
tiled upscale:  91%|█████████▏| 32/35 [00:07<00:00,  4.34it/s]
tiled upscale:  94%|█████████▍| 33/35 [00:07<00:00,  4.34it/s]
tiled upscale:  97%|█████████▋| 34/35 [00:07<00:00,  4.34it/s]
tiled upscale: 100%|██████████| 35/35 [00:08<00:00,  4.33it/s]
tiled upscale: 100%|██████████| 35/35 [00:08<00:00,  4.33it/s]
[Tiled VAE]: input_size: torch.Size([1, 3, 2432, 1664]), tile_size: 2048, padding: 32
[Tiled VAE]: split to 2x1 = 2 tiles. Optimal tile size 1600x1184, original tile size 2048x2048
[Tiled VAE]: Fast mode enabled, estimating group norm parameters on 1401 x 2048 image
[Tiled VAE]: Executing Encoder Task Queue:   0%|          | 0/182 [00:00[Tiled VAE]: Executing Encoder Task Queue:  51%|█████     | 92/182 [00:00<00:00, 118.90it/s]
[Tiled VAE]: Executing Encoder Task Queue: 100%|██████████| 182/182 [00:01<00:00, 118.26it/s]
[Tiled VAE]: Done in 3.186s, max VRAM alloc 10525.595 MB
  0%|          | 0/12 [00:00Total progress:  82%|████████▏ | 51/62 [00:47<00:55,  5.02s/it]
  8%|▊         | 1/12 [00:00<00:09,  1.14it/s]
Total progress:  84%|████████▍ | 52/62 [00:49<00:40,  4.01s/it]
17%|█▋        | 2/12 [00:02<00:13,  1.33s/it]
Total progress:  85%|████████▌ | 53/62 [00:51<00:29,  3.30s/it]
25%|██▌       | 3/12 [00:04<00:13,  1.48s/it]
Total progress:  87%|████████▋ | 54/62 [00:54<00:26,  3.29s/it]
33%|███▎      | 4/12 [00:07<00:17,  2.18s/it]
Total progress:  89%|████████▊ | 55/62 [00:57<00:23,  3.29s/it]
42%|████▏     | 5/12 [00:10<00:18,  2.58s/it]
Total progress:  90%|█████████ | 56/62 [01:00<00:19,  3.30s/it]
50%|█████     | 6/12 [00:14<00:16,  2.83s/it]
Total progress:  92%|█████████▏| 57/62 [01:04<00:16,  3.32s/it]
58%|█████▊    | 7/12 [00:17<00:15,  3.00s/it]
Total progress:  94%|█████████▎| 58/62 [01:07<00:13,  3.34s/it]
67%|██████▋   | 8/12 [00:20<00:12,  3.13s/it]
Total progress:  95%|█████████▌| 59/62 [01:11<00:10,  3.36s/it]
75%|███████▌  | 9/12 [00:24<00:09,  3.21s/it]
Total progress:  97%|█████████▋| 60/62 [01:14<00:06,  3.37s/it]
83%|████████▎ | 10/12 [00:27<00:06,  3.27s/it]
Total progress:  98%|█████████▊| 61/62 [01:17<00:03,  3.39s/it]
92%|█████████▏| 11/12 [00:31<00:03,  3.32s/it]
Total progress: 100%|██████████| 62/62 [01:21<00:00,  3.40s/it]
100%|██████████| 12/12 [00:34<00:00,  3.35s/it]
100%|██████████| 12/12 [00:34<00:00,  2.87s/it]
[Tiled VAE]: input_size: torch.Size([1, 4, 304, 208]), tile_size: 128, padding: 11
[Tiled VAE]: split to 3x2 = 6 tiles. Optimal tile size 96x96, original tile size 128x128
[Tiled VAE]: Fast mode enabled, estimating group norm parameters on 87 x 128 image
[Tiled VAE]: Executing Decoder Task Queue:   0%|          | 0/738 [00:00[Tiled VAE]: Executing Decoder Task Queue:  17%|█▋        | 124/738 [00:00<00:02, 219.88it/s]
[Tiled VAE]: Executing Decoder Task Queue:  33%|███▎      | 247/738 [00:01<00:02, 225.79it/s]
[Tiled VAE]: Executing Decoder Task Queue:  50%|█████     | 370/738 [00:01<00:01, 221.56it/s]
[Tiled VAE]: Executing Decoder Task Queue:  67%|██████▋   | 493/738 [00:02<00:01, 225.22it/s]
[Tiled VAE]: Executing Decoder Task Queue:  83%|████████▎ | 616/738 [00:02<00:00, 226.98it/s]
[Tiled VAE]: Executing Decoder Task Queue: 100%|██████████| 738/738 [00:03<00:00, 227.99it/s]
[Tiled VAE]: Done in 4.163s, max VRAM alloc 8993.640 MB
0: 640x448 2 faces, 8.1ms
Speed: 3.4ms preprocess, 8.1ms inference, 1.2ms postprocess per image at shape (1, 3, 640, 448)
tiled upscale:   0%|          | 0/4 [00:00tiled upscale:  25%|██▌       | 1/4 [00:00<00:00,  4.37it/s]
tiled upscale:  50%|█████     | 2/4 [00:00<00:00,  4.08it/s]
tiled upscale:  75%|███████▌  | 3/4 [00:00<00:00,  4.20it/s]
tiled upscale: 100%|██████████| 4/4 [00:00<00:00,  4.26it/s]
tiled upscale: 100%|██████████| 4/4 [00:00<00:00,  4.24it/s]
[Tiled VAE]: the input size is tiny and unnecessary to tile.
  0%|          | 0/18 [00:00  6%|▌         | 1/18 [00:00<00:03,  4.96it/s]
11%|█         | 2/18 [00:00<00:04,  3.47it/s]
17%|█▋        | 3/18 [00:00<00:04,  3.26it/s]
22%|██▏       | 4/18 [00:01<00:04,  3.15it/s]
28%|██▊       | 5/18 [00:01<00:04,  2.72it/s]
33%|███▎      | 6/18 [00:02<00:05,  2.14it/s]
39%|███▉      | 7/18 [00:02<00:05,  1.88it/s]
44%|████▍     | 8/18 [00:03<00:05,  1.74it/s]
50%|█████     | 9/18 [00:04<00:05,  1.65it/s]
56%|█████▌    | 10/18 [00:05<00:05,  1.59it/s]
61%|██████    | 11/18 [00:05<00:04,  1.55it/s]
67%|██████▋   | 12/18 [00:06<00:03,  1.53it/s]
72%|███████▏  | 13/18 [00:07<00:03,  1.35it/s]
78%|███████▊  | 14/18 [00:07<00:02,  1.56it/s]
83%|████████▎ | 15/18 [00:08<00:01,  1.53it/s]
89%|████████▉ | 16/18 [00:09<00:01,  1.51it/s]
94%|█████████▍| 17/18 [00:09<00:00,  1.50it/s]
100%|██████████| 18/18 [00:10<00:00,  1.49it/s]
100%|██████████| 18/18 [00:10<00:00,  1.72it/s]
[Tiled VAE]: input_size: torch.Size([1, 4, 152, 104]), tile_size: 128, padding: 11
[Tiled VAE]: split to 2x1 = 2 tiles. Optimal tile size 96x96, original tile size 128x128
[Tiled VAE]: Fast mode enabled, estimating group norm parameters on 87 x 128 image
[Tiled VAE]: Executing Decoder Task Queue:   0%|          | 0/246 [00:00[Tiled VAE]: Executing Decoder Task Queue:  50%|█████     | 124/246 [00:00<00:00, 252.54it/s]
[Tiled VAE]: Executing Decoder Task Queue: 100%|██████████| 246/246 [00:00<00:00, 340.98it/s]
[Tiled VAE]: Done in 1.645s, max VRAM alloc 8687.980 MB
Total progress: 100%|██████████| 62/62 [01:41<00:00,  3.40s/it]
Total progress: 100%|██████████| 62/62 [01:41<00:00,  1.64s/it]
==> /var/log/supervisor/serviceportal.log <==
INFO:     222.102.206.168:0 - "POST /ajax/processes HTTP/1.1" 200 OK
INFO:     222.102.206.168:0 - "GET /favicon.ico HTTP/1.1" 307 Temporary Redirect
INFO:     222.102.206.168:0 - "GET / HTTP/1.1" 200 OK
INFO:     222.102.206.168:0 - "POST /ajax/logs HTTP/1.1" 200 OK
INFO:     222.102.206.168:0 - "GET /favicon.ico HTTP/1.1" 307 Temporary Redirect
INFO:     222.102.206.168:0 - "GET / HTTP/1.1" 200 OK
INFO:     ('222.102.206.168', 0) - "WebSocket /ai-dock/logtail.sh" [accepted]
INFO:     connection open
INFO:     222.102.206.168:0 - "POST /ajax/processes HTTP/1.1" 200 OK
INFO:     222.102.206.168:0 - "GET /favicon.ico HTTP/1.1" 307 Temporary Redirect
INFO:     222.102.206.168:0 - "GET / HTTP/1.1" 200 OK
==> /var/log/supervisor/supervisor.log <==
2024-07-26 12:38:39,500 INFO waiting for webui to stop
2024-07-26 12:38:39,507 INFO stopped: webui (terminated by SIGTERM)
2024-07-26 12:38:39,510 INFO spawned: 'webui' with pid 6964
==> /var/log/supervisor/webui.log <==
Virtual environment 'serviceportal' set at /opt/environments/python/serviceportal.
Virtual environment 'webui' set at /opt/environments/python/webui.
Starting A1111 SD Web UI...
Starting A1111 SD Web UI...
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
Version: v1.10.0-RC-60-g8b3d98c5
Commit hash: 8b3d98c5a580c3c72e82d03fdab2b643bf9a8edd
Launching Web UI with arguments: --xformers --theme dark --precision half --enable-insecure-extension-access --port 17860
==> /var/log/supervisor/serviceportal.log <==
INFO:     222.102.206.168:0 - "POST /ajax/processes/restart HTTP/1.1" 200 OK
==> /var/log/supervisor/supervisor.log <==
2024-07-26 12:38:45,298 INFO success: webui entered RUNNING state, process has stayed up for > than 5 seconds (startsecs)
==> /var/log/supervisor/webui.log <==
ldm/sgm GroupNorm32 replaced with normal torch.nn.GroupNorm due to `--precision half`.
Tag Autocomplete: Could not locate model-keyword extension, Lora trigger word completion will be limited to those added through the extra networks menu.
[-] ADetailer initialized. version: 24.6.0, num models: 10
Loading weights [bb5fc92172] from /workspace/stable-diffusion-webui/models/Stable-diffusion/goddessOfRealism_gorPONYBeta.safetensors
Running on local URL:  http://127.0.0.1:17860
To create a public link, set `share=True` in `launch()`.
Startup time: 11.6s (prepare environment: 2.1s, import torch: 3.9s, import gradio: 1.1s, setup paths: 1.6s, initialize shared: 0.2s, other imports: 0.5s, load scripts: 1.1s, create ui: 0.9s, gradio launch: 0.2s).
Creating model from config: /workspace/stable-diffusion-webui/repositories/generative-models/configs/inference/sd_xl_base.yaml
/opt/environments/python/webui/lib/python3.10/site-packages/huggingface_hub/file_download.py:1132: FutureWarning: `resume_download` is deprecated and will be removed in version 1.0.0. Downloads always resume when possible. If you want to force a new download, use `force_download=True`.
  warnings.warn(
Loading VAE weights specified in settings: /workspace/stable-diffusion-webui/models/VAE/sdxl.vae.safetensors
Applying attention optimization: xformers... done.
Model loaded in 5.4s (load weights from disk: 1.2s, create model: 0.7s, apply weights to model: 2.9s, load VAE: 0.1s, move model to device: 0.1s).

List of installed extensions

https://github.com/DominikDoom/a1111-sd-webui-tagcomplete https://github.com/pkuliyi2015/multidiffusion-upscaler-for-automatic1111 https://github.com/Bing-su/adetailer https://github.com/adieyal/sd-dynamic-prompts https://github.com/hako-mikan/sd-webui-regional-prompter

dosubot[bot] commented 2 months ago

ADetailer가 신뢰도 숫자가 낮은 얼굴을 수정하는 이유는 mediapipe_predict 함수에서 사용되는 confidence 매개변수 때문일 가능성이 큽니다. 기본값이 0.3으로 설정되어 있어, 신뢰도 점수가 0.3 이하인 얼굴만 수정됩니다. 이를 해결하려면 confidence 값을 더 높은 값으로 조정해 보세요. 예를 들어, confidence를 0.7로 설정하면 신뢰도 점수가 0.7 이하인 얼굴도 수정됩니다.

다음은 관련 코드 스니펫입니다:

def mediapipe_predict(
    model_type: str, image: Image.Image, confidence: float = 0.3
) -> PredictOutput:
    ...

이 설정을 조정하려면 다음과 같이 confidence 값을 변경하세요:

mediapipe_predict(model_type="mediapipe_face_full", image=your_image, confidence=0.7)

이렇게 하면 신뢰도 점수가 높은 얼굴도 수정 대상에 포함됩니다 [1][2].

To continue talking to Dosu, mention @dosu.

Bing-su commented 2 months ago

특정 부분만 인페인팅을 적용하고 싶으신 경우, 저는 adetailer를 끄고 이미지를 img2img탭으로 보내서 직접 영역을 지정하길 권해드립니다.

Ineman commented 2 months ago

원래 adetailer의 기능 자체가, 첫번째로 수정될 얼굴을 고르는 기준이 저 인식점수가 아닌건가요?