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

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
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for d30social/ormbg-ortweb

Quantized
(5)
this model