Skip to content
mask-generation · multi-model 2 Workers · SlimSAM-77 vs SAM ViT-Base · IoU & Boundary Dice 25.44 MB + 105.99 MB WASM (~146 MB budget) Apache-2.0 + Apache-2.0

SlimSAM-77 vs SAM ViT-Base: Pruned vs Full Segment Anything Head-to-Head

Stage 1: SlimSAM-77 (Xenova/slimsam-77-uniform, 77%-pruned ViT-B reusing ../slimsam-segment-anything/worker.js, 25.44 MB active WASM q8/fp32 transfer; ~40 MB catalogue entry) runs in parallel with Stage 2: SAM ViT-Base (Xenova/sam-vit-base, full 12-layer ViT-B/16, 105.99 MB WASM q8; 131.43 MB actual combined download / ~146 MB budget) on the exact same click prompts to measure live Mask IoU, Dice (F1), ±2 px Boundary Dice, and encode/decode speedup.

1 · Workflow models (131.43 MB active WASM transfer · ~146 MB budget)

Stage 1 · SlimSAM-77 (25.44 MB WASM · ~40 MB cat.)

Reuses ../../slimsam-segment-anything/worker.js — pruned ViT-B encoder (q8) + fp32 decoder.

Stage 2 · SAM ViT-Base (105.99 MB WASM q8)

Uses ../worker.js — full 12-layer ViT-B/16 encoder (q8) + 2-way mask decoder (q8).

2 · Click identical prompt points on SlimSAM-77 & SAM ViT-Base

Initialising two-model comparison…

Prompt Input (click to add +1 / −1 points)

Click anywhere on the image to run identical coordinates through both SAM models.

Mask Overlap & Boundary Disagreement Map

Both agree SlimSAM-77 only SAM ViT-Base only
Mask IoU (overlap)–
Mask Dice (F1)–
Boundary Dice (±2 px)–
Pred. IoU Δ (Base−Slim)–
Encode ms (Slim vs Base)–
Decode ms (Slim vs Base)–
NaN / invalid0

Stage 1 · SlimSAM-77 (25.44 MB WASM)

Awaiting Stage 1 inference…

Stage 2 · SAM ViT-Base (105.99 MB WASM q8)

Awaiting Stage 2 inference…

Head-to-head SlimSAM-77 vs SAM ViT-Base overlap history
Photo & prompts SlimSAM Pred IoU SAM Base Pred IoU Mask IoU Mask Dice Boundary Dice Encode (Slim/Base)
Run both stages on a photo to record Mask IoU and Boundary Dice metrics.

See inside the code

Show the code — sam-base-core.mjs: compareBinaryMasks() (IoU, Dice, ±2 px Boundary Dice)
Show the code — sam-base-client.js: SlimSamStageClient (reuses ../slimsam-segment-anything/worker.js + terminate())
Show the code — worker.js: segmentPrompt() (Stage 2 SAM ViT-Base 3-mask decoder)

References