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

图像标记

图像分析可以为出现在图像中的上千个可识别对象、生物、风景和操作返回内容标记。 标记不按分类来组织,且没有继承层次结构。 内容标记的集合构成图像“说明”的基础,图像“说明”显示为完整句子格式的人类可读语言。 当标记内容不明确或者不属常识时,API 响应会提供提示来澄清标记在已知场景中的含义。

上传图像或指定图像 URL 后,分析图像 API 可以在对象、生物和图像中标识的操作的基础上输出标记。 标记不局限于主要主题(例如前景中的人物),它还可以包括背景(室内或室外)、家具、工具、植物、动物、配饰,小配件等元素。

使用 Vision Studio 快速轻松地在浏览器中试用图像标记功能。

图像标记示例

以下 JSON 响应表明 Azure AI 视觉在示例图像中检测到标记可视功能时所返回的内容。

A blue house and the front yard

{
   "tags":[
      {
         "name":"grass",
         "confidence":0.9960499405860901
      },
      {
         "name":"outdoor",
         "confidence":0.9956876635551453
      },
      {
         "name":"building",
         "confidence":0.9893627166748047
      },
      {
         "name":"property",
         "confidence":0.9853052496910095
      },
      {
         "name":"plant",
         "confidence":0.9791355133056641
      },
      {
         "name":"sky",
         "confidence":0.9764555096626282
      },
      {
         "name":"home",
         "confidence":0.9732913970947266
      },
      {
         "name":"house",
         "confidence":0.9726772904396057
      },
      {
         "name":"real estate",
         "confidence":0.972320556640625
      },
      {
         "name":"yard",
         "confidence":0.9480282068252563
      },
      {
         "name":"siding",
         "confidence":0.945357620716095
      },
      {
         "name":"porch",
         "confidence":0.9410697221755981
      },
      {
         "name":"cottage",
         "confidence":0.9143695831298828
      },
      {
         "name":"tree",
         "confidence":0.9111741185188293
      },
      {
         "name":"farmhouse",
         "confidence":0.8988939523696899
      },
      {
         "name":"window",
         "confidence":0.894851565361023
      },
      {
         "name":"lawn",
         "confidence":0.8940501809120178
      },
      {
         "name":"backyard",
         "confidence":0.8931854963302612
      },
      {
         "name":"garden buildings",
         "confidence":0.885913610458374
      },
      {
         "name":"roof",
         "confidence":0.8695329427719116
      },
      {
         "name":"driveway",
         "confidence":0.8670971393585205
      },
      {
         "name":"land lot",
         "confidence":0.8564285039901733
      },
      {
         "name":"landscaping",
         "confidence":0.8540750741958618
      }
   ],
   "requestId":"d60ac02b-966d-4f62-bc24-fbb1fec8bd5d",
   "metadata":{
      "height":200,
      "width":300,
      "format":"Png"
   },
   "modelVersion":"2021-05-01"
}

使用 API

标记功能属于分析图像 API。 可以通过本机 SDK 或 REST 调用来调用此 API。 将 Tags 包括在 visualFeatures 查询参数中。 然后,在获取完整 JSON 响应时,请分析 "tags" 部分内容的字符串。

后续步骤

了解对图像进行分类描述图像的相关概念。