Instructions to use shozebDev/birefnet-lite-512-onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use shozebDev/birefnet-lite-512-onnx with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('image-segmentation', 'shozebDev/birefnet-lite-512-onnx');
BiRefNet_lite โ ONNX, 512ร512
An ONNX export of ZhengPeng7/BiRefNet_lite (MIT) with a fixed 512ร512 input, for in-browser background removal on WebGPU with transformers.js.
The onnx-community 1024ร1024 export needs a lot of GPU memory and an adapter with 17+ storage buffers per shader stage. This export needs roughly a quarter of the memory, and no op binds more than 7 storage buffers, so it runs on the WebGPU default limits.
| File | Precision | Size |
|---|---|---|
onnx/model.onnx |
fp32 | ~192 MB |
onnx/model_fp16.onnx |
fp16 weights, fp32 input/output | ~100 MB |
Both files match the PyTorch model's output (max alpha difference โค 3e-6).
Input / output
input_image: float32[1, 3, 512, 512], RGB normalized with ImageNet mean[0.485, 0.456, 0.406]and std[0.229, 0.224, 0.225].output_image: float32[1, 1, 512, 512]logits โ apply a sigmoid to get the alpha matte.
License
MIT, same as the original BiRefNet. Credit: Zheng Peng et al., Bilateral Reference for High-Resolution Dichotomous Image Segmentation (CAAI AIR 2024).
- Downloads last month
- 21
Model tree for shozebDev/birefnet-lite-512-onnx
Base model
ZhengPeng7/BiRefNet_lite