Instructions to use h143N/birefnet-lite-512-chunked with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use h143N/birefnet-lite-512-chunked with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('image-segmentation', 'h143N/birefnet-lite-512-chunked'); - BiRefNet
How to use h143N/birefnet-lite-512-chunked with BiRefNet:
# Option 1: use with transformers from transformers import AutoModelForImageSegmentation birefnet = AutoModelForImageSegmentation.from_pretrained("h143N/birefnet-lite-512-chunked", 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("h143N/birefnet-lite-512-chunked") - Notebooks
- Google Colab
- Kaggle
BiRefNet_lite 512Γ512, low-memory ONNX
studioludens/birefnet-lite-512 (an export of ZhengPeng7/BiRefNet_lite) with its 20 deformable convolutions rewritten to use far less memory. Same weights, same input/output, same masks.
What changed
The original export turns each deformable convolution into one big step that samples every kernel position at once. In the last decoder stage (7Γ7 kernel, 128Γ128) that creates about 20 tensors of 205 MB each. This version samples one kernel position at a time and adds it into the output right away.
Measured with ONNX Runtime 1.31 on CPU, one 512Γ512 image:
| Original | This repo | |
|---|---|---|
| Peak memory, fp32 | 3,336 MB | ~600β730 MB |
| Largest intermediate tensor | 205 MB | 126 MB |
| Mask difference vs original fp32 | n/a | max 1/255 |
| CPU time | 3.0 s | 3.0 s |
No int8 file: dynamic int8 quantization visibly drops parts of the subject on some photos (with the original export too), so only fp32 and fp16 are provided.
Files
| File | Precision | Size |
|---|---|---|
onnx/model.onnx |
fp32 | 184 MB |
onnx/model_fp16.onnx |
fp16 (float32 input/output) | 96 MB |
Input input_image [1, 3, 512, 512], ImageNet-normalized. Output: logits [1, 1, 512, 512]; apply sigmoid.
License
MIT, see LICENSE. Copyright (c) 2024 ZhengPeng, Copyright (c) 2026 Studio Ludens V.O.F.
- Downloads last month
- 35
Model tree for h143N/birefnet-lite-512-chunked
Base model
ZhengPeng7/BiRefNet_lite