跳转到主要内容

Documentation Index

Fetch the complete documentation index at: https://docs.comfy.org/llms.txt

Use this file to discover all available pages before exploring further.

Make sure your ComfyUI is updated.Workflows in this guide can be found in the Workflow Templates. If you can’t find them in the template, your ComfyUI may be outdated. (Desktop version’s update will delay sometime)If nodes are missing when loading a workflow, possible reasons:
  1. You are not using the latest ComfyUI version (Nightly version)
  2. Some nodes failed to import at startup
BiRefNet(Bilateral Reference Network)是一款高质量的图像背景移除模型。它能为人、产品、动物以及头发或皮毛等细节复杂的物体生成清晰精细的遮罩。 BiRefNet 在 ComfyUI 中获得原生支持(PR #12747),模型权重基于 MIT 协议 发布。 Hugging Face 上的 BiRefNet | Comfy-Org 模型仓库 | 论文 (arXiv)

核心优势

  • 高质量遮罩 — 头发、皮毛等精细边缘的精确检测
  • 通用主体检测 — 对人、产品、动物和复杂场景均有良好效果
  • 一键式操作 — 只需加载图像,模型自动完成处理
  • RGBA 输出 — 生成背景透明的图像,可直接用于合成
限制: 背景极其杂乱或主体与背景融合的情况下,遮罩精度可能下降。模型每次处理一张图像。

BiRefNet 背景移除工作流

1. 工作流文件下载

请更新你的 ComfyUI 到最新版本,并通过菜单 工作流 -> 浏览模板 找到 Utility 类别下的 “BiRefNet: Remove Background”。

下载 JSON 格式工作流

下载工作流

在 Comfy Cloud 中运行

Open in cloud

2. 手动下载模型

BiRefNet 模型托管在 Comfy-Org BiRefNet 模型仓库 放置到以下目录结构:
📂 ComfyUI/
└── 📂 models/
    └── 📂 background_removal/
        └── birefnet.safetensors

3. 使用工作流

  • 图像 — 通过 Load Image 节点加载图像(放入 ComfyUI 的 input/ 文件夹)
  • Remove Background (BiRefNet) 子图会处理图像并输出:
    • IMAGE — 背景透明的 RGBA 结果
    • mask — 提取的前景遮罩
输出可预览,也可作为其他节点的输入进行合成、进一步编辑或保存。

了解 Subgraph

本工作流使用了 Subgraph 节点实现模块化处理。查阅 Subgraph 文档了解如何自定义和扩展工作流。

补充说明

  • 模型目录 — 模型必须放置在 ComfyUI/models/background_removal/ 目录,而非 checkpoints 文件夹
  • 更新需求 — BiRefNet 支持需要较新版本的 ComfyUI,请确保已更新到最新版本
  • RGBA 输出 — 透明背景结果可直接合成到新背景上,或用于下游工作流