huggingface / huggingface/diffusers

Controlnet inpainting change too much of masking area

オープン
#7,796 コメント 6 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug stale
主要言語
Python
スター
34.5k
フォーク
7.3k
平均マージ
3日 3時間
マージ済み PR(30日)
91

説明

### Describe the bug

mask

![download-30](https://github.com/huggingface/diffusers/assets/1147704/96ef8de3-88f8-47a7-8c48-a83c567d09fc)

![download-29](https://github.com/huggingface/diffusers/assets/1147704/0286b4b3-0fe6-439c-b4b7-95dec25ee077)

i got mask with this

```
def make_inpaint_condition (image, image_mask):
image = np.array(image.convert("RGB")).astype(np.float32) / 255.0
image_mask = np.array(image_mask.convert("L")).astype(np.float32) / 255.0

assert image.shape[0:1] == image_mask.shape[0:1], "image and image_mask must have the same image size"
image[image_mask > 0.5] = -1.0 # set as masked pixel
image = np.expand_dims(image, 0).transpose(0, 3, 1, 2)
image = torch.from_numpy(image)
return image
```

if use apply mask still bad around edge

```python
output_image = pipe.image_processor.apply_overlay(mask_image1, input_image, output_image)
```

![download-31](https://github.com/huggingface/diffusers/assets/1147704/877bf347-57a9-44a6-b9aa-a5e26ed40d0c)

image

Because there are too many noise below, the one above cannot cover them.

is it possible to preserve mask area?

---

and below is when i use compel without DiffusersTextualInversionManager

the color changed, but it looks cloth is original

https://github.com/damian0815/compel/issues/86

![image](https://github.com/huggingface/diffusers/assets/1147704/0ef91cb6-5ca3-4834-bac1-edecf9646b69)

### Reproduction

code from here

https://huggingface.co/docs/diffusers/en/using-diffusers/controlnet

### Logs

```shell
no log
```

### System Info

0.27.2

### Who can help?

_No response_

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

ControlNet のドキュメントの再現から始め、示されている make_inpaint_condition 関数と image_processor.apply_overlay の呼び出しを調べます。提供された例におけるマスク処理と生成されたエッジを比較し、その後、その動作が想定どおりなのかバグなのかを判断します。再現可能な結果を確立し、報告されたエッジノイズなしで意図したマスク領域を保持できれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python, pytorch
領域
computer-vision, machine-learning
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。