BiRefNet
Collection
A collection of my BiRefNet models -- different tasks, different scales. • 18 items • Updated • 8
How to use ZhengPeng7/BiRefNet_lite-matting with BiRefNet:
# Option 1: use with transformers
from transformers import AutoModelForImageSegmentation
birefnet = AutoModelForImageSegmentation.from_pretrained("ZhengPeng7/BiRefNet_lite-matting", 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("ZhengPeng7/BiRefNet_lite-matting")How to use ZhengPeng7/BiRefNet_lite-matting with Transformers:
# Use a pipeline as a high-level helper
from transformers import pipeline
pipe = pipeline("image-segmentation", model="ZhengPeng7/BiRefNet_lite-matting", trust_remote_code=True) # Load model directly
from transformers import AutoModelForImageSegmentation
model = AutoModelForImageSegmentation.from_pretrained("ZhengPeng7/BiRefNet_lite-matting", trust_remote_code=True, dtype="auto")How to use ZhengPeng7/BiRefNet_lite-matting with Transformers.js:
// npm i @huggingface/transformers
import { pipeline } from '@huggingface/transformers';
// Allocate pipeline
const pipe = await pipeline('image-segmentation', 'ZhengPeng7/BiRefNet_lite-matting');| Dataset | Method | Smeasure | maxFm | meanEm | MSE | maxEm | meanFm | wFmeasure | adpEm | adpFm | HCE | mBA | maxBIoU | meanBIoU |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| TE-P3M-500-NP | BiRefNet-matting--epoch_100 | .978 | .996 | .990 | .003 | .996 | .987 | .989 | .962 | .980 | .000 | .825 | .934 | .888 |
| TE-AM-2k | BiRefNet-matting--epoch_100 | .970 | .995 | .989 | .003 | .996 | .986 | .987 | .985 | .990 | .000 | .830 | .937 | .876 |
Check the main BiRefNet_lite model repo for more info and how to use it:
https://huggingface.co/ZhengPeng7/BiRefNet_lite/blob/main/README.md
Also check the GitHub repo of BiRefNet for all things you may want:
https://github.com/ZhengPeng7/BiRefNet
@article{zheng2024birefnet,
title={Bilateral Reference for High-Resolution Dichotomous Image Segmentation},
author={Zheng, Peng and Gao, Dehong and Fan, Deng-Ping and Liu, Li and Laaksonen, Jorma and Ouyang, Wanli and Sebe, Nicu},
journal={CAAI Artificial Intelligence Research},
volume = {3},
pages = {9150038},
year={2024}
}