At a glance
| Model | Google MediaPipe MagicTouch (recommended) |
|---|---|
| Task | mask-generation from one foreground keypoint |
| Runtime | @mediapipe/tasks-vision@0.10.18, InteractiveSegmenter.segment(), worker-first |
| Pinned artifact | float32 generation 1 · 6,227,884 bytes · SHA-256 e24338a717c1b7ad8d159666677ef400babb7f33b8ad60c4d96db4ecf694cd25 |
| Architecture | MobileNetV3-like CNN with customized decoder |
| Input | 512×512×4: RGB plus a one-hot prior map for the point of interest |
| Output | 512×512×2 background/foreground logits, exposed as confidence and category masks at image resolution |
| Backend | CPU/WASM fallback; GPU delegate only after a real adapter probe |
| License | Apache-2.0 (model card, 13 March 2023) |
Why it matters
A point is a much lighter prompt than drawing a polygon. That makes precise object selection available to private photo editors, annotation tools, visual accessibility workflows, and creative effects without a server round-trip.
- Private editing: cut a subject out without uploading the photo.
- Fast annotation: turn one click into a dense training mask.
- Object-aware effects: keep, recolour, blur, or measure only the selected region.
- Honest limits: the model card warns about small/distant objects, thin features, close objects merging, and non-consensual human segmentation.
Five-angle portfolio
How the API works
const segmenter = await InteractiveSegmenter.createFromOptions(vision, {
baseOptions: { modelAssetBuffer: verifiedMagicTouchBytes, delegate: "CPU" },
outputCategoryMask: true,
outputConfidenceMasks: true,
});
const result = segmenter.segment(imageBitmap, {
keypoint: { x: 0.50, y: 0.50 }, // normalized coordinates
});
const foreground = result.confidenceMasks[0].getAsFloat32Array();
The raw MagicTouch model tensor has background and foreground channels. The MediaPipe task API demonstrated here exposes one normalized foreground confidence mask at confidenceMasks[0], plus the category mask. This implementation fetches the exact numbered artifact only after consent, checks its SHA-256 before creating the task, keeps one verified Cache Storage copy, and uses the shared loader for current/partial/clear/retry lifecycle. The site owns that 5.94 MB transfer: interrupted transfers restart from byte zero rather than claiming byte-range resume. It transfers the image bitmap into a dedicated worker and returns a transferred RGBA composite.