This repository packages the latest BiRefNet model as a ComfyUI node for use, supporting chunked loading on both CPU and GPU, as well as model caching features.
This repository packages the latest BiRefNet model as a ComfyUI node for use, supporting chunked loading on both CPU and GPU, as well as model caching features.<br>
Feature 1: Supports chunked loading on CPU and GPU<br>
When CUDA is enabled, specify the cpu_size
to load part of the model onto the CPU.
<br>
Feature 2: Model Caching<br>
Feature 3: Multiple Cropping Methods<br>
Supports putalpha, naive, and alpha_matting cropping methods.
<br>
mask_precision_threshold
parameter to control the accuracy threshold of the mask, default to 0.1<br>BiRefNet_onnx
node to Support onnx
model <br>ComfyUI-BiRefNet-lite
to ComfyUI-BiRefNet-Super
<br>ComfyUI/custom_nodes/
git clone https://github.com/rubi-du/ComfyUI-BiRefNet-Super.git
cd ComfyUI-BiRefNet-Super
pip install -r requirements.txt
Directly download the node source code package, unzip it into the custom_nodes
directory, and then restart ComfyUI.
Install via ComfyUI-Manager by searching for "ComfyUI-BiRefNet-Super".
Example workflows are placed in ComfyUI-BiRefNet-Super/workflow
.<br/>
There are two options for loading models: one is to automatically download and load a remote model, and the other is to load a local model (in which case you need to set load_local_model
to true and set local_model_path
to the local model path under the models/birefnet directory, for example, the BiRefNet folder).<br/>
BiRefNet: https://huggingface.co/ZhengPeng7/BiRefNet/tree/main<br/>
BiRefNet_lite-2K: https://huggingface.co/ZhengPeng7/BiRefNet_lite-2K/tree/main<br/>
BiRefNet-portrait: https://huggingface.co/ZhengPeng7/BiRefNet-portrait/tree/main<br/>
BiRefNet-matting: https://huggingface.co/ZhengPeng7/BiRefNet-matting/tree/main<br/>
RMBG-2.0: https://huggingface.co/briaai/RMBG-2.0/tree/main<br/>
Usage of workflow.json<br/>
Usage of video_workflow.json<br/>
Workflow Address
Example workflows are placed in workflow.<br/>
Place the model file in ComfyUI/models/birefnet
.<br/>
Model file name should be one of the following:
birefnet-genernal: https://github.com/danielgatis/rembg/releases/download/v0.0.0/BiRefNet-general-epoch_244.onnx<br/> birefnet-genernal-lite: https://github.com/danielgatis/rembg/releases/download/v0.0.0/BiRefNet-general-bb_swin_v1_tiny-epoch_232.onnx<br/> birefnet-portrait: https://github.com/danielgatis/rembg/releases/download/v0.0.0/BiRefNet-portrait-epoch_150.onnx <br/> birefnet_massive: https://github.com/danielgatis/rembg/releases/download/v0.0.0/BiRefNet-massive-TR_DIS5K_TR_TEs-epoch_420.onnx<br/> birefnet-hrsod: https://github.com/danielgatis/rembg/releases/download/v0.0.0/BiRefNet-HRSOD_DHU-epoch_115.onnx <br/> birefnet-dis: https://github.com/danielgatis/rembg/releases/download/v0.0.0/BiRefNet-DIS-epoch_590.onnx <br/> birefnet-cod: https://github.com/danielgatis/rembg/releases/download/v0.0.0/BiRefNet-COD-epoch_125.onnx <br/>
Thanks to all the authors of the BiRefNet repository ZhengPeng7/BiRefNet.
Some code was referenced from MoonHugo/ComfyUI-BiRefNet-Hugo. Thanks!
Some code was referenced from danielgatis/rembg. Thanks!