Instructions to use sprited/birefnet-toonout-onnx with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- BiRefNet
How to use sprited/birefnet-toonout-onnx with BiRefNet:
# Option 1: use with transformers from transformers import AutoModelForImageSegmentation birefnet = AutoModelForImageSegmentation.from_pretrained("sprited/birefnet-toonout-onnx", 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("sprited/birefnet-toonout-onnx") - Notebooks
- Google Colab
- Kaggle
BiRefNet-ToonOut β ONNX
ONNX export of joelseytre/toonout (ToonOut: BiRefNet fine-tuned for anime background removal β Muratori & Seytre, MIT, paper, code), converted so the model runs anywhere ONNX Runtime does β Node.js included, no Python.
Converted with torch.onnx.export (opset 17) plus
deform_conv2d_onnx_exporter
for the decoder's deformable convolutions. Conversion script:
experiments/003-toonout-onnx
in the sprited repo.
Files
birefnet-toonout-fp16.onnxβ fp16 weights, fp32 inputs/outputs (no Float16Array juggling in JS). This is what sprited downloads.birefnet-toonout.onnxβ fp32 original export.
I/O
| name | shape | dtype | |
|---|---|---|---|
| input | image |
[1, 3, 1024, 1024] |
float32 |
| output | mask |
[1, 1, 1024, 1024] |
float32 (sigmoid, 0..1) |
Preprocessing: plain resize to 1024Γ1024, RGB / 255, ImageNet
normalization (mean 0.485, 0.456, 0.406, std 0.229, 0.224, 0.225).
Postprocessing: resize mask back to the source size, use as alpha.
Usage (Node.js)
import ort from "onnxruntime-node";
const session = await ort.InferenceSession.create("birefnet-toonout-fp16.onnx");
const { mask } = await session.run({ image: new ort.Tensor("float32", chw, [1, 3, 1024, 1024]) });
Or just npx sprited gen char β sprited uses this model for matting by default.
Model tree for sprited/birefnet-toonout-onnx
Paper for sprited/birefnet-toonout-onnx
Paper β’ 2509.06839 β’ Published