Instructions to use d30social/ormbg-ortweb with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers.js
How to use d30social/ormbg-ortweb with Transformers.js:
// npm i @huggingface/transformers import { pipeline } from '@huggingface/transformers'; // Allocate pipeline const pipe = await pipeline('image-segmentation', 'd30social/ormbg-ortweb');
ormbg-ortweb
An ONNX export of the Open Remove Background Model (ORMBG) patched to run in the browser with onnxruntime-web (WASM and WebGPU), for client-side image background removal via Transformers.js.
What this is
Same ORMBG model, same weights, same output โ just an ONNX graph that onnxruntime-web can execute.
Attribution
- Original model: ORMBG โ Open Remove Background Model by Maximilian
Schirrmacher (
schirrmacher/ormbg), licensed Apache-2.0. - Base ONNX export:
onnx-community/ormbg-ONNX, licensed Apache-2.0.
Modification
The upstream ONNX export sets ceil_mode=1 on all 33 MaxPool nodes.
onnxruntime-web does not support runtime ceil-based shape computation for
MaxPool, so inference aborts in the browser with:
using ceil() in shape computation is not yet supported for MaxPool
Change made: ceil_mode flipped 1 โ 0 on all 33 MaxPool nodes (a pure
ONNX graph edit โ no retraining, no weight changes).
Why it is lossless: the model input is static [1, 3, 1024, 1024], so every
pooling stage operates on even dimensions, where ceil-mode and floor-mode
produce identical output shapes. Verified bit-identical to the upstream export
in full ONNX Runtime: max|diff| = 0 on test images.
Files
onnx/model.onnxโ fp32 (~168 MB)onnx/model_fp16.onnxโ fp16 (~84 MB; verified โค1/255 alpha difference vs fp32)
Usage (Transformers.js)
import { pipeline } from '@huggingface/transformers';
const segmenter = await pipeline(
'image-segmentation',
'd30social/ormbg-ortweb',
{ device: 'webgpu', dtype: 'fp32', revision: 'main' }, // pin a commit hash in production
);
const [{ mask }] = await segmenter(imageUrlOrBlob); // mask: grayscale foreground matte
License
Apache-2.0 (inherited from the base model). See LICENSE.
- Downloads last month
- -
Model tree for d30social/ormbg-ortweb
Base model
schirrmacher/ormbg