ข้ามไปยังเนื้อหา

Sam 3 1 · Image

ผสานการทำงาน

ID โมเดล sam-3-1/image
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.ru/v1/run/sam-3-1/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.ru/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

คำขอนี้: ≈$0.01 10 เครดิต API · ≈ ₽1.05 เรียกใช้ในหน้านี้

รับคีย์ API
Meta แก้ไขภาพ #segmentation#mask#real-time

การแบ่งส่วนภาพด้วย SAM 3.1 จากพรอมต์ข้อความ จุด หรือกรอบ โดยส่งคืนภาพหน้ากาก

Meta · ภาพ

ผลลัพธ์แรกของคุณจะแสดงที่นี่

สร้างคำขอด้านล่างและเรียกใช้ด้วยคีย์ API ของคุณ เอาต์พุตจะถูกคัดลอกไปยังพื้นที่จัดเก็บของเรา และเก็บไว้ตลอดไปหรือฟรี 7 วัน

สร้างคำขอ

ตัวควบคุมสร้างจากสคีมาของโมเดล โค้ดและราคาจะอัปเดตเมื่อคุณเปลี่ยนค่า

ค่าเริ่มต้น wheel

คำสั่งข้อความสำหรับกำกับการแบ่งส่วน

•จำเป็น image_url
วางไฟล์ หรือ

URL ที่ชี้ไปยังรูปภาพสำหรับการแบ่งส่วน

ขั้นสูง output_format · max_masks · apply_mask · return_multiple_masks · include_scores · include_boxes · point_prompts · box_prompts
output_format ค่าเริ่มต้น png

รูปแบบไฟล์ของรูปภาพผลลัพธ์

ค่าเริ่มต้น 3

ขีดจำกัดสูงสุดของมาสก์ที่ส่งคืนเมื่อเปิดใช้ `return_multiple_masks`

ค่าเริ่มต้น []

คอลเลกชันของพรอมต์แบบจุด

ค่าเริ่มต้น []

พรอมต์แบบกรอบที่ object_id ใช้กำหนดการจัดกลุ่ม ID ที่ตรงกันจะเชื่อมโยงกรอบเข้ากับวัตถุเดียวกัน ส่วน ID ว่างจะแทนวัตถุแยกกัน สามารถระบุหลายกรอบได้ โดยแต่ละกรอบใช้พิกัด (x_min, y_min, x_max, y_max)

POST /run/sam-3-1/image?wait=20 ใบเสนอราคา → $0.01
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.ru/v1/run/sam-3-1/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.ru/v1/requests/REQUEST_ID?wait=20" \
  -H "Authorization: Bearer $DOITONG_API_KEY"

เรียกใช้คำขอนี้

คีย์ของคุณจะอยู่ในเบราว์เซอร์นี้ โดยส่งไปยัง Doitong API เท่านั้น และจะบันทึกใน localStorage ก็ต่อเมื่อคุณเลือกจดจำ รับคีย์ API

เกี่ยวกับ Sam 3 1 · Image

แบ่งส่วนภาพหนึ่งภาพด้วย SAM 3.1 โดยใช้ข้อความ `prompt`, `point_prompts` หรือ `box_prompts` สามารถจัดกลุ่มหลายกรอบต่อวัตถุได้ด้วย object_id `return_multiple_masks` ส่งคืนหน้ากากได้สูงสุด `max_masks` (1 ถึง 32) พร้อมคะแนนและกรอบครอบแบบเลือกได้ รูปแบบเอาต์พุตคือ jpeg, png หรือ webp

พารามิเตอร์

ส่งชื่อมาตรฐานหรือชื่อดั้งเดิมอย่างใดอย่างหนึ่งเท่านั้น ห้ามส่งทั้งสองชื่อ ชื่อมาตรฐาน

