bgremover-onnx
ONNX export of BiRefNet_lite,
prepared to run in the browser via onnxruntime-web on WebGPU.
Used by BackgroundRemover, a free and open-source background remover that does all inference client-side.
Files
| File | Size | Notes |
|---|---|---|
birefnet-lite-web.onnx | 210 MB | fp32, opset 22, single file (no external data) |
What is different from a stock export
BiRefNet's ASPP blocks use deformable convolutions. A normal export emits
DeformConv nodes, and onnxruntime-web implements no DeformConv kernel on
any execution provider, so the graph fails at session creation:
Could not find an implementation for DeformConv(22) node
This export rewrites them as the mathematically equivalent grid_sample
plus a 1×1 convolution per kernel tap. Verified against
torchvision.ops.deform_conv2d to a relative error of ~1e-15 across padding,
stride, dilation and kernel-size variations; the resulting graph matches a
stock export to max|diff| = 0.00022.
Reproduce with:
python scripts/export_onnx.py --model birefnet-lite --web
Do not quantise this to int8
int8 is smaller (159 MB), faster, and matches fp32 to IoU 0.9948 — on native
CPU. On onnxruntime-web's WebGPU path it returns a near-all-foreground
mask: measured fg = 0.974 against an expected 0.443. fp32 is what ships.
Input / output
- Input
input, shape[batch, 3, 1024, 1024], float32. ImageNet normalisation: mean[0.485, 0.456, 0.406], std[0.229, 0.224, 0.225]. - Output
output, shape[batch, 1, 1024, 1024], float32 logits. Sigmoid is not baked in — apply it yourself.
Licence
MIT, inherited from the upstream model. BiRefNet_lite was trained on DIS-TR, an open dataset, and is cleared for commercial use.
Upstream: ZhengPeng7/BiRefNet · paper