U^2-Net human segmentation
Background removal model for onnxruntime-web. Runs on WebGPU or WASM —
168 MB downloaded once from models.skillsafe.ai, then cached for every SkillSafe app that
uses it. Inference happens on your device; nothing you enter is uploaded to load it, and it never costs a credit.
Weights from Hugging Face · skillsafe-ai/u2net-human-seg, pinned at ff100931227c — also loadable straight from Hugging Face outside SkillSafe (how).
Details
[email protected]ff100931227cdf51ca8aabed104f35f2539be35eFiles
Each file is served at an immutable URL; the canonical form is the SHA-256 itself. Tokenizer and config JSON are not here by design — they ship in your app bundle.
| Path | Format | Size | SHA-256 | |
|---|---|---|---|---|
u2net_human_seg.onnx | onnx | 168 MB | 01eb6a29a5c4…d1c73c |
Signature
Graph inputs and outputs read from the ONNX bytes at vetting — the tensor names your session.run() call feeds and reads. Symbolic dimensions are shown by name.
Inputs
input.1float32 [1, 3, 320, 320]
Outputs
1959float32 [1, 1, 320, 320]1960float32 [1, 1, 320, 320]1961float32 [Sigmoid1961_dim_0, Sigmoid1961_dim_1, Sigmoid1961_dim_2, Sigmoid1961_dim_3]1962float32 [Sigmoid1962_dim_0, Sigmoid1962_dim_1, Sigmoid1962_dim_2, Sigmoid1962_dim_3]1963float32 [Sigmoid1963_dim_0, Sigmoid1963_dim_1, Sigmoid1963_dim_2, Sigmoid1963_dim_3]1964float32 [Sigmoid1964_dim_0, Sigmoid1964_dim_1, Sigmoid1964_dim_2, Sigmoid1964_dim_3]1965float32 [Sigmoid1965_dim_0, Sigmoid1965_dim_1, Sigmoid1965_dim_2, Sigmoid1965_dim_3]
Use it in an app declaration · SDK loader · onnxruntime-web · URLs · Hugging Face — generated from this entry
Add to the body of POST /v1/apps/{slug}/releases (or a release session). An unknown or withdrawn model is refused with a 400 naming it; the app page then shows "downloads 168 MB · runs on your device" and /models.txt carries the attribution.
{
"models": [
{
"id": "u2net-human-seg",
"revision": "rembg-v0.0.0"
}
]
} Streams with progress, verifies the SHA-256 against the catalogue, keeps a durable copy in the app's Cache API and reports whether the bytes came from cache or the network.
<script src="/sdk.js"></script> <!-- vendored from https://skillsafe.ai/apps-sdk/v1.js -->
const ss = SkillSafe.init({ slug: "your-app" });
const caps = await ss.models.capabilities(); // { webgpu, wasm, wasmSimd, storage }
const bytes = await ss.models.load("[email protected]", "u2net_human_seg.onnx", {
onProgress: (p) => (bar.style.width = Math.round(p.ratio * 100) + "%"),
}); // ArrayBuffer — SHA-256 verified, cached
// Later visits: await ss.models.status("[email protected]") → { cached: [...], missing: [] }
// Background prefetch on a landing page: ss.models.warm("[email protected]") The runtime itself ships in your bundle as a vetted {path, sha256} reference — only the weights come from the registry. Pass the bytes in; do not re-fetch by URL.
// onnxruntime-web 1.17.0 ships in your bundle as a vetted {path, sha256} reference —
// dist/ort.wasm.bundle.min.mjs + dist/ort-wasm-simd-threaded.wasm (or the .jsep pair for WebGPU).
import * as ort from "./ort.wasm.bundle.min.mjs";
ort.env.wasm.wasmPaths = { wasm: "/ort-wasm-simd-threaded.wasm" }; // object form, never a prefix string
ort.env.wasm.numThreads = 1; // app hosts have no COOP/COEP
const bytes = await ss.models.load("[email protected]", "u2net_human_seg.onnx", { onProgress });
const session = await ort.InferenceSession.create(new Uint8Array(bytes), {
executionProviders: ["webgpu", "wasm"],
});
// Feeds are named after the graph inputs (read from the file, see the signature above):
const feeds = {
"input.1": new ort.Tensor("float32", new Float32Array(n), [1, 3, 320, 320]),
};
const out = await session.run(feeds);
const 1959 = out["1959"].data; // float32 [1, 1, 320, 320]
const 1960 = out["1960"].data; // float32 [1, 1, 320, 320]
const 1961 = out["1961"].data; // float32 [Sigmoid1961_dim_0, Sigmoid1961_dim_1, Sigmoid1961_dim_2, Sigmoid1961_dim_3]
const 1962 = out["1962"].data; // float32 [Sigmoid1962_dim_0, Sigmoid1962_dim_1, Sigmoid1962_dim_2, Sigmoid1962_dim_3]
const 1963 = out["1963"].data; // float32 [Sigmoid1963_dim_0, Sigmoid1963_dim_1, Sigmoid1963_dim_2, Sigmoid1963_dim_3]
const 1964 = out["1964"].data; // float32 [Sigmoid1964_dim_0, Sigmoid1964_dim_1, Sigmoid1964_dim_2, Sigmoid1964_dim_3]
const 1965 = out["1965"].data; // float32 [Sigmoid1965_dim_0, Sigmoid1965_dim_1, Sigmoid1965_dim_2, Sigmoid1965_dim_3] Immutable, credential-free, Access-Control-Allow-Origin: *, range requests honoured. The host refuses requests carrying a foreign Origin; a plain curl is fine.
https://models.skillsafe.ai/[email protected]/u2net_human_seg.onnx curl -sSL -o u2net_human_seg.onnx "https://models.skillsafe.ai/[email protected]/u2net_human_seg.onnx"
shasum -a 256 u2net_human_seg.onnx # 01eb6a29a5c4d8edb30b56adad9bb3a2a0535338e480724a213e0acfd2d1c73c SkillSafe's copy on Hugging Face — the same bytes (the SHA-256 on each file page matches the hash above), plus manifest.json with the upstream commit, recipe and toolchain, the parity reference tensors and a model card. Use it directly for your own site or notebook. A SkillSafe app must load from the registry: its CSP allows models.skillsafe.ai only, and that copy is what the SDK verifies, the browser shares across apps and the app page discloses. SkillSafe keeps hosting its own copies and the API either way.
// Outside SkillSafe apps only: app hosts allow connect-src models.skillsafe.ai, not huggingface.co.
// Same bytes as the registry copy — the SHA-256 on the Hugging Face file page is 01eb6a29a5c4d8ed…
const res = await fetch("https://huggingface.co/skillsafe-ai/u2net-human-seg/resolve/ff100931227cdf51ca8aabed104f35f2539be35e/u2net_human_seg.onnx");
const bytes = new Uint8Array(await res.arrayBuffer());
const session = await ort.InferenceSession.create(bytes, { executionProviders: ["webgpu", "wasm"] }); https://huggingface.co/skillsafe-ai/u2net-human-seg/resolve/ff100931227cdf51ca8aabed104f35f2539be35e/u2net_human_seg.onnx Evaluation
onnx.checker + onnxruntime CPU smoke run with zero-filled inputs at the declared shapes; per-file SHA-256 pinned to the source — imported as published upstream, then checked. Evaluated Sep 22, 2026.
Runs under onnxruntime
Zero-filled inputs at the declared shapes, CPU execution provider on the converter host; the check is that the graph loads, runs, and emits the declared output shapes.
u2net_human_seg.onnx: input.1[1,3,320,320] → 1959[1,1,320,320], 1960[1,1,320,320], 1961[1,1,320,320], 1962[1,1,320,320], 1963[1,1,320,320], 1964[1,1,320,320], 1965[1,1,320,320] 1037.4 ms
Toolchain: python 3.12.13 · platform Darwin 25.6.0 arm64 · torch 2.10.0 · onnx 1.23.0 · onnxruntime 1.30.0. Recipe models/recipes/u2net-human-seg.yaml (df13a13f2e72). Full manifest.json
Licence & attribution
Apache-2.0 · licence text · notice
U^2-Net (human segmentation weights): Xuebin Qin et al., Apache License 2.0 (https://github.com/xuebinqin/U-2-Net). ONNX distributed by rembg (Daniel Gatis, MIT). https://github.com/danielgatis/rembg
Apps that declare this model get this text in their generated /models.txt, so a licence that requires a notice always carries one.
Every file here was approved by exact SHA-256 after a structural audit of the graph, fetched from a content-pinned source, and is served credential-free at an immutable URL. The SDK re-verifies the hash on your device before it caches or returns anything. Missing a variant? Request it — or read how the registry works.