2024-11-14 15:35:03 -08:00
2024-11-14 15:28:44 -08:00
2024-11-14 15:28:44 -08:00
2024-11-14 09:48:27 -08:00
2024-11-14 15:28:44 -08:00
2024-11-14 15:35:03 -08:00
2024-11-14 15:28:44 -08:00

ComfyUI-RMBG

A ComfyUI node for removing image backgrounds using RMBG-2.0.

Features

RMBG-2.0 is built on the innovative BiRefNet (Bilateral Reference Network) architecture, offering:

  • High accuracy in complex environments
  • Precise edge detection and preservation
  • Excellent handling of fine details
  • Support for multiple objects in a single image

Installation

  1. Clone this repository to your ComfyUI custom_nodes folder:
cd ComfyUI/custom_nodes
git clone https://github.com/1038lab/ComfyUI-RMBG
  1. Download RMBG model:

Usage

Basic Usage

  1. Load 🧽 RMBG (Remove Background) node from the 🧪AILab/🧽RMBG category
  2. Connect an image to the input
  3. Get two outputs:
    • IMAGE: Processed image with transparent background
    • MASK: Binary mask of the foreground

Parameters

  • sensitivity: Controls the background removal sensitivity (0.0-1.0)
  • process_res: Processing resolution (512-2048, step 128)
  • mask_blur: Blur amount for the mask (0-64)
  • mask_offset: Adjust mask edges (-20 to 20)

About RMBG-2.0

RMBG-2.0 is developed by BRIA AI and uses the BiRefNet architecture which includes:

  • Localization Module (LM): Generates semantic maps for primary image areas
  • Restoration Module (RM): Performs precise boundary restoration using:
    • Original Reference: Provides general background context
    • Gradient Reference: Focuses on edges and fine details

The model is trained on a diverse dataset of over 15,000 high-quality images, ensuring:

  • Balanced representation across different image types
  • High accuracy in various scenarios
  • Robust performance with complex backgrounds

Requirements

  • ComfyUI
  • Python 3.10+
  • Required packages (automatically installed):
    • torch>=2.0.0
    • torchvision>=0.15.0
    • Pillow>=9.0.0
    • numpy>=1.22.0
    • transformers>=4.30.0
    • safetensors>=0.3.0

Credits

License

MIT License

S
Description
No description provided
Readme GPL-3.0
5.1 MiB
Languages
Python 97.8%
JavaScript 2.2%