Detect Objects In Stream - Detect Objects In Stream
在指定的影像上執行物件偵測。 支援兩個輸入法 -- (1) 上傳影像或指定影像 URL 的 (2)。 成功的回應將會以 JSON 傳回。 如果要求失敗,回應將會包含錯誤碼和訊息,以協助了解發生錯誤的原因。
POST {Endpoint}/vision/v3.2/detect
POST {Endpoint}/vision/v3.2/detect?overload=stream&model-version={model-version}
URI 參數
| 名稱 | 位於 | 必要 | 類型 | Description |
|---|---|---|---|---|
|
Endpoint
|
path | True |
string |
支援的認知服務端點。 |
|
model-version
|
query |
string pattern: ^(latest|\d{4}-\d{2}-\d{2})(-preview)?$ |
選擇性參數來指定 AI 模型的版本。 接受的值包括:“latest”、“2021-04-01”、“2021-05-01”。 預設為 「latest」。。 |
要求標頭
Media Types: "application/octet-stream", "multipart/form-data"
| 名稱 | 必要 | 類型 | Description |
|---|---|---|---|
| Ocp-Apim-Subscription-Key | True |
string |
要求本文
Media Types: "application/octet-stream", "multipart/form-data"
| 名稱 | 類型 | Description |
|---|---|---|
| Image |
object (file) |
影像數據流。 |
回應
| 名稱 | 類型 | Description |
|---|---|---|
| 200 OK |
回應包含 JSON 格式的偵測到物件。 |
|
| Other Status Codes |
錯誤回應。 |
安全性
Ocp-Apim-Subscription-Key
類型:
apiKey
位於:
header
範例
Successful DetectObjects request
範例要求
POST https://westus.api.cognitive.microsoft.com/vision/v3.2/detect?overload=stream
"{binary}"
範例回覆
{
"objects": [
{
"rectangle": {
"x": 0,
"y": 0,
"w": 50,
"h": 50
},
"object": "tree",
"confidence": 0.9,
"parent": {
"object": "plant",
"confidence": 0.95
}
}
],
"requestId": "1ad0e45e-b7b4-4be3-8042-53be96103337",
"metadata": {
"width": 100,
"height": 100,
"format": "Jpeg"
},
"modelVersion": "2021-04-01"
}
定義
| 名稱 | Description |
|---|---|
|
Bounding |
影像內區域的周框方塊。 |
|
Computer |
API 要求錯誤。 |
|
Computer |
錯誤碼。 |
|
Computer |
API 錯誤回應。 |
|
Computer |
API 要求錯誤的詳細數據。 |
|
Computer |
錯誤碼。 |
|
Detected |
影像中偵測到的物件。 |
|
Detect |
DetectImage 呼叫的結果。 |
|
Image |
影像元數據。 |
|
Object |
在影像內偵測到的物件。 |
BoundingRect
影像內區域的周框方塊。
| 名稱 | 類型 | Description |
|---|---|---|
| h |
integer (int32) |
從區域左上方點測量的高度,以像素為單位。 |
| w |
integer (int32) |
以像素為單位,從區域左上方點測量的寬度。 |
| x |
integer (int32) |
區域左上方點的 X 座標,以像素為單位。 |
| y |
integer (int32) |
區域左上方點的 Y 座標,以像素為單位。 |
ComputerVisionError
API 要求錯誤。
| 名稱 | 類型 | Description |
|---|---|---|
| code |
錯誤碼。 |
|
| innererror |
內部錯誤包含更具體的資訊。 |
|
| message |
string |
說明服務所回報錯誤的訊息。 |
ComputerVisionErrorCodes
錯誤碼。
| 值 | Description |
|---|---|
| InvalidRequest | |
| InvalidArgument | |
| InternalServerError | |
| ServiceUnavailable |
ComputerVisionErrorResponse
API 錯誤回應。
| 名稱 | 類型 | Description |
|---|---|---|
| error |
錯誤內容。 |
ComputerVisionInnerError
API 要求錯誤的詳細數據。
| 名稱 | 類型 | Description |
|---|---|---|
| code |
錯誤碼。 |
|
| message |
string |
錯誤資訊。 |
ComputerVisionInnerErrorCodeValue
錯誤碼。
| 值 | Description |
|---|---|
| InvalidImageFormat | |
| UnsupportedMediaType | |
| InvalidImageUrl | |
| NotSupportedFeature | |
| NotSupportedImage | |
| Timeout | |
| InternalServerError | |
| InvalidImageSize | |
| BadArgument | |
| DetectFaceError | |
| NotSupportedLanguage | |
| InvalidThumbnailSize | |
| InvalidDetails | |
| InvalidModel | |
| CancelledRequest | |
| NotSupportedVisualFeature | |
| FailedToProcess | |
| Unspecified | |
| StorageException |
DetectedObject
影像中偵測到的物件。
| 名稱 | 類型 | Description |
|---|---|---|
| confidence |
number (double) |
在影像中觀察到物件的信賴分數,其值為0到1。 |
| object |
string |
對象的標籤。 |
| parent |
父物件,從分類法的觀點。 父對像是這個物件的較泛型形式。 例如,「鬥牛犬」會有「狗」的父代。 |
|
| rectangle |
偵測到物件的近似位置。 |
DetectResult
DetectImage 呼叫的結果。
| 名稱 | 類型 | Description |
|---|---|---|
| metadata |
影像元數據。 |
|
| modelVersion |
string pattern: ^(latest|\d{4}-\d{2}-\d{2})(-preview)?$ |
AI 模型的版本。 |
| objects |
偵測到物件的陣列。 |
|
| requestId |
string |
REST API 要求的標識碼。 |
ImageMetadata
影像元數據。
| 名稱 | 類型 | Description |
|---|---|---|
| format |
string |
影像格式。 |
| height |
integer (int32) |
影像高度,以像素為單位。 |
| width |
integer (int32) |
影像寬度,以像素為單位。 |
ObjectHierarchy
在影像內偵測到的物件。
| 名稱 | 類型 | Description |
|---|---|---|
| confidence |
number (double) |
在影像中觀察到物件的信賴分數,其值為0到1。 |
| object |
string |
對象的標籤。 |
| parent |
父物件,從分類法的觀點。 父對像是這個物件的較泛型形式。 例如,「鬥牛犬」會有「狗」的父代。 |