图像识别
POST /v1/videos/image-recognize:识别图片中的主体、人脸和服装,同步
POST/v1/videos/image-recognize
直接返回识别结果。
| 项 | 值 |
|---|---|
| 模式 | 同步 |
| 计费 | 每次成功识别计费一次 |
快速开始
curl https://api.vibelab.me/v1/videos/image-recognize \
-H "Authorization: Bearer $LOOPTOKEN_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"image": "https://example.com/photo.png"
}'响应示例:
{
"code": 0,
"message": "SUCCEED",
"request_id": "6a0d571e-d36c-4811-bb2b-698c94b19a8c",
"data": {
"task_result": {
"images": [
{
"type": "object_seg",
"is_contain": true,
"url": "https://example.com/object_seg.png"
},
{
"type": "head_seg",
"is_contain": true,
"url": "https://example.com/head_seg.png"
},
{
"type": "face_seg",
"is_contain": true,
"url": "https://example.com/face_seg.png"
},
{
"type": "cloth_seg",
"is_contain": true,
"url": "https://example.com/cloth_seg.png"
}
]
}
}
}请求参数
请求头
| 参数 | 类型 | 必填 | 默认 | 说明 |
|---|---|---|---|---|
Authorization | string | 是 | - | Bearer $LOOPTOKEN_API_KEY |
Content-Type | string | 是 | - | application/json |
请求体
| 参数 | 类型 | 必填 | 默认 | 说明 |
|---|---|---|---|---|
image | string | 是 | - | 图片 URL 或不带前缀的 Base64;jpg/jpeg/png,不超过 10MB,宽高不小于 300px,宽高比 1:2.5 到 2.5:1 |
响应
| 字段 | 类型 | 说明 |
|---|---|---|
code | integer | 0 表示成功,其余见错误 |
message | string | 错误信息 |
request_id | string | 请求 ID,排查问题时提供 |
data.task_result.images[].type | string | object_seg 主体、head_seg 含头发的人脸、face_seg 不含头发的人脸、cloth_seg 服装 |
data.task_result.images[].is_contain | boolean | 是否识别到 |
data.task_result.images[].url | string | 识别结果图片地址,30 天后清理,请及时转存 |
计费
每次成功识别计费一次;识别失败不收费。
错误
本页参数校验返回 400 / 1201,message 原文如下:
| HTTP | code | 触发场景 | 处理 |
|---|---|---|---|
| 400 | 1201 | request body must be a JSON object | 请求体传 JSON 对象 |
| 400 | 1201 | image is required and must be a string | 传 image |
通用错误(鉴权、余额、并发、回调地址、上游错误)见 Kling 错误。