Downloads · 30 days
0
CoderViking/birefnet-lite-onnx
birefnet-lite-onnx is a image segmentation model from CoderViking. Use it for the image segmentation task on the model card, and read the license before you ship it in a product. It is set up for onnx. The card lists the license as mit.
Custom ONNX export of BiRefNetlite (bilateral reference network for dichotomous image segmentation, Swin-v1-tiny backbone) from the official ZhengPeng7/BiRefNetlite weights, re-hosted for AllPrivate — where every mode…
Downloads · 30 days
0
Access
Public
Updated Jul 18, 2026
Repo size
200 MB
Likes
1
Public
Click a slice to open those files.
.onnx200 MB · 100%
From the Hugging Face model README
Custom ONNX export of BiRefNet_lite (bilateral reference network for dichotomous image segmentation, Swin-v1-tiny backbone) from the official ZhengPeng7/BiRefNet_lite weights, re-hosted for AllPrivate — where every model runs in the visitor's browser and nothing is uploaded.
The community export (onnx-community/BiRefNet_lite-ONNX)
throws OrtRun std::bad_alloc in ONNX Runtime Web on every EP (fp32/fp16 ×
wasm/webgpu, tested 2026-07 on an M-series MacBook): it is a dynamic-shape
trace whose deformable convolutions decompose into GatherND/ScatterND/Clip
chains that fall back to CPU on the WebGPU EP and materialize im2col tensors of
hundreds of MB inside the 32-bit wasm heap.
This export replaces DeformableConv2d.forward with a numerically identical
per-kernel-tap GridSample decomposition (one bilinear GridSample + 1×1 Conv
per tap, accumulated — peak extra memory is one [1,C,H,W] tensor per tap) and
traces with a static input shape, so all shape dynamism constant-folds
away. It runs to completion on both the wasm and WebGPU execution providers of
ONNX Runtime Web (verified 1.26-dev).
model.safetensors
at pinned revision 7838f1c
4417d89795250e698c3cb0ae8df15743810065f646f48a694fdfa7ca052d0815torch.onnx.export (PyTorch 2.8.0, TorchScript exporter),
opset 17, fp32, constant folding on, post-processed with onnxslim 0.1.94
(constant-folds the Swin attention-mask construction; Gemm fusion disabled)
plus a content-hash initializer dedupe (the backbone is traced twice for the
multi-scale 'cat' input) — see export_birefnet_lite.py
for the exact reproducible scriptinput_image [1, 3, 1024, 1024] (NCHW, RGB, float32, ImageNet
normalization: (x/255 - mean) / std, mean [0.485, 0.456, 0.406], std
[0.229, 0.224, 0.225]) → output_image [1, 1, 1024, 1024] logits;
apply sigmoid for the [0,1] matteAdd, BatchNormalization, Concat, Conv, Div, Erf, Gather, GlobalAveragePool, GridSample, LayerNormalization, MatMul, Mul, Pad, Relu, Reshape, Resize, Shape, Sigmoid, Slice, Softmax, Transpose, Unsqueeze —
no GatherND, no ScatterND, no Clipdeform_conv2d): GridSample decomposition max abs dev 3.1e-5 vs
torchvision; full-model ONNX (onnxruntime CPU) max abs logits dev 1.0e-4,
max post-sigmoid dev 1.3e-950a57872cc739192446da2a934159f957c81af8b5a161dfda8e3daa51660ca67MIT, inherited from BiRefNet (© Zheng Peng et al.). This repo only re-packages the officially released weights in ONNX form.
@article{BiRefNet,
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},
year = {2024}
}