image-segmentation + face-detection 2 Web Workers · 0.45 MB Total 0.22 MB q8 + 0.23 MB fp32 WASM Apache-2.0 + MIT

2-Stage Portrait Privacy & Face-Aware Bokeh Pipeline (0.45 MB Total)

Combine two ultra-tiny CPU WASM vision models in 0.45 MB total: Stage 1: MediaPipe Selfie Segmentation (0.22 MB, Apache-2.0) builds the continuous portrait matte, and Stage 2: OpenCV YuNet (0.23 MB, MIT, reusing ../../yunet-face-detection/worker.js) locates every face to keep the primary speaker crisp while blurring backgrounds or bystander faces.

1 · Workflow models (0.45 MB total)

Stage 1 · MediaPipe Selfie Segmentation (0.22 MB)

Uses ../worker.js — shared @huggingface/transformers@3.7.5 WASM q8 continuous 256×256 alpha matte.

Stage 2 · OpenCV YuNet Face Detector (0.23 MB)

Reuses ../../yunet-face-detection/worker.js — onnxruntime-web@1.21.0 CPU WASM fp32 anchor-free face + 5-landmark detection.

2 · Segment foreground, detect faces, apply selective bokeh or privacy blur

Initialising two-stage pipeline…

No photo processed yet.

Foreground area–
Faces detected–
Stage 1 (Selfie Seg)–
Stage 2 (YuNet)–
Total pipeline–
NaN / invalid0
Face-vs-matte alignment (Stage 1 matte overlap inside each Stage 2 YuNet box)
Face Role YuNet score Mean matte α Matte overlap % Box (x, y, w×h)
Run the 2-stage pipeline above to inspect per-face matte overlap.

See inside the code

Show the code — selfie-core.mjs: filterFacesByMatte() (primary speaker vs bystander overlap)
Show the code — selfie.js: drawMultiModelPrivacyCanvas() (selective bokeh & face privacy compositor)
Show the code — ../../yunet-face-detection/worker.js: runDetect() (reused 0.23 MB Stage 2 worker)

References