Cognitive Services API 系列-- 使用计算机视觉api完成图片分类

1. 打开api调试console
https://dev.projectoxford.ai/docs/services/56f91f2d778daf23d8ec6739/operations/56f91f2e778daf14a499e1fa/console


2. 输入api key
Cognitive Services API 系列-- 使用计算机视觉api完成图片分类_第1张图片

3. api url:
https://westus.api.cognitive.microsoft.com/vision/v1.0/analyze?visualFeatures=Categories&language=en


4. HTTP请求
POST https://westus.api.cognitive.microsoft.com/vision/v1.0/analyze?visualFeatures=Categories&language=en HTTP/1.1
Content-Type: application/json
Host: westus.api.cognitive.microsoft.com
Ocp-Apim-Subscription-Key: ••••••••••••••••••••••••••••••••


{"url":"https://petapixel.com/assets/uploads/2012/02/sample1_mini.jpg"}




测试图片:
Cognitive Services API 系列-- 使用计算机视觉api完成图片分类_第2张图片


5. HTTP 返回
Pragma: no-cache
apim-request-id: b8d77215-b7ed-4c78-b091-105821cd0839
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Cache-Control: no-cache
Date: Sat, 21 Jan 2017 08:09:42 GMT
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Content-Length: 201
Content-Type: application/json; charset=utf-8
Expires: -1


{
  "categories": [
    {
      "name": "sky_object",
      "score": 0.87109375
    },
    {
      "name": "outdoor_",
      "score": 0.00390625
    }
  ],
  "requestId": "b8d77215-b7ed-4c78-b091-105821cd0839",
  "metadata": {
    "width": 465,
    "height": 620,
    "format": "Jpeg"
  }
}




返回值为一个类别数组,表示所传递图片所属哪些类别。score是一个0到1的信心分数,越接近1越准确。对于这个例子而言,返回类别为outdoor和sky_object。

你可能感兴趣的:(Microsoft,Azure,Machine,Learning,c#,编程)