Peke ki ngā ihirangi

Segment Anything Model 2 · Image

Whakauru

id tauira 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"

Tēnei tono: ≈$ 0.002 2 whiwhinga API Whakahaerehia ki tēnei whārangi

Tikina he kī API
Meta Whakatika Atahanga #segmentation#mask#real-time

Ka wehewehe i ngā ahanoa i tētahi whakaahua kotahi mā ngā akiaki ira, pouaka rānei, ka whakahoki kopare, whakaahua kopare rānei

Meta · Atahanga

Kei konei tō hua tuatahi

Hangaia he tono ki raro nei, ka whakahaere mā tō kī API. Ka tāruatia ngā putanga ki tō mātou rokiroki, ka puritia mō ake tonu atu, mō rānei 7 rā mō te kore utu.

Hangaia he tono

Ka hangaia ngā mana whakahaere mai i te aronuinga o te tauira. Ka whakahoungia te waehere me te utu ina whakarerekē koe.

•e hiahiatia ana image_url
Whakataka he kōnae,

URL e tohu ana ki te atahanga hei wehewehe.

Arā atu output_format · apply_mask · prompts · box_prompts
output_format taunoa png

Te hōputu kōnae mō te atahanga ka puta.

taunoa []

Ngā tohutohu mō te wehewehenga atahanga.

taunoa []

Ngā taunga rohe pouaka.

POST /run/sam2/image?wait=20 utu → $ 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"

Whakahaerehia tēnei tono

Ka noho tō kī ki tēnei pūtirotiro: ka tukuna ki te Doitong API anake, ā, ka tiakina ki te localStorage anake ina tohua e koe te Mahara. Tikina he kī API

Mō Segment Anything Model 2 · Image

Ka wehewehe i tētahi whakaahua ki SAM 2 mā ngā akiaki ira (`prompts`) me ngā taunga pouaka (`box_prompts`). Tautuhia `apply_mask` ki true kia whiwhi i te kopare kua whakaurua ki te whakaahua, kaua ko te kopare anake. Ka taea te tiaki i te putanga hei jpeg, png, webp rānei, ko png te taunoa. Kotahi te URL whakaahua mō ia tono.

Ngā tawhā

Tukuna te ingoa tōmua, te ingoa taketake rānei, kaua e rua. Ngā ingoa tōmua

IngoaMomo TaunoaE whakaaetia ana Whakamārama
image_urle hiahiatia ana image
Momourl · image
URL e tohu ana ki te atahanga hei wehewehe.
promptskōwhiringa
Momoobject[]
Taunoa[]
Ngā tohutohu mō te wehewehenga atahanga.
prompts[].xkōwhiringa
Momointeger
Taunoa305
Tūranga o te tohutohu i te tuaka X.
prompts[].ykōwhiringa
Momointeger
Taunoa350
Tūranga o te tohutohu i te tuaka Y.
prompts[].labelkōwhiringa
Momoenum
Taunoa1
01
Tapanga tohutohu: ko te 1 te papa-mua, ko te 0 te papamuri.
prompts[].frame_indexkōwhiringa
Momointeger
Taunoa0
Taupū e tautuhi ana i te anga mō te taunekeneke.
box_promptskōwhiringa
Momoobject[]
Taunoa[]
Ngā taunga rohe pouaka.
box_prompts[].x_minkōwhiringa
Momointeger
Taunoa0
Te taunga x iti rawa mō te pouaka.
box_prompts[].y_minkōwhiringa
Momointeger
Taunoa0
Te taunga y iti rawa mō te pouaka.
box_prompts[].x_maxkōwhiringa
Momointeger
Taunoa0
Te taunga x nui rawa mō te tohutohu.
box_prompts[].y_maxkōwhiringa
Momointeger
Taunoa0
Te taunga y nui rawa mō te tohutohu.
box_prompts[].frame_indexkōwhiringa
Momointeger
Taunoa0
Taupū e tautuhi ana i te anga mō te taunekeneke.
apply_maskkōwhiringa
Momoboolean
Taunoafalse
Ka whakahaere mēnā ka whakamahia te kanohi ki te atahanga.
output_formatkōwhiringa
Momoenum
Taunoapng
jpegpngwebp
Te hōputu kōnae mō te atahanga ka puta.
e hiahiatia ana Ingoa tōmua, e whakaaetia ana hoki

Mō ngā tawhā kōnae, whakamahia he URL tūmatanui https://, he URI data: tae atu ki te 10 MB, he file_url rānei o tētahi tukuake. Ngā kōnae

Putanga

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"
  }
}
Ō kōnae, māu e whiriwhiriKo ia url o outputs[] he tārua kei tō mātou rokiroki: ka puritia mō ake tonu atu (ka utua ia GB-marama) mō rānei 7 rā mō te kore utu, e ai ki ngā tautuhinga o tō pūkete, ki te ?storage= rānei.
He ōrite te hanga ki ia tauiratype, url, content_type, width, height me duration, mō ngā pikitia, ataata me te oro. Ko output te ahanoa hua ake o te tauira.
Ngā āpure o te putanga
image
object {url, content_type, file_name, file_size, width, height}Atahanga kua whakamahia te wehewehenga.

Ētahi atu tauira: Whakatika Atahanga

Mō ngā āpiha AI: kei te wātea tēnei whārangi hei Markdown ki https://doitong.com/mi/developers/models/sam2/image.md. Ngā tauira me ngā aratohu katoa: https://doitong.com/developers/llms.txt