- Original UยฒNet implementation:
- https://github.com/xuebinqin/U-2-Net
# Paper: Uยฒ-Net: Going Deeper with Nested U-Structure for Salient Object Detection (Pattern Recognition, 2020)
- Licenses
- โ์๋ณธ์ Apache License 2.0์ ๋ฐ๋ฆ
๋๋ค. ๋ณํ๋ณธ์ safetensors๋ก ์ ์๋์์ต๋๋ค.โ
์ฌ์ค์ u2Net์ ์ฝ๋๋ฅผ ์ง์ ์ฐธ๊ณ ํ๊ณ ์์ผ๋ฏ๋ก ์ ๋ ๋ผ์ด์ ์ค๋ฅผ ๋๋์ง ์์๊ณ ,
์ํ์น ๋ผ์ด์ ์ค ์ ๋ฌธ์ ํฌํจํ ์ธ๋ถ ๋ผ์ด์ ์ค๋ ๋ชจ๋ exterlal licenses์ ๋ค์ด๊ฐ ์์ต๋๋ค.
- Pretrained Models Used
- https://github.com/xuebinqin/U-2-Net
# Paper: Uยฒ-Net: Going Deeper with Nested U-Structure for Salient Object Detection (Pattern Recognition, 2020)
- Source:
- https://github.com/xuebinqin/U-2-Net
####bgrem V.2.25#### ์ด ํ๋ก์ ํธ๋ comfyui092 ์ดํ ๋ฐ ์ต์ ๋ฒ์ ์์๋ ๋์ํฉ๋๋ค. ์ฒ๋ฆฌ์ ๊ทธ๋ํฝ์นด๋๋ฅผ ์ฌ์ฉํ์ง ์์ต๋๋ค. CPU์์๋ ๊ธฐ๋๋๋ฏ๋ก AMD์์๋ ์๋ํ ์ ์์๊ฒ๋๋ค.
####bgrem์ ๋ค์ ์์น์ ๊ธฐ๋ฐ์ผ๋ก ์ค๊ณ๋์์ต๋๋ค#### โข ํ๊ฒฝ ์์ ์ฑ ์ต์ฐ์ โข ๊ฒฐ์ ์ฑ 100% (Portable ํ๊ฒฝ์์๋ ๋์ผ ๊ฒฐ๊ณผ) โข ์ ์ง๋ณด์ ๊ฐ๋ฅํ ๊ตฌ์กฐ โขStable Diffusion ๋ชจ๋ธ ๊ธฐ๋ฐ์ ์ฌ์ฉํ์ง ์๋ ComfyUI Standalone ํ๊ฒฝ์์์ ์์ ์ฑ์ ๋ฌด๋๋จ๋ฆฌ์ง ์๋ ํํ๋ฅผ ์งํฅํฉ๋๋ค.
Original UยฒNet implementation:
https://github.com/xuebinqin/U-2-Net # Paper: Uยฒ-Net: Going Deeper with Nested U-Structure for Salient Object Detection (Pattern Recognition, 2020)
Licenses
- Original UยฒNet implementation: MIT License (see external_licenses/U2Net-MIT.txt)Apache License 2.0 (see external_licenses/Apache-2.0.txt)
- Cloth Segmentation model: openrail
- Converted versions: safetensors format, for efficiency in use
โ์๋ณธ์ Apache License 2.0์ ๋ฐ๋ฆ ๋๋ค. ๋ณํ๋ณธ์ safetensors๋ก ์ ์๋์์ต๋๋ค.โ ์ฌ์ค์ u2Net์ ์ฝ๋๋ฅผ ์ง์ ์ฐธ๊ณ ํ๊ณ ์์ผ๋ฏ๋ก ์ ๋ ๋ผ์ด์ ์ค๋ฅผ ๋๋์ง ์์๊ณ , ์ํ์น ๋ผ์ด์ ์ค ์ ๋ฌธ์ ํฌํจํ ์ธ๋ถ ๋ผ์ด์ ์ค๋ ๋ชจ๋ exterlal licenses์ ๋ค์ด๊ฐ ์์ต๋๋ค.
Pretrained Models Used
- u2net.pth (salient object detection, general)
- u2net_human_seg.pth (human segmentation)
Source:
https://github.com/xuebinqin/U-2-Net
-๊ธฐ๋ณธ์ ์ธ ์์ค์ ๋ชจ๋ธ์ ์ฌ๊ธฐ์ ๊ฐ์ ธ์์ต๋๋ค.
ํด๋น PTH๋ ๋ชจ๋ ์ฉ๋ ์ ๊ฐ์ ์ํด ๊ฐ์ธ์ฌ์ฉ์ค์ธ ๋ณํ๊ธฐ๋ก ์ธ์ดํํ ์๋ก ๋ณํํด ์ฌ์ฉ ์ค์ ๋๋ค.
###requirements.txt๊ฐ ๋น์ด ์๋ ์ด์ ### ComfyUI๋ ํ์ฅํฉ ๋ก๋ฉ ์ requirements.txt๋ฅผ ์๋ ์ค์นํฉ๋๋ค. ๊ทธ๋ฌ๋ pip๋ git์ ํตํ ์๊ฒฉ์ค์น ๋ฐฉ์์ ํ๊ฒฝ ์์ ์ํ์ด ๋งค์ฐ ๋๊ธฐ ๋๋ฌธ์, requirements.txt๋ฅผ ๋น ํ์ผ๋ก ์ ์งํฉ๋๋ค.
๋์ , ๋ค์์ ์ฝ๋๋ก ์์กด์ฑ ์ค์น๋ฒ์ ๋จ๊น๋๋ค: #---------------- #์์กด์ฑ ํ์ ๋ฆฌ์คํธ #---------------- numpy pillow opencv-python torch torchvision lazy_loader tifffile scipy scikit-image #---------------- #----------------------------------------------------
python.exe -m pip install --no-deps numpy(ํฌํฐ๋ธ์ ํ ํ์๊ฐ ์์.) python.exe -m pip install --no-deps pillow python.exe -m pip install --no-deps opencv-python python.exe -m pip install --no-deps torch python.exe -m pip install --no-deps torchvision python.exe -m pip install --no-deps lazy_loader python.exe -m pip install --no-deps tifffile python.exe -m pip install --no-deps scipy python.exe -m pip install --no-deps scikit-image
#---------------------------------------------------- Comfyui ๊ธฐ๋ณธ ์ค์น์ ํด๋นํ๋ torch, torchvision, torchAudio๋ ๋น์ฐํ ์ค์นํ์๊ฑฐ๋ผ ์ ์ธํ์ต๋๋ค. ์ ํจํค์ง๋ค์ BGRemover์์ ์ฃผ๋ก ์ฌ์ฉํ๋ ์์ ํ ์ต์ ์์กด์ฑ์ ๋๋ค. ๋ก๋์ ์๋ ๋ถ๊ฐ๊ฐ ๋์ค๋ ๊ฒ๋ง ์ถ๊ฐ์ค์นํ์ธ์. ์ ์์กด์ฑ ์ดํ์ ์ถ๊ฐ์ค์น๋ ์ ํ ์ฌํญ์ด๋ฉฐ, ๋๋ถ๋ถ์ ๊ธฐ๋ฅ์ ๊ธฐ๋ณธ ์ํ์์๋ ์๋ํฉ๋๋ค.
[์ค์น ๋ฐฉ๋ฒ]
Installation:
ZIP ๋ค์ด๋ก๋: ์ ์ฅ์๋ฅผ .zip ํ์ผ๋ก ๋ค์ด๋ก๋ํฉ๋๋ค.
custom_nodes ํด๋์ ๋ฐฐ์น: ์์ถ์ ํ๊ณ ComfyUI/custom_nodes ํด๋์ ๋ฃ์ต๋๋ค.
ComfyUI ์ฌ์์: ์ฌ์์ํ๋ฉด ๋ ธ๋๊ฐ ๋ก๋๋ฉ๋๋ค.
####bgrem Node Usage####
[Auto Nodes]
BGRemover_Background ๋ฐฐ๊ฒฝ ์ค์ฌ ์๋๋ง์คํฌ
- node_id: BGRemover_Background
- category: ๋ฆฌ๋ฌด๋ฒ/์๋
- ์ญํ : ์ด๋ฏธ์ง์์ ๋ฐฐ๊ฒฝ๋ฐํ์ผ๋ก ๋ง์คํฌ ์๋์ ํ. ์ธ๋ฒํธ๋ก ์ง์ ๋ณํ ๊ฐ๋ฅ.
- Inputs: image ์ ๋ ฅ ์ด๋ฏธ์ง
- Inputs: stage ์ฌ์ฉํ ์คํ ์ด์ง ์ ํ
- Inputs: ์ฆํญ๊ฒ์ถ
- Inputs: invert ์ ํ๋ฐ์
- Inputs: gamma ๊ฐ๋ง์กฐ์
- Inputs: clahe ํด๋ผํค ๋ณด์
- Outputs: mask
BGRemoverMaskBackground ๋ฐฐ๊ฒฝ ์ค์ฌ ์๋๋ง์คํฌ(๋ง์คํฌ์ ๋ ฅ)
- node_id: BGRemoverMaskBackground
- category: ๋ฆฌ๋ฌด๋ฒ/์๋
- ์ญํ : ๋ง์คํฌ์์ ๋ฐฐ๊ฒฝ๋ฐํ์ผ๋ก ๋ง์คํฌ ์๋์ ํ. ์ธ๋ฒํธ๋ก ์ง์ ๋ณํ ๊ฐ๋ฅ.
- Inputs: Mask ์ ๋ ฅ ๋ง์คํฌ
- Inputs: stage ์ฌ์ฉํ ์คํ ์ด์ง ์ ํ
- Inputs: ์ฆํญ๊ฒ์ถ
- Inputs: invert ์ ํ๋ฐ์
- Inputs: gamma ๊ฐ๋ง์กฐ์
- Inputs: clahe ํด๋ผํค ๋ณด์
- Outputs: mask
BGRemover_Human ์ธ๋ฌผ ์ค์ฌ ์๋๋ง์คํฌ
- node_id: BGRemover_Human
- category: ๋ฆฌ๋ฌด๋ฒ/์๋
- ์ญํ : ์ด๋ฏธ์ง์์ ์ฌ๋ ๊ธฐ์ค์ผ๋ก ๋ง์คํฌ ์๋์ ํ. ์ธ๋ฒํธ๋ก ์ง์ ๋ณํ ๊ฐ๋ฅ.
- Inputs: image ์ ๋ ฅ ์ด๋ฏธ์ง
- Inputs: stage ์ฌ์ฉํ ์คํ ์ด์ง ์ ํ
- Inputs: ์ฆํญ๊ฒ์ถ
- Inputs: invert ์ ํ๋ฐ์
- Inputs: gamma ๊ฐ๋ง์กฐ์
- Inputs: clahe ํด๋ผํค ๋ณด์
- Outputs: mask ๋ง์คํฌ์ถ๋ ฅ
BGRemoverMaskHuman ์ธ๋ฌผ ์ค์ฌ ์๋๋ง์คํฌ(๋ง์คํฌ์ ๋ ฅ)
- node_id: BGRemoverMaskHuman
- category: ๋ฆฌ๋ฌด๋ฒ/์๋
- ์ญํ : ๋ง์คํฌ์์ ์ฌ๋ ๊ธฐ์ค์ผ๋ก ๋ง์คํฌ ์๋์ ํ. ์ธ๋ฒํธ๋ก ์ง์ ๋ณํ ๊ฐ๋ฅ.
- Inputs: Mask ์ ๋ ฅ ๋ง์คํฌ
- Inputs: stage ์ฌ์ฉํ ์คํ ์ด์ง ์ ํ
- Inputs: ์ฆํญ๊ฒ์ถ
- Inputs: invert ์ ํ๋ฐ์
- Inputs: gamma ๊ฐ๋ง์กฐ์
- Inputs: clahe ํด๋ผํค ๋ณด์
- Outputs: mask ๋ง์คํฌ์ถ๋ ฅ
[SemiAuto Nodes]
BGRemover_BackgroundAdv ๋ฐฐ๊ฒฝ ์ค์ฌ ๋ฐ์๋๋ง์คํฌ
- node_id: BGRemover_BackgroundAdv
- category: ๋ฆฌ๋ฌด๋ฒ/๋ฐ์๋
- ์ญํ : ์ด๋ฏธ์ง์์ ๋ฐฐ๊ฒฝ๋ฐํ์ผ๋ก ๋ง์คํฌ ์๋์ ํ+์ ์ ๋ง์คํฌ ์ฃผ์ ๊ฐ๋ฅ. ์ธ๋ฒํธ๋ก ์ง์ ๋ณํ ๊ฐ๋ฅ.
- Inputs: image ์ ๋ ฅ ์ด๋ฏธ์ง
- Inputs: stage ์ฌ์ฉํ ์คํ ์ด์ง ์ ํ
- Inputs: ์ฆํญ๊ฒ์ถ
- Inputs: invert ์ ํ๋ฐ์
- Inputs: gamma ๊ฐ๋ง์กฐ์
- Inputs: clahe ํด๋ผํค ๋ณด์
- Inputs: (์ ํ)mask ์ฌ์ฉ์ ์ถ๊ฐ ๋ง์คํฌ
- Inputs: (์ ํ)blend_mode ๋ง์คํฌ ํฉ์ฑ ๋ฐฉ์
- Outputs: mask ๋ง์คํฌ์ถ๋ ฅ
BGRemoverMaskBackgroundAdv ๋ฐฐ๊ฒฝ ์ค์ฌ ๋ฐ์๋๋ง์คํฌ(๋ง์คํฌ)
- node_id: BGRemoverMaskBackgroundAdv
- category: ๋ฆฌ๋ฌด๋ฒ/๋ฐ์๋
- ์ญํ : ์ด๋ฏธ์ง์์ ๋ฐฐ๊ฒฝ๋ฐํ์ผ๋ก ๋ง์คํฌ ์๋์ ํ+์ ์ ๋ง์คํฌ ์ฃผ์ ๊ฐ๋ฅ. ์ธ๋ฒํธ๋ก ์ง์ ๋ณํ ๊ฐ๋ฅ.
- Inputs: Mask ์ ๋ ฅ ๋ง์คํฌ
- Inputs: stage ์ฌ์ฉํ ์คํ ์ด์ง ์ ํ
- Inputs: ์ฆํญ๊ฒ์ถ
- Inputs: invert ์ ํ๋ฐ์
- Inputs: gamma ๊ฐ๋ง์กฐ์
- Inputs: clahe ํด๋ผํค ๋ณด์
- Inputs: (์ ํ)mask ์ฌ์ฉ์ ์ถ๊ฐ ๋ง์คํฌ
- Inputs: (์ ํ)blend_mode ๋ง์คํฌ ํฉ์ฑ ๋ฐฉ์
- Outputs: mask ๋ง์คํฌ์ถ๋ ฅ
BGRemover_HumanAdv ์ธ๋ฌผ ์ค์ฌ ๋ฐ์๋ ๋ง์คํฌ
- node_id: BGRemover_HumanAdv
- category: ๋ฆฌ๋ฌด๋ฒ/๋ฐ์๋
- ์ญํ : ์ด๋ฏธ์ง์์ ์ฌ๋ ๊ธฐ์ค์ผ๋ก ์๋์ ํ+์ ์ ๋ง์คํฌ ์ฃผ์ ๊ฐ๋ฅ. ์ธ๋ฒํธ๋ก ์ง์ ๋ณํ ๊ฐ๋ฅ.
- Inputs: image ์ ๋ ฅ ์ด๋ฏธ์ง
- Inputs: stage ์ฌ์ฉํ ์คํ ์ด์ง ์ ํ
- Inputs: ์ฆํญ๊ฒ์ถ
- Inputs: invert ์ ํ๋ฐ์
- Inputs: gamma ๊ฐ๋ง์กฐ์
- Inputs: clahe ํด๋ผํค ๋ณด์
- Inputs: (์ ํ)mask ์ฌ์ฉ์ ์ถ๊ฐ ๋ง์คํฌ
- Inputs: (์ ํ)blend_mode ๋ง์คํฌ ํฉ์ฑ ๋ฐฉ์
- Outputs: mask ๋ง์คํฌ์ถ๋ ฅ
BGRemoverMaskHumanAdv ์ธ๋ฌผ ์ค์ฌ ๋ฐ์๋ ๋ง์คํฌ(๋ง์คํฌ)
- node_id: BGRemoverMaskHumanAdv
- category: ๋ฆฌ๋ฌด๋ฒ/๋ฐ์๋
- ์ญํ : ์ด๋ฏธ์ง์์ ์ฌ๋ ๊ธฐ์ค์ผ๋ก ์๋์ ํ+์ ์ ๋ง์คํฌ ์ฃผ์ ๊ฐ๋ฅ. ์ธ๋ฒํธ๋ก ์ง์ ๋ณํ ๊ฐ๋ฅ.
- Inputs: mask ์ ๋ ฅ ์ด๋ฏธ์ง
- Inputs: stage ์ฌ์ฉํ ์คํ ์ด์ง ์ ํ
- Inputs: ์ฆํญ๊ฒ์ถ
- Inputs: invert ์ ํ๋ฐ์
- Inputs: gamma ๊ฐ๋ง์กฐ์
- Inputs: clahe ํด๋ผํค ๋ณด์
- Inputs: (์ ํ)mask ์ฌ์ฉ์ ์ถ๊ฐ ๋ง์คํฌ
- Inputs: (์ ํ)blend_mode ๋ง์คํฌ ํฉ์ฑ ๋ฐฉ์
- Outputs: mask ๋ง์คํฌ์ถ๋ ฅ
[Processing Nodes]
BGTileSoftFillng ํ์ผ๋ง ๋ณด์ ์ฑ์ฐ๊ธฐ
- node_id: BGTileSoftFillng
- category: ๋ฆฌ๋ฌด๋ฒ/์ ํธ
- ์ญํ : pytorch๊ธฐ๋ฐ ํ์ผ๋ง ์ฑ์ฐ๊ธฐ. ๋ถ๋ถ์ด๋ฏธ์ง ๋ณด์ ์ฉ์ผ๋ก ์ธ ์ ์์ต๋๋ค.
- Inputs: image ๋ฏธ๋ฆฌ ์๋ผ๋ ์ด๋ฏธ์ง
- canvas_width: ์บ๋ฒ์ค X์ถ ํฌ๊ธฐ๋งํผ ๋น๋ก ํ์ผ๋งํ ํฝ์ ๊น์ด
- canvas_height: ์บ๋ฒ์ค Y์ถ ํฌ๊ธฐ๋งํผ ๋น๋ก ํ์ผ๋งํ ํฝ์ ๊น์ด
- rematch:ํ์ผํ ์ฒ๋ฆฌ์ ๊ฒฝ๊ณ๋ฉด์ ๋ฎ์ด ์ํ๊ฐ์ ๋ณด์ ํ ์ค๋ณต ๊ฒน์น๊ธฐ ํ์
- Outputs: image
BGMasksubeditor ๋ง์คํฌ ์๋ธ์๋ํฐ
- node_id: BGMasksubeditor
- category: ๋ฆฌ๋ฌด๋ฒ/์ ํธ
- ์ญํ : pytorch๊ธฐ๋ฐ ๋ง์คํฌ ์ง์ฐ๊ฐ. ์ง์ธ์์ญ๋งํผ์ ์์ ํ ๋ง์คํฌ๋ฅผ ๋ฃ๊ณ ๋นผ๋ ๊ฒ์ผ๋ก ๋ง์คํฌ ๋ถ๋ถ ๋ณด์ ์ฉ์ผ๋ก ์ธ ์ ์์ต๋๋ค.
- Inputs: mask ์์ ์์ ํ ๋ง์คํฌ
- Inputs: mask ์ง์ธ ์์ญ์ ๊ทธ๋ฆฐ ๋ง์คํฌ
- subtract_mode:์ ๊ฑฐ ๋ฐฉ์. ์์ ์ ๊ฑฐ-๋ถ๋ถ์ ๊ฑฐ-์ฐจ์ด๊ฐ๋ง ๋จ๊น (์ ์ ๋ง์คํฌ ํน์ ๋ฒ ์ด์ค๊ฐ ๋์๋ถ๋ถ์ ๊ทธ๋๋ก ์ ์ฉ)์ด ์์ต๋๋ค.
- blur_mode:๋ธ๋ฌ ์ ํ . ๋ธ๋ฌ ๋ฏธ์ ์ฉ, ์ํํธ์ ํ๋๊ฐ ์์ต๋๋ค.
- blur_strength:๋ธ๋ฌ ์ปค๋ ํฌ๊ธฐ
- add_mask:(์ ํ)๋ง๋ถ์ผ ์ถ๊ฐ ๋ง์คํฌ
- Outputs: mask
BGmask_CompositeAdv ์ฝคํฌ์ง ๋ง์คํฌ ์ด๋๋ฐด์ค
- node_id: BGmask_CompositeAdv
- category: ๋ฆฌ๋ฌด๋ฒ/์ ํธ
- ์ญํ : pytorch๊ธฐ๋ฐ ๋ง์คํฌ ์ง์ฐ๊ฐ. ์ง์ธ์์ญ๋งํผ์ ์์ ํ ๋ง์คํฌ๋ฅผ ๋ฃ๊ณ ๋นผ๋ ๊ฒ์ผ๋ก ๋ง์คํฌ ๋ถ๋ถ ๋ณด์ ์ฉ์ผ๋ก ์ธ ์ ์์ต๋๋ค.
- Inputs: mask ์์ ์์ ํ ๋ง์คํฌ
- Inputs: mask ์ง์ธ ์์ญ์ ๊ทธ๋ฆฐ ๋ง์คํฌ
- subtract_mode:์ ๊ฑฐ ๋ฐฉ์. ์์ ์ ๊ฑฐ-๋ถ๋ถ์ ๊ฑฐ-์ฐจ์ด๊ฐ๋ง ๋จ๊น (์ ์ ๋ง์คํฌ ํน์ ๋ฒ ์ด์ค๊ฐ ๋์๋ถ๋ถ์ ๊ทธ๋๋ก ์ ์ฉ)์ด ์์ต๋๋ค.
- blur_mode:๋ธ๋ฌ ์ ํ . ๋ธ๋ฌ ๋ฏธ์ ์ฉ, ์ํํธ์ ํ๋๊ฐ ์์ต๋๋ค.
- blur_strength:๋ธ๋ฌ ์ปค๋ ํฌ๊ธฐ
- add_mask:(์ ํ)๋ง๋ถ์ผ ์ถ๊ฐ ๋ง์คํฌ
- add_mask:(์ ํ)๋ง๋ถ์ผ ์ถ๊ฐ ๋ง์คํฌ
- add_mask:(์ ํ)๋ง๋ถ์ผ ์ถ๊ฐ ๋ง์คํฌ
- add_mask:(์ ํ)๋ง๋ถ์ผ ์ถ๊ฐ ๋ง์คํฌ
- add_mask:(์ ํ)๋ง๋ถ์ผ ์ถ๊ฐ ๋ง์คํฌ
- Outputs: mask
BGRemoverMaskAmplier ๋ง์คํฌ ์ฆํญ๊ธฐ
- node_id: BGRemoverMaskAmplier
- category: ๋ฆฌ๋ฌด๋ฒ/์ ํธ
- ์ญํ : ๋ง์คํฌ๋ฅผ ์ ๋ ฅํด์ ๋ถ๋ถ์ฆํญ ๋ฐ ์ ์ฒด์ฆํญ, ์ถ๊ฐ์ฒ๋ฆฌ๋ฅผ ํฉ๋๋ค.
- Inputs: mask ์ ๋ ฅ ๋ง์คํฌ
- Inputs: ์ฆํญ๊ฒ์ถ
- Inputs: invert ์ ํ๋ฐ์
- Inputs: gamma ๊ฐ๋ง์กฐ์
- Inputs: clahe ํด๋ผํค ๋ณด์
- Inputs: (์ ํ)mask ์ฌ์ฉ์ ์ถ๊ฐ ๋ง์คํฌ
- Inputs: (์ ํ)blend_mode ๋ง์คํฌ ํฉ์ฑ ๋ฐฉ์
- Inputs: (์ ํ)๋ถ๋ถ๊ฐ์กฐ
- Inputs: (์ ํ)๋ถ๋ถ๊ฐ์กฐ ๊ฐ๋
- Outputs: mask ๋ง์คํฌ์ถ๋ ฅ