ชื่อประเภท ค่าเริ่มต้นค่าที่อนุญาต คำอธิบาย
image_urlจำเป็น image
ประเภทurl · image
URL ที่ชี้ไปยังรูปภาพสำหรับการแบ่งส่วน
promptไม่บังคับ
ประเภทstring
ค่าเริ่มต้นwheel
คำสั่งข้อความสำหรับกำกับการแบ่งส่วน
point_promptsไม่บังคับ
ประเภทobject[]
ค่าเริ่มต้น[]
คอลเลกชันของพรอมต์แบบจุด
point_prompts[].xไม่บังคับ
ประเภทinteger | null
ตำแหน่งพรอมต์ตามแกน X
point_prompts[].yไม่บังคับ
ประเภทinteger | null
ตำแหน่งพรอมต์ตามแกน Y
point_prompts[].labelไม่บังคับ
ประเภทenum
01
ป้ายกำกับพื้นหน้า/พื้นหลัง: 1 หมายถึงพื้นหน้า และ 0 หมายถึงพื้นหลัง
point_prompts[].object_idไม่บังคับ
ประเภทinteger | null
ตัวระบุเสริมสำหรับจัดกลุ่มพรอมต์ที่ปรับปรุงวัตถุเดียวกัน หากระบุข้อความเป็นพรอมต์ด้วย ตัวระบุนี้จะกำหนดว่าจุดเหล่านั้นปรับปรุงวัตถุที่ตรวจพบใด
point_prompts[].frame_indexไม่บังคับ
ประเภทinteger | null
ดัชนีที่ระบุเฟรมสำหรับการโต้ตอบ
box_promptsไม่บังคับ
ประเภทobject[]
ค่าเริ่มต้น[]
พรอมต์แบบกรอบที่ object_id ใช้กำหนดการจัดกลุ่ม ID ที่ตรงกันจะเชื่อมโยงกรอบเข้ากับวัตถุเดียวกัน ส่วน ID ว่างจะแทนวัตถุแยกกัน สามารถระบุหลายกรอบได้ โดยแต่ละกรอบใช้พิกัด (x_min, y_min, x_max, y_max)
box_prompts[].x_minไม่บังคับ
ประเภทinteger | null
พิกัด x ต่ำสุดสำหรับกรอบ
box_prompts[].y_minไม่บังคับ
ประเภทinteger | null
พิกัด y ต่ำสุดสำหรับกรอบ
box_prompts[].x_maxไม่บังคับ
ประเภทinteger | null
พิกัด X สูงสุดของกรอบ
box_prompts[].y_maxไม่บังคับ
ประเภทinteger | null
พิกัด Y สูงสุดของกรอบ
box_prompts[].object_idไม่บังคับ
ประเภทinteger | null
ตัวระบุเสริมสำหรับจัดกลุ่มกรอบที่ปรับปรุงวัตถุเดียวกัน
box_prompts[].frame_indexไม่บังคับ
ประเภทinteger | null
ดัชนีที่ระบุเฟรมสำหรับการโต้ตอบ
apply_maskไม่บังคับ
ประเภทboolean
ค่าเริ่มต้นtrue
ควบคุมว่าจะใช้มาสก์กับรูปภาพหรือไม่
output_formatไม่บังคับ
ประเภทenum
ค่าเริ่มต้นpng
jpegpngwebp
รูปแบบไฟล์ของรูปภาพผลลัพธ์
return_multiple_masksไม่บังคับ
ประเภทboolean
ค่าเริ่มต้นfalse
ตัวเลือกการส่งคืนหลายมาสก์: เมื่อเปิดใช้ ระบบจะใช้ `max_masks` เพื่อกำหนดจำนวนมาสก์ที่สร้างและอัปโหลดเพื่อรวมไว้ใน response
max_masksไม่บังคับ
ประเภทinteger
ค่าเริ่มต้น3
1 – 32
ขีดจำกัดสูงสุดของมาสก์ที่ส่งคืนเมื่อเปิดใช้ `return_multiple_masks`
include_scoresไม่บังคับ
ประเภทboolean
ค่าเริ่มต้นfalse
ควบคุมการรวมคะแนนความมั่นใจสำหรับมาสก์
include_boxesไม่บังคับ
ประเภทboolean
ค่าเริ่มต้นfalse
ควบคุมการรวมกรอบล้อมรอบสำหรับแต่ละมาสก์ หากมี
จำเป็น ชื่อมาตรฐาน ซึ่งรองรับเช่นกัน

พารามิเตอร์ไฟล์รับ URL https:// สาธารณะ, data: URI ขนาดไม่เกิน 10 MB หรือ file_url ของไฟล์ที่อัปโหลด ไฟล์

เอาต์พุต

GET /requests/req_8k2m4q7x1z9c3v5b6n0p2r4t
{
  "id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
  "object": "request",
  "model": "sam-3-1/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": 10,
    "usd": "0.01",
    "charged": 10,
    "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
    },
    "masks": [
      {
        "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
      }
    ],
    "metadata": [
      {
        "index": 1,
        "score": 1.0,
        "box": [
          1.0
        ]
      }
    ],
    "scores": [
      1.0
    ],
    "boxes": [
      [
        1.0
      ]
    ]
  },
  "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.ru/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
    "cancel": "https://api.doitong.ru/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
  }
}
ไฟล์ของคุณ คุณเลือกเองทุก outputs[].url คือสำเนาบนพื้นที่จัดเก็บของเรา: เก็บไว้ตลอดไป (คิดค่าบริการต่อ GB-เดือน) หรือฟรี 7 วัน โดยกำหนดได้ในการตั้งค่าบัญชีหรือ ?storage=
รูปแบบเดียวกันในทุกโมเดลtype, url, content_type, width, height และ duration สำหรับภาพ วิดีโอ และเสียงเหมือนกันทั้งหมด ส่วน output คือออบเจ็กต์ผลลัพธ์ของโมเดลเอง
ฟิลด์ของเอาต์พุต
image
object {url, content_type, file_name, file_size, width, height} | nullภาพตัวอย่างที่แสดงมาสก์การแบ่งส่วนหลัก
masks
array of object {url, content_type, file_name, file_size, width, height}รูปภาพที่มีมาสก์การแบ่งส่วน
metadata
array of object {index, score, box} | nullข้อมูลเมตาสำหรับแต่ละมาสก์ รวมถึงคะแนนและกรอบ
scores
array of number | nullคะแนนความมั่นใจของแต่ละมาสก์ ซึ่งระบุเมื่อมีการร้องขอ
boxes
array of array of number | nullกรอบที่ปรับมาตรฐานแล้วสำหรับแต่ละมาสก์ ในรูปแบบ [cx, cy, w, h] หากมีการร้องขอ

โมเดลเพิ่มเติม: แก้ไขภาพ

สำหรับเอเจนต์ AI: หน้า Markdown นี้อยู่ที่ https://doitong.com/th/developers/models/sam-3-1/image.md. โมเดลและคู่มือทั้งหมด: https://doitong.com/developers/llms.txt