imagestringbắt buộc
URL of the image to be segmented
meta/sam-3/imageSAM 3 Image is Meta's segmentation model. It finds objects in an image from a text, point, or box prompt and returns masks and the masked image, with optional confidence scores.
Thử model
PNG, JPEG, WebP hoặc GIF · tối đa 20 MiB
Đầu ra của bạn sẽ xuất hiện ở đây
Hoàn tất đầu vào, rồi nhấp Run.
SAM 3 segments objects in an image from a text, point, or box prompt and returns masks.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | wheel | What to segment, e.g. “the red car”. |
image | image URL, required | — | Image to segment. JPEG, PNG, or WebP URL. |
output_format | jpeg / png | png | Output file format. |
box_prompts | item[] | [] | Optional boxes. |
text_prompt | string | — | [DEPRECATED] Use 'prompt' instead. |
include_scores | boolean | false | Whether to include mask confidence scores. |
apply_mask | boolean | true | Return the masked image. |
point_prompts | item[] | [] | Optional points. |
return_multiple_masks | boolean | false | If True, upload and return multiple generated masks as defined by max_masks. |
max_masks | integer 1–32 | 3 | Maximum masks to return. |
include_boxes | boolean | false | Whether to include bounding boxes for each mask (when available). |
$0.005 per image.
| Request | Price |
|---|---|
| One image | $0.005 |
Failed runs are not charged.
Related: meta/sam-3/3d-objects.
Bắt đầu xây dựng
Gửi model này qua SandBase Unified Run API.
# The quoted heredoc keeps Unicode and shell metacharacters unchanged.
result=$(curl --fail-with-body --silent \
-X POST "https://api.sandbase.ai/v1/run" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'SANDBASE_JSON'
{
"model": "meta/sam-3/image",
"image": "https://raw.githubusercontent.com/facebookresearch/segment-anything-2/main/notebooks/images/truck.jpg",
"prompt": "wheel",
"max_masks": 3,
"apply_mask": true,
"box_prompts": [],
"include_boxes": false,
"output_format": "png",
"point_prompts": [],
"include_scores": false,
"return_multiple_masks": false
}
SANDBASE_JSON
)
run_id=$(printf '%s' "$result" | jq -r .id)
for attempt in $(seq 1 120); do
status=$(printf '%s' "$result" | jq -r .status)
case "$status" in completed|failed|timeout) break ;; esac
sleep 2
result=$(curl --fail-with-body --silent \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
"https://api.sandbase.ai/v1/run/$run_id")
done
status=$(printf '%s' "$result" | jq -r .status)
[ "$status" = completed ] || { echo "Generation ended: $status" >&2; exit 1; }
printf '%s\n' "$result"Tạo một SandBase API key và đặt nó trong môi trường máy chủ của bạn. Tất cả request sử dụng xác thực Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Giữ key trên máy chủ. Không hiển thị trong mã trình duyệt hoặc commit vào repository.
POST tới /v1/run với model ID này và các đầu vào của nó. Ví dụ request ở trên bao gồm cả bước gửi và polling.
Dùng run ID được trả về để poll cho đến khi trạng thái là completed, failed hoặc timeout. Chỉ đọc đầu ra sau khi completed.
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"Cung cấp một URL tệp có thể truy cập công khai trong trường image, video hoặc audio của model. Các định dạng và giới hạn được hỗ trợ hiển thị bên cạnh từng input trong Playground.
Dùng điều khiển upload hoặc replace trên các trường image được hỗ trợ trong Playground. Trường URL video chấp nhận một video driving được host; điều này không đồng nghĩa hỗ trợ tải lên video.
imagestringbắt buộcURL of the image to be segmented
promptstringbắt buộcText prompt for segmentation
Mặc định: "wheel"
max_masksintegerMaximum number of masks to return when `return_multiple_masks` is enabled.
Mặc định: 3
Tối thiểu: 1
Tối đa: 32
apply_maskbooleanApply the mask on the image.
Mặc định: true
box_promptsarrayBox prompt coordinates (x_min, y_min, x_max, y_max). Multiple boxes supported - use object_id to group boxes for the same object or leave empty for separate objects.
Mặc định: []
text_promptstring[DEPRECATED] Use 'prompt' instead. Kept for backward compatibility.
include_boxesbooleanWhether to include bounding boxes for each mask (when available).
Mặc định: false
output_formatstringThe format of the generated image.
Mặc định: "png"
Giá trị có thể dùng: "jpeg", "png"
point_promptsarrayList of point prompts
Mặc định: []
include_scoresbooleanWhether to include mask confidence scores.
Mặc định: false
return_multiple_masksbooleanIf True, upload and return multiple generated masks as defined by `max_masks`.
Mặc định: false
{
"model": "meta/sam-3/image",
"image": "https://raw.githubusercontent.com/facebookresearch/segment-anything-2/main/notebooks/images/truck.jpg",
"prompt": "wheel",
"max_masks": 3,
"apply_mask": true,
"box_prompts": [],
"include_boxes": false,
"output_format": "png",
"point_prompts": [],
"include_scores": false,
"return_multiple_masks": false
}Một run đã hoàn tất sẽ hiển thị kết quả trong output. Phần sau là ví dụ đã lưu của model, không phải một lần tạo mới.
Chưa có đầu ra ví dụ nào được công bố. Dùng Playground → Result → JSON sau khi run hoàn tất để xem phản hồi của bạn.