cURL
鉴权
string
header
必填
千问 AI 平台 API Key。详见获取 API Key。
检测图像中是否包含符合要求的人脸
curl --location 'https://dashscope.aliyuncs.com/api/v1/services/vision/facedetection/detect' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "facechain-facedetect",
"input": {
"images": [
"https://example.com/image1.png",
"https://example.com/image2.jpg",
"https://example.com/image3.png"
]
},
"parameters": {}
}'{
"output": {
"is_face": [
true,
false,
true
],
"failed_reason": [
"",
"no face detected",
""
]
},
"usage": {},
"request_id": "549e0573-f630-9c17-8df2-08f605b4a646"
}千问 AI 平台 API Key。详见获取 API Key。
模型名称,固定为 facechain-facedetect。
输入图像参数。
显示子属性
待检测图像的公网可访问 URL 列表。
图像要求:
重要
图片 URL 中如果包含非 ASCII 字符(如中文文件名),需要先进行 URL 编码(percent-encoding),否则可能导致
InternalError.Algo错误。例如,在 Python 中使用urllib.parse.quote(),在 JavaScript 中使用encodeURI()对 URL 进行编码。
选图建议(用于人物写真生成):
[
"https://example.com/image1.png",
"https://example.com/image2.jpg"
]生成参数。当前无可用参数,传空对象 {} 即可。
显示子属性
请求唯一标识符,用于链路追踪和问题排查。
使用量统计。当前为空对象。
curl --location 'https://dashscope.aliyuncs.com/api/v1/services/vision/facedetection/detect' \
--header "Authorization: Bearer $DASHSCOPE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "facechain-facedetect",
"input": {
"images": [
"https://example.com/image1.png",
"https://example.com/image2.jpg",
"https://example.com/image3.png"
]
},
"parameters": {}
}'{
"output": {
"is_face": [
true,
false,
true
],
"failed_reason": [
"",
"no face detected",
""
]
},
"usage": {},
"request_id": "549e0573-f630-9c17-8df2-08f605b4a646"
}