你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

Image Moderation - Match Url Input

模糊匹配自定义映像列表之一的图像。 可以使用 此 API来创建和管理自定义映像列表。

返回匹配图像的 ID 和标记。

注意:必须刷新相应图像列表上的索引,以确保添加和删除反映在响应中。

POST {Endpoint}/contentmoderator/moderate/v1.0/ProcessImage/Match
POST {Endpoint}/contentmoderator/moderate/v1.0/ProcessImage/Match?overload=url&listId={listId}&CacheImage={CacheImage}

URI 参数

名称 必需 类型 说明
Endpoint
path True

string

支持的 Azure 认知服务终结点(协议和主机名,如 https://westus.api.cognitive.microsoft.com)。

CacheImage
query

boolean

是否保留提交的映像以供将来使用。 如果省略,则默认值为 false。

listId
query

string

列表 ID。

请求头

名称 必需 类型 说明
Ocp-Apim-Subscription-Key True

string

Content-Type True

string

内容类型。

请求正文

名称 类型 说明
DataRepresentation

string

Value

string

响应

名称 类型 说明
200 OK

MatchResponse

标记支持的值包括:

  • 101:裸体
  • 102:性内容
  • 201:酒精
  • 202:烟草
  • 203:毒品
  • 301:儿童剥削
  • 401:暴力
  • 402:武器
  • 403:戈尔
  • 501:亵渎
  • 502:粗俗
.
Other Status Codes

APIError

错误响应。

安全性

Ocp-Apim-Subscription-Key

类型: apiKey
在: header

示例

Match Image request

示例请求

POST {Endpoint}/contentmoderator/moderate/v1.0/ProcessImage/Match?overload=url&listId=12345



{
  "DataRepresentation": "URL",
  "Value": "https://moderatorsampleimages.blob.core.windows.net/samples/sample.jpg"
}

示例响应

{
  "IsMatch": true,
  "Matches": [
    {
      "Score": 1,
      "MatchId": 89203,
      "Source": "89117",
      "Tags": [],
      "Label": "ImageA"
    },
    {
      "Score": 1,
      "MatchId": 92708,
      "Source": "89083",
      "Tags": [],
      "Label": "ImageB"
    }
  ],
  "Status": {
    "Code": 3000,
    "Description": "OK",
    "Exception": ""
  },
  "TrackingId": "WE_7be19175b8274274baea9219e6b6b1b0_ContentModerator.Preview_44b1f691-35ee-4d49-a981-0d01d07f18d6",
  "CacheID": "c660dfa6-eba9-4950-aa58-a6967de57ea8_636422189473647994"
}

定义

名称 说明
APIError

API 返回的错误信息。

Error

错误正文。

Match

匹配详细信息。

MatchResponse

匹配请求的响应。

Status

状态属性。

APIError

API 返回的错误信息。

名称 类型 说明
Error

Error

错误正文。

Error

错误正文。

名称 类型 说明
Code

string

Message

string

Match

匹配详细信息。

名称 类型 说明
Label

string

标签。

MatchId

integer

匹配 ID。

Score

number

图像匹配的置信度分数。

Source

string

源。

Tags

integer[]

匹配详细信息的标记。

MatchResponse

匹配请求的响应。

名称 类型 说明
CacheID

string

缓存 ID。

IsMatch

boolean

指示是否存在匹配项。

Matches

Match[]

匹配详细信息。

Status

Status

评估状态。

TrackingId

string

跟踪 ID。

Status

状态属性。

名称 类型 说明
Code

integer

状态代码。

Description

string

状态说明。

Exception

string

异常状态。