Instructions to use beycanai/BiRefNet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- BiRefNet
How to use beycanai/BiRefNet with BiRefNet:
# Option 1: use with transformers from transformers import AutoModelForImageSegmentation birefnet = AutoModelForImageSegmentation.from_pretrained("beycanai/BiRefNet", trust_remote_code=True)# Option 2: use with BiRefNet # Install from https://github.com/ZhengPeng7/BiRefNet from models.birefnet import BiRefNet model = BiRefNet.from_pretrained("beycanai/BiRefNet") - Notebooks
- Google Colab
- Kaggle
BiRefNet
BiRefNet background-removal and matting checkpoints, one file per model, for the BiRefNet Remove Background node of ComfyUI-BCNodes. The node downloads only the model you pick, on first use, into ComfyUI/models/background_removal/ (the folder ComfyUI's core BiRefNet nodes read, so the files serve both).
To fetch one by hand:
hf download beycanai/BiRefNet BiRefNet-general.safetensors --local-dir ComfyUI/models/background_removal
Files
| File | Backbone | Input size | Size | Original source |
|---|---|---|---|---|
BiRefNet-general.safetensors |
swin_v1_l | 1024 | 0.44 GB | ZhengPeng7/BiRefNet |
BiRefNet_512x512.safetensors |
swin_v1_l | 512 | 0.44 GB | ZhengPeng7/BiRefNet_512x512 |
BiRefNet-HR.safetensors |
swin_v1_l | 2048 | 0.44 GB | ZhengPeng7/BiRefNet_HR |
BiRefNet-portrait.safetensors |
swin_v1_l | 1024 | 0.89 GB | ZhengPeng7/BiRefNet-portrait |
BiRefNet-matting.safetensors |
swin_v1_l | 1024 | 0.89 GB | ZhengPeng7/BiRefNet-matting |
BiRefNet-HR-matting.safetensors |
swin_v1_l | 2048 | 0.44 GB | ZhengPeng7/BiRefNet_HR-matting |
BiRefNet_lite.safetensors |
swin_v1_t | 1024 | 0.18 GB | ZhengPeng7/BiRefNet_lite |
BiRefNet_lite-2K.safetensors |
swin_v1_t | 2048 | 0.18 GB | ZhengPeng7/BiRefNet_lite-2K |
BiRefNet_dynamic.safetensors |
swin_v1_l | 1024 | 0.44 GB | ZhengPeng7/BiRefNet_dynamic |
BiRefNet_lite-matting.safetensors |
swin_v1_t | 1024 | 0.09 GB | ZhengPeng7/BiRefNet_lite-matting |
Lucida.safetensors |
swin_v1_l | 1024 | 0.88 GB | egeorcun/lucida (lucida-m35-comfy.safetensors) |
Each file is an unchanged copy of its source's model.safetensors (Lucida: the file named above), renamed to the name the node uses.
License
MIT. The BiRefNet checkpoints are Peng Zheng's (ZhengPeng7/BiRefNet); Lucida is egeorcun's (egeorcun/lucida), MIT per its model card. See LICENSE.