Image Segmentation
Transformers.js
ONNX
BiRefNet
swin
background-removal
matting
webgpu
alpha-matting
image-matting
foreground-extraction
salient-object-detection
dichotomous-image-segmentation
client-side
transformers-js
fp16
Instructions to use studioludens/birefnet-lite-512 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use studioludens/birefnet-lite-512 with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('image-segmentation', 'studioludens/birefnet-lite-512'); - BiRefNet
How to use studioludens/birefnet-lite-512 with BiRefNet:
# Option 1: use with transformers from transformers import AutoModelForImageSegmentation birefnet = AutoModelForImageSegmentation.from_pretrained("studioludens/birefnet-lite-512", 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("studioludens/birefnet-lite-512") - Notebooks
- Google Colab
- Kaggle
fp16 version is slower
#2
by unreal79 - opened
Just my experience: fp16 version of the model is about 2 times slower. Can't see a difference in background removing results. Memory footprint difference is negligible in my case, so I consider the fp16 version as useless.
Overall the studioludens/birefnet-lite-512 is excellent! Very fast and gives good results (though results of onnx-community/BiRefNet_512x512-ONNX are better, but it's 3 times slower and eats more RAM).
Hey, thanks for the feedback. I guess the only upside for the fp16 version then is that it takes less bandwidth and VRAM. I haven't done a proper comparison on that yet.