DocsInferenceServe custom modelsSAM 2.1 segmentation
Inference · Serve custom models

SAM 2.1 segmentation

Point-prompted image segmentation on any 12 GB card — click a point, get masks.

What it is

Folder: sam2.1_segmentation_min_6gb_vram. Promptable segmentation with SAM 2.1 hiera-large (Apache-2.0): send an image and a point or box, get pixel-accurate masks back, ranked by confidence. A general tool — the base for interactive labeling, QC tooling, or any click-to-select feature.

It runs the standard predictor contract: one class, Sam2Segmenter, whose predict() accepts JSON with prompts or bare image bytes (which default to a center-point prompt). Weights (~3.5 GB) pull from HuggingFace Hub inside __init__; there is no weights upload.

inference.yaml (core)

Request and response

Prompts ride in a JSON body sent as octet-stream (the predict_json pattern; plain application/json would drop the prompt fields, see serve.py):

request
response

Submit and call

From your own code, via the SDK client:

client.py

Hardware

VRAM min → recCPURAMFree disk
6 → 12 GB4 cores24 GB~13 GB (image + ~3.5 GB weights)
i
Any 12 GB card runs it comfortably (RTX 5070 / 4070 / 3060-12G). For shared-worker deployments, switching model_id to sam2.1-hiera-small (~1 GB) halves the footprint at some quality cost.