README_CN.md
June 1, 2025 · View on GitHub
支持使用新老版本BiRefNet模型进行抠图
预览

安装
- 手动安装
cd custom_nodes
git clone https://github.com/lldacing/ComfyUI_BiRefNet_ll.git
cd ComfyUI_BiRefNet_ll
pip install -r requirements.txt
# restart ComfyUI
- ComfyUI管理器搜索安装
模型
最新的模型:
- General: 用于一般用例的预训练模型。
- General-HR: 用于一般用例的预训练模型,在更高分辨率的图像上表现出色(训练分辨率2048x2048)。
- General-Lite: 用于一般用例的轻量级预训练模型。
- General-Lite-2K: 用于一般用例的轻量级预训练模型,适用于高分辨率图像(最佳分辨率2560x1440)。
- General-dynamic: 用于动态分辨率的预训练模型,基于256x256到2304x2304的图片分辨率进行训练。
- General-reso_512: 一个更快、更准确的低分辨率预训练模型,基于512x512的图像训练。
- General-legacy: 一般用例的预训练模型,基于DIS5K-TR,DIS-TEs, DUTS-TR_TE,HRSOD-TR_TE,UHRSD-TR_TE, HRS10K-TR_TE (w/o portrait seg data)。
- Portrait: 人物肖像预训练模型。
- Matting: 一种使用无过渡遮罩抠图的预训练模型。
- Matting-HR: 在更高分辨率的图像上显示出出色的性能的预训练模型 (2048x2048)。
- Matting-Lite: 用一般用例的无过渡遮罩抠图的轻量级预训练模型。
- DIS: 一种用于二分图像分割(DIS)的预训练模型。
- HRSOD: 一种用于高分辨率显著目标检测(HRSOD)的预训练模型。
- COD: 一种用于隐蔽目标检测(COD)的预训练模型。
- DIS-TR_TEs: 具有大量数据集的预训练模型。
模型文件放在${comfyui_rootpath}/models/BiRefNet(当使用AutoDownloadBiRefNetModel时,则会自动下载模型)。
也可以手动下载模型:
- General ➔
model.safetensors重命名为General.safetensors - General-HR ➔
model.safetensors重命名为General-HR.safetensors - General-Lite ➔
model.safetensors重命名为General-Lite.safetensors - General-Lite-2K ➔
model.safetensors重命名为General-Lite-2K.safetensors - General-dynamic ➔
model.safetensors重命名为General-dynamic.safetensors - General-legacy ➔
model.safetensors重命名为General-legacy.safetensors - General-reso_512 ➔
model.safetensors重命名为General-reso_512.safetensors - Portrait ➔
model.safetensors重命名为Portrait.safetensors - Matting ➔
model.safetensors重命名为Matting.safetensors - Matting-HR ➔
model.safetensors重命名为Matting-HR.safetensors - Matting-Lite ➔
model.safetensors重命名为Matting-Lite.safetensors - DIS ➔
model.safetensors重命名为DIS.safetensors - HRSOD ➔
model.safetensors重命名为HRSOD.safetensors - COD ➔
model.safetensors重命名为COD.safetensors - DIS-TR_TEs ➔
model.safetensors重命名为DIS-TR_TEs.safetensors
GitHub上的模型: BiRefNet Releases
旧模型:
权重模型(非必须)
下载放在models/BiRefNet
- swin_large_patch4_window12_384_22kto1k.pth(非General-Lite、General-Lite-2K和Matting-Lite模型)
- swin_tiny_patch4_window7_224_22kto1k_finetune.pth(仅General-Lite、General-Lite-2K和Matting-Lite模型)
节点
- AutoDownloadBiRefNetModel
- 自动下载模型到
${comfyui_rootpath}/models/BiRefNet,不支持权重
- 自动下载模型到
- LoadRembgByBiRefNetModel
- 从
${comfyui_rootpath}/models/BiRefNet和 在extra YAML 文件中通过birefnet配置的路径中选择模型 - 支持 BiRefNet Releases 中的新模型 和 老的模型BiRefNet-DIS_ep580.pth 与 BiRefNet-ep480.pth
- 参数use_weight设为True时, 需要下载权重模型,General-Lite、General-Lite-2K和Matting-Lite模型使用swin_tiny_patch4_window7_224_22kto1k_finetune.pth,其它模型使用 swin_large_patch4_window12_384_22kto1k.pth
- 从
- RembgByBiRefNet
- 输出透明前景图和遮罩
- RembgByBiRefNetAdvanced
- 输出前景图和遮罩,提供一些微调参数
- GetMaskByBiRefNet
- 仅输出遮罩
- BlurFusionForegroundEstimation
- 使用fast-foreground-estimation方法预估前景图