Image Segmentation
Transformers.js
ONNX
BiRefNet
swin
background-removal
dichotomous-image-segmentation
webgpu
onnxruntime-web
Instructions to use CardAnvilModels/BiRefNet-lite-1024-WebGPU with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use CardAnvilModels/BiRefNet-lite-1024-WebGPU with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('image-segmentation', 'CardAnvilModels/BiRefNet-lite-1024-WebGPU'); - BiRefNet
How to use CardAnvilModels/BiRefNet-lite-1024-WebGPU with BiRefNet:
# Option 1: use with transformers from transformers import AutoModelForImageSegmentation birefnet = AutoModelForImageSegmentation.from_pretrained("CardAnvilModels/BiRefNet-lite-1024-WebGPU", 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("CardAnvilModels/BiRefNet-lite-1024-WebGPU") - Notebooks
- Google Colab
- Kaggle
BiRefNet-lite 1024 (ONNX, WebGPU-runnable)
BiRefNet-lite at 1024 × 1024 as an fp16 ONNX export whose graph is patched to run on WebGPU in the browser; the weights are unchanged. Card Anvil uses it with Transformers.js to select the main subject of card art.
These are unchanged copies of the files in jiabins0303/birefnet-lite-1024-webgpu at commit 1ad01ce, at the same paths, kept here so the app loads files that can't change under it.
| Files | What they are | Loaded by Card Anvil |
|---|---|---|
config.json, preprocessor_config.json, onnx/model_fp16.onnx |
The model | Yes |
scripts/patch_split.py, scripts/patch_deform.py, scripts/verify_patch.py |
The scripts that rewrote the graph to run on WebGPU, and the check that the result matches the original | No, kept for later |
SOURCE_README.md |
The source repo's README: how and why the graph was patched, and how it was verified | No |
Credits and licence
- Model: BiRefNet by Peng Zheng et al. (
ZhengPeng7/BiRefNet_lite), from Bilateral Reference for High-Resolution Dichotomous Image Segmentation (CAAI AIR 2024). - WebGPU-runnable export:
jiabins0303/birefnet-lite-1024-webgpu.
Licensed under the MIT License, as the original model is. See LICENSE.
- Downloads last month
- 54
Model tree for CardAnvilModels/BiRefNet-lite-1024-WebGPU
Base model
ZhengPeng7/BiRefNet_lite
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('image-segmentation', 'CardAnvilModels/BiRefNet-lite-1024-WebGPU');