检测特定于域的内容Detect domain-specific content

除标记和高级分类外,计算机视觉还支持使用已经过专门数据训练的模型执行进一步特定于域的分析。In addition to tagging and high-level categorization, Computer Vision also supports further domain-specific analysis using models that have been trained on specialized data.

可通过两种方法使用特定于域的模型:使用模型本身(作用域分析)或用作分类功能的增强。There are two ways to use the domain-specific models: by themselves (scoped analysis) or as an enhancement to the categorization feature.

作用域分析Scoped analysis

可通过调用 Models/<model>/Analyze API,仅使用选择的特定于域的模型来分析图像。You can analyze an image using only the chosen domain-specific model by calling the Models/<model>/Analyze API.

以下是 models/celebrities/analyze API 为给定图像返回的示例 JSON 响应:The following is a sample JSON response returned by the models/celebrities/analyze API for the given image:

Satya Nadella 的站立微笑图

{
  "result": {
    "celebrities": [{
      "faceRectangle": {
        "top": 391,
        "left": 318,
        "width": 184,
        "height": 184
      },
      "name": "Satya Nadella",
      "confidence": 0.99999856948852539
    }]
  },
  "requestId": "8217262a-1a90-4498-a242-68376a4b956b",
  "metadata": {
    "width": 800,
    "height": 1200,
    "format": "Jpeg"
  }
}

增强版分类分析Enhanced categorization analysis

特定于域的模型还可用于对常规图像分析进行补充。You can also use domain-specific models to supplement general image analysis. 可通过在 Analyze API 调用的 details 参数中指定特定于域的模型,作为高级分类的一部分执行此操作。You do this as part of high-level categorization by specifying domain-specific models in the details parameter of the Analyze API call.

在这种情况下,首先会调用 86 类别分类分类器。In this case, the 86-category taxonomy classifier is called first. 如果检测到的任何类别具有匹配的特定于域的模型,图像也会通过该模型并会添加结果。If any of the detected categories have a matching domain-specific model, the image is passed through that model as well and the results are added.

以下 JSON 响应展示可如何在更广泛的分类分析中以 detail 节点的形式包含特定于域的分析。The following JSON response shows how domain-specific analysis can be included as the detail node in a broader categorization analysis.

"categories":[
  {
    "name":"abstract_",
    "score":0.00390625
  },
  {
    "name":"people_",
    "score":0.83984375,
    "detail":{
      "celebrities":[
        {
          "name":"Satya Nadella",
          "faceRectangle":{
            "left":597,
            "top":162,
            "width":248,
            "height":248
          },
          "confidence":0.999028444
        }
      ],
      "landmarks":[
        {
          "name":"Forbidden City",
          "confidence":0.9978346
        }
      ]
    }
  }
]

列出特定于域的模型List the domain-specific models

目前,计算机视觉支持以下特定于域的模型:Currently, Computer Vision supports the following domain-specific models:

NameName 说明Description
名人celebrities 名人识别,支持属于 people_ 类别的图像Celebrity recognition, supported for images classified in the people_ category
地标landmarks 地标识别,支持属于 outdoor_building_ 类别的图像Landmark recognition, supported for images classified in the outdoor_ or building_ categories

调用 Models API 将返回此信息,以及每个模型可应用于的类别:Calling the Models API will return this information along with the categories to which each model can apply:

{
  "models":[
    {
      "name":"celebrities",
      "categories":[
        "people_",
        "人_",
        "pessoas_",
        "gente_"
      ]
    },
    {
      "name":"landmarks",
      "categories":[
        "outdoor_",
        "户外_",
        "屋外_",
        "aoarlivre_",
        "alairelibre_",
        "building_",
        "建筑_",
        "建物_",
        "edifício_"
      ]
    }
  ]
}

后续步骤Next steps

了解有关对图像进行分类的概念。Learn concepts about categorizing images.