Azure Face API、python SDK 属性 url

Azure Face API, python SDK attribute url

我正在使用 Azure docs.

提供的 Python SDK 片段
BASE_URL ="https://eastus.api.cognitive.microsoft.com/face/v1.0/
CF.BaseUrl.set(BASE_URL)

我想return面属性,文档referenced here建议添加

/detect[&returnFaceAttributes=age,gender]

到基地 URl 将 return 年龄和性别属性。它给我一个错误,我错过了什么吗?

这是我第一次使用 Azure Face API。

我们可以使用以下代码来获取 returnFaceAttributes

faces = CF.face.detect(img_url,attributes='age,gender')

整个演示代码

import cognitive_face as CF
KEY = 'xxxxx'  # Replace with a valid subscription key (keeping the quotes in place).
CF.Key.set(KEY)
BASE_URL = 'https://{location}.api.cognitive.microsoft.com/face/v1.0'  # Replace with your regional Base URL
CF.BaseUrl.set(BASE_URL)
#You can use this example JPG or replace the URL below with your own URL to a JPEG image.
img_url = 'https://raw.githubusercontent.com/Microsoft/Cognitive-Face-Windows/master/Data/detection1.jpg'
faces = CF.face.detect(img_url,attributes='age,gender')

测试结果: