你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
Describe Image In Stream - Describe Image In Stream
此操作使用完整的句子以人类可读语言生成图像的说明。 该说明基于内容标记的集合,而这些标记也由该操作返回。 可为每个图像生成多段说明。 说明按其置信度评分排序。 说明可能包括名人和地标域模型的结果(如果适用)。 支持两种输入方法 -- (1) 上传图像; (2) 指定图像 URL。 成功响应将以 JSON 格式返回。 如果请求失败,响应将包含错误代码和消息,以帮助了解问题所在。
POST {Endpoint}/vision/v3.1/describe
POST {Endpoint}/vision/v3.1/describe?overload=stream&maxCandidates={maxCandidates}&language={language}&descriptionExclude={descriptionExclude}
URI 参数
名称 | 在 | 必需 | 类型 | 说明 |
---|---|---|---|---|
Endpoint
|
path | True |
string |
支持的认知服务终结点。 |
description
|
query |
生成说明时关闭指定的域模型。 |
||
language
|
query |
string |
输出生成所需的语言。 如果未指定此参数,则默认值为“en”。支持的语言:en - 英语,默认值。 es - 西班牙语、ja - 日语、pt - 葡萄牙语、zh - 简体中文。 |
|
max
|
query |
integer int32 |
要返回的候选说明的最大数目。 默认值为 1。 |
请求头
Media Types: "application/octet-stream", "multipart/form-data"
名称 | 必需 | 类型 | 说明 |
---|---|---|---|
Ocp-Apim-Subscription-Key | True |
string |
请求正文
Media Types: "application/octet-stream", "multipart/form-data"
名称 | 类型 | 说明 |
---|---|---|
Image |
object |
图像流。 |
响应
名称 | 类型 | 说明 |
---|---|---|
200 OK |
图像描述对象。 |
|
Other Status Codes |
错误响应。 |
安全性
Ocp-Apim-Subscription-Key
Type:
apiKey
In:
header
示例
Successful DescribeImage request
Sample Request
POST https://westus.api.cognitive.microsoft.com/vision/v3.1/describe?overload=stream&maxCandidates=1
"{binary}"
Sample Response
{
"description": {
"tags": [
"person",
"man",
"outdoor",
"window",
"glasses"
],
"captions": [
{
"text": "Satya Nadella sitting on a bench",
"confidence": 0.48293603002174407
},
{
"text": "Satya Nadella is sitting on a bench",
"confidence": 0.4003700681542283
},
{
"text": "Satya Nadella sitting in front of a building",
"confidence": 0.38035155997373377
}
]
},
"requestId": "ed2de1c6-fb55-4686-b0da-4da6e05d283f",
"metadata": {
"width": 1500,
"height": 1000,
"format": "Jpeg"
}
}
定义
名称 | 说明 |
---|---|
Computer |
有关 API 请求错误的详细信息。 |
Computer |
错误代码。 |
Description |
生成说明时关闭指定的域模型。 |
Image |
图像描述文字,即图像描述的内容的简要说明。 |
Image |
内容标记的集合,以及按置信度排序的标题列表和图像元数据。 |
Image |
图像元数据。 |
ComputerVisionError
有关 API 请求错误的详细信息。
名称 | 类型 | 说明 |
---|---|---|
code |
错误代码。 |
|
message |
string |
解释服务报告的错误的消息。 |
requestId |
string |
唯一请求标识符。 |
ComputerVisionErrorCodes
错误代码。
名称 | 类型 | 说明 |
---|---|---|
BadArgument |
string |
|
CancelledRequest |
string |
|
DetectFaceError |
string |
|
FailedToProcess |
string |
|
InternalServerError |
string |
|
InvalidDetails |
string |
|
InvalidImageFormat |
string |
|
InvalidImageSize |
string |
|
InvalidImageUrl |
string |
|
InvalidModel |
string |
|
InvalidThumbnailSize |
string |
|
NotSupportedFeature |
string |
|
NotSupportedImage |
string |
|
NotSupportedLanguage |
string |
|
NotSupportedVisualFeature |
string |
|
StorageException |
string |
|
Timeout |
string |
|
Unspecified |
string |
|
UnsupportedMediaType |
string |
DescriptionExclude
生成说明时关闭指定的域模型。
名称 | 类型 | 说明 |
---|---|---|
Celebrities |
string |
|
Landmarks |
string |
ImageCaption
图像描述文字,即图像描述的内容的简要说明。
名称 | 类型 | 说明 |
---|---|---|
confidence |
number |
服务对描述文字的置信度级别。 |
text |
string |
描述文字的文本。 |
ImageDescription
内容标记的集合,以及按置信度排序的标题列表和图像元数据。
名称 | 类型 | 说明 |
---|---|---|
description.captions |
标题列表,按置信度排序。 |
|
description.tags |
string[] |
图像标记的集合。 |
metadata |
图像元数据。 |
|
requestId |
string |
REST API 请求的 ID。 |
ImageMetadata
图像元数据。
名称 | 类型 | 说明 |
---|---|---|
format |
string |
图像格式。 |
height |
integer |
图像高度(以像素为单位)。 |
width |
integer |
图像宽度(以像素为单位)。 |