Views
No views yet
facebook/sam2.1-hiera-base-plus with Meta's official
sam2.sam2_image_predictor.SAM2ImagePredictor API and exposes the exact contract
the backend expects:1{
2 "inputs": {
3 "image_base64": "...",
4 "mime_type": "image/png",
5 "boxes": [
6 { "id": "sofa", "box": { "x1": 120, "y1": 300, "x2": 640, "y2": 760 } }
7 ]
8 }
9}1{
2 "masks": [
3 {
4 "id": "sofa",
5 "score": 0.93,
6 "mask_png_base64": "...",
7 "box": { "x1": 120, "y1": 300, "x2": 640, "y2": 760 },
8 "mime_type": "image/png"
9 }
10 ]
11}requirements.txt intentionally avoids transformers. The model card supports
a Transformers route, but the stable first-party path for this custom endpoint is
SAM2ImagePredictor.from_pretrained("facebook/sam2.1-hiera-base-plus"). The
handler calls set_image() once per request and segments all provided boxes in
one predictor call.handler.py and requirements.txt to a Hugging Face model repo, then
deploy that repo as an Inference Endpoint with task Custom.