Models About & Code

Standalone App & PWA

Install Motion Mask from its dedicated origin as an offline desktop or mobile PWA with direct OS video/* and image/* file_handlers support and zero camera or microphone permissions.

Open sam3.webai.show ↗

Honest cache note: browsers isolate Cache Storage per origin, so sam3.webai.show caches its own SAM 3 Tracker (~302.3 MB WebGPU q4f16 / ~378.8 MB CPU WASM q4) and optional BiRefNet-lite 512 (~98.5 MB) weights. Staying on webai.show shares Cache Storage across the catalogue.

Frame 1 / 6 · 640×400 Pending SAM 3

Interactive Motion Mask canvas showing the current timeline frame and SAM 3 tracking mask.

Click to include (+), Shift+click to exclude (−), or switch to Box Drag. Keys: ←/→ scrub · Space play · Enter place point

Timeline Filmstrip

Loading Snow Bike Dolly burst… Every pixel stays strictly on your device.

Detecting WebGPU & CPU WASM capabilities…

Tracked Video Effect

Color Pop
14 px
1 px
SAM 3 Multi-Mask Candidates (3 outputs, 0 re-inference)

Stage 2 · BiRefNet Edge Polish

512×512 · 98.5 MB MIT

Tightly crops the SAM 3 bounding box and runs studioludens/birefnet-lite-512 (CPU WASM fp16 via shared Transformers.js 3.7.5) to recover fine spokes, fur, whiskers, and soft edges without out-of-memory errors.

85%
Run Stage 1 SAM 3 Tracker first to locate the subject ROI.

Sequence & Video Export

100% On-Device

Local AI Engine

Two browser-runnable ONNX segmentation models running in isolated FIFO Web Workers — Stage 1 SAM 3 Tracker on a local Transformers.js 4.3.2 worker pin, plus Stage 2 BiRefNet-lite 512 on the shared 3.7.5 runtime.

Stage 1 · SAM 3 Tracker (302.3 MB WebGPU q4f16 / 378.8 MB WASM q4)

onnx-community/sam3-tracker-ONNX · upstream facebook/sam3 (Meta SAM License) · local @huggingface/transformers@4.3.2 in worker.js

Stage 2 · BiRefNet-lite 512×512 Edge Polish (98.5 MB CPU WASM fp16 · MIT)

studioludens/birefnet-lite-512 · upstream ZhengPeng7/BiRefNet_lite (MIT) · shared ../../lib/webai.js (Transformers.js 3.7.5)

Stage 1 · SAM 3 Not downloaded
Stage 2 · BiRefNet 512 Optional · Off
Timeline Tracking 0/6 frames
Numeric Integrity 0 NaN · 640×400

How Motion Mask Works

All neural inference, optical block-matching propagation, alpha fusion, and video effect compositing run off the main thread inside three dedicated module Web Workers with zero server uploads.

1. SAM 3 Tracker Vision Encoder + Prompt Decoder

onnx-community/sam3-tracker-ONNX (model_type: sam3_tracker, local Transformers.js 4.3.2 pin inside worker.js) ships two ONNX subgraphs: vision_encoder (1008×1008 input → 3-level pyramid image_embeddings.0/1/2) and prompt_encoder_mask_decoder (points + boxes → 3 candidate masks [1,1,3,288,288] + iou_scores). Because this ONNX export omits the PyTorch-only temporal memory bank, multi-frame tracking pairs SAM 3 with coarse-to-fine SAD optical displacement to carry boxes and interior anchors across frames while caching up to 12 encoded frame pyramids for ~21–44 ms click refinement.

2. BiRefNet-lite 512×512 Crop-Level Edge Polish

studioludens/birefnet-lite-512 (MIT, 98.48 MB fp16 swin, shared Transformers.js 3.7.5) solves the 1024×1024 browser OOM wall by re-exporting deformable convolutions at 512×512. Stage 2 crops tightly around the SAM 3 subject ROI (+22% padding), runs CPU WASM fp16 (avoiding the 3.7.5 WebGPU WGSL computeSliceOffsets compiler bug), applies sigmoid to output_image, and blends continuous alpha back inside a soft-dilated SAM 3 gate.

3. Off-Thread VFX Compositor & Zero-Dep Exports

compositor-worker.js executes 2-pass separable Gaussian privacy blur, Color Pop background desaturation, checkerboard cutout previews, and SAD motion estimation on transferable ArrayBuffers. Export individual lossless RGBA PNGs, a pure-JS Store-mode .zip PNG sequence, or a recorded video/webm clip directly from canvas.

Show the code — SAM 3 Tracker 12-frame cached image_embeddings & point/box decoder (Transformers.js 4.3.2)
Show the code — BiRefNet-lite 512×512 CPU WASM fp16 edge-polish worker (shared lib/webai.js 3.7.5)
Show the code — estimateFrameMotionShift() coarse-to-fine SAD optical motion tracker
Show the code — fuseBirefnetAlphaIntoMask() ROI-gated 512×512 alpha fusion
Show the code — compositeEffectFrame() Color Pop, Privacy Blur & Transparent Cutout
Show the code — Off-main-thread transferable pixel compositor & motion worker

Rendered Frame Sequence

6 frames · 640×400 lossless PNGs