콘텐츠로 건너뛰기

Segment Anything Model 2 · Image

통합

모델 id sam2/image
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/sam2/image?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

이 요청: ≈$0.002 2 API 크레딧 이 페이지에서 실행

API 키 받기
Meta 이미지 편집 #segmentation#mask#real-time

점 또는 상자 프롬프트로 단일 이미지의 객체를 분할하여 마스크 또는 마스크가 적용된 이미지를 반환합니다.

Meta · 이미지

첫 번째 결과가 여기에 표시됩니다

아래에서 요청을 작성하고 API 키로 실행하세요. 출력은 스토리지에 복사되며, 영구 보관하거나 7일 동안 무료로 보관할 수 있습니다.

요청 만들기

컨트롤은 모델 스키마에서 생성됩니다. 값을 변경하면 코드와 가격이 업데이트됩니다.

•필수 image_url
파일을 끌어다 놓거나

분할할 이미지를 가리키는 URL입니다.

고급 output_format · apply_mask · prompts · box_prompts
output_format 기본값 png

결과 이미지의 파일 형식입니다.

기본값 []

이미지 분할에 사용할 프롬프트입니다.

기본값 []

상자 경계 좌표입니다.

POST /run/sam2/image?wait=20 견적 → $0.002
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/sam2/image?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "image": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
  }'

# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

이 요청 실행

키는 이 브라우저에 유지됩니다. Doitong API로만 전송되며, 기억하기를 선택한 경우에만 localStorage에 저장됩니다. API 키 받기

Segment Anything Model 2 · Image 정보

점 프롬프트(`prompts`) 또는 상자 좌표(`box_prompts`)를 사용해 SAM 2로 이미지를 분할합니다. `apply_mask`를 true로 설정하면 마스크만 반환하는 대신 이미지에 마스크를 적용합니다. 출력은 jpeg, png 또는 webp로 저장할 수 있으며 기본값은 png입니다. 요청당 이미지 URL 하나를 받습니다.

매개변수

표준 이름이나 네이티브 이름 중 하나만 보내세요. 표준 이름

이름유형 기본값허용됨 설명
image_url필수 image
유형url · image
분할할 이미지를 가리키는 URL입니다.
prompts선택 사항
유형object[]
기본값[]
이미지 분할에 사용할 프롬프트입니다.
prompts[].x선택 사항
유형integer
기본값305
X축에서의 프롬프트 위치입니다.
prompts[].y선택 사항
유형integer
기본값350
Y축에서의 프롬프트 위치입니다.
prompts[].label선택 사항
유형enum
기본값1
01
프롬프트 레이블입니다. 1은 전경, 0은 배경을 나타냅니다.
prompts[].frame_index선택 사항
유형integer
기본값0
상호작용할 프레임을 식별하는 인덱스입니다.
box_prompts선택 사항
유형object[]
기본값[]
상자 경계 좌표입니다.
box_prompts[].x_min선택 사항
유형integer
기본값0
상자의 최소 x 좌표입니다.
box_prompts[].y_min선택 사항
유형integer
기본값0
상자의 최소 y 좌표입니다.
box_prompts[].x_max선택 사항
유형integer
기본값0
프롬프트의 최대 x 좌표입니다.
box_prompts[].y_max선택 사항
유형integer
기본값0
프롬프트의 최대 y 좌표입니다.
box_prompts[].frame_index선택 사항
유형integer
기본값0
상호작용할 프레임을 식별하는 인덱스입니다.
apply_mask선택 사항
유형boolean
기본값false
이미지에 마스크를 적용할지 제어합니다.
output_format선택 사항
유형enum
기본값png
jpegpngwebp
결과 이미지의 파일 형식입니다.
필수 표준 이름, 사용 가능

파일 매개변수에는 공개 https:// URL, 최대 10 MB의 data: URI 또는 업로드의 file_url을 사용할 수 있습니다. 파일

출력

GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
  "id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
  "object": "request",
  "model": "sam2/image",
  "status": "succeeded",
  "created_at": "2026-10-20T12:00:00Z",
  "started_at": "2026-10-20T12:00:02Z",
  "completed_at": "2026-10-20T12:00:09Z",
  "queue_position": null,
  "cost": {
    "credits": 2,
    "usd": "0.002",
    "charged": 2,
    "refunded": 0
  },
  "input": {
    "image_url": "https://content.doitong.com/images/showcase/v3/gen_fox_cartoon.jpg"
  },
  "output": {
    "image": {
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
      "content_type": "image/jpeg",
      "file_name": "0-output.jpeg",
      "file_size": 1843200,
      "width": 1024,
      "height": 768
    }
  },
  "outputs": [
    {
      "type": "image",
      "url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
      "content_type": "image/jpeg",
      "file_size": 1843200,
      "width": 1024,
      "height": 768,
      "stored": true
    }
  ],
  "error": null,
  "metrics": {
    "inference_seconds": 6.8
  },
  "urls": {
    "self": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
    "cancel": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
  }
}
파일 보관 방식 선택모든 outputs[].url은 스토리지에 저장된 복사본입니다. 계정 설정 또는 ?storage=에 따라 영구 보관(GB-월 단위 과금)하거나 7일 동안 무료로 보관합니다.
모든 모델에서 동일한 구조이미지, 동영상, 오디오 모두 type, url, content_type, width, height 및 duration을 사용합니다. output은 모델 자체의 결과 객체입니다.
출력 필드
image
object {url, content_type, file_name, file_size, width, height}분할이 적용된 이미지입니다.

더 많은 모델: 이미지 편집

AI 에이전트용: 이 페이지의 Markdown 버전: https://doitong.com/ko/developers/models/sam2/image.md. 모든 모델 및 가이드: https://doitong.com/developers/llms.txt