Motionshop-video-detect模型是一款用于辅助Motionshop的视频检测模型,可检测视频中的人物形象是否符合Motionshop的视频合成要求。本文档介绍了该模型提供的视频检测能力的API调用方法。
模型概览
| 模型名 | 模型简介 | 说明 | 
| motionshop-video-detect | motionshop-video-detect是一个特定的视频检测模型,用于检测输入的视频是否满足motionshop模型所需的人物视频规范。 | 模型邀测中,请申请通过后调用。 | 
HTTP调用接口
功能描述
该模型用于检测输入的图片是否满足“Motionshop 视频合成API详情”所需的人物视频规范。
前提条件
- 已开通阿里云百炼服务并获得API-KEY:获取API Key。 
输入限制
- 视频格式:支持mp4、avi、mov 
- 视频分辨率:不大于1280x720像素 
- 视频帧数:不大于1800帧 
- 文件大小:不大于200MB 
- 上传图片仅支持HTTP链接方式,不支持本地链接方式 
作业提交接口调用
POST https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-detect入参描述
| 字段 | 类型 | 传参方式 | 必选 | 描述 | 示例值 | 
| Content-Type | String | Header | 是 | 请求类型:application/json。 | application/json | 
| Authorization | String | Header | 是 | API-Key,例如:Bearer d1**2a。 | Bearer d1**2a | 
| X-DashScope-Async | String | Header | 是 | 使用 enable,表明使用异步方式提交作业。 | enable | 
| model | String | Body | 是 | 指明需要调用的视频合成模型,此处用motionshop-video-detect。 | motionshop-video-detect | 
| input.video_url | String | Body | 是 | 用户上传的视频url。 
 说明  上传视频仅支持HTTP链接方式,不支持本地链接方式。 | http://a/a.mp4 | 
| parameters.threshold | Float | Body | 否 | 人物检测置信度。可设值为0-1,默认设为0.5。 这个值越高,检测准确率越高,但漏检概率也相对提高;这个值越低,检出率越高,但误检概率也相对提高。 | 0.5 | 
| parameters.min_area_ratio | Float | Body | 否 | 人物的画面最小占比。可设值为0-1,默认设为0.01。 当检出人物所占画面比例小于该值时,这个人物将被忽略。 | 0.01 | 
出参描述
| 字段 | 类型 | 描述 | 示例值 | 
| output.task_id | String | 提交异步任务的作业 id,实际作业结果需要通过异步任务查询接口获取。 | a8532587-fa8c-4ef8-82be-0c46b17950d1 | 
| output.task_status | String | 提交异步任务后的作业状态。 | “PENDING” | 
| request_id | String | 本次请求的系统唯一码。 | 7574ee8f-38a3-4b1e-9280-11c33ab46e51 | 
请求示例
curl --location --request POST 'https://dashscope.aliyuncs.com/api/v1/services/aigc/video-generation/video-detect' \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
--header 'X-Dashscope-Async: enable' \
--header 'Content-Type: application/json' \
--data '{
    "model": "motionshop-video-detect",
    "input": {
        "video_url": "http://xxx/1.mp4"
    },
    "parameters": {
        "threshold": 0.5,
        "min_area_ratio": 0.01
    }
}'响应示例
{
    "output": {
        "task_status": "PENDING",
        "task_id": "26c623d8-c6b7-418d-a936-9bfd27f5b2eb"
    },
    "request_id": "ca72fdf5-76db-9b5c-ba94-4b81b11b490d"
}作业任务状态查询和结果获取接口
GET https://dashscope.aliyuncs.com/api/v1/tasks/{task_id}入参描述
| 字段 | 类型 | 传参方式 | 必选 | 描述 | 示例值 | 
| Authorization | String | Header | 是 | API-Key,例如:Bearer d1**2a。 | Bearer d1**2a | 
| task_id | String | Url Path | 是 | 需要查询作业的task_id。 | a8532587-fa8c-4ef8-82be-0c46b17950d1 | 
出参描述
| 字段 | 类型 | 描述 | 示例值 | 
| output.detected | Bool | 是否检测到人。 | true | 
| output.frame_index | Int | 视频中检测到人的帧序号。一旦检测到符合条件的帧就会返回。 | 0 | 
| output.bbox | Array | 检测到人的boudingbox列表。当画面有多个人时,会按照boudingbox占画面的比例排序。boudingbox定义为[center_x, center_y, width, height]。 | [[0.1,0.1,0.3,0.2], [0.25,0.37,0.1,0.15]] | 
| usage.video_count | Int | 本次检测视频数量。 | 1 | 
| request_id | String | 本次请求的系统唯一码。 | 7574ee8f-38a3-4b1e-9280-11c33ab46e51 | 
请求示例
curl -X GET \
--header 'Authorization: Bearer <YOUR_API_KEY>' \
https://dashscope.aliyuncs.com/api/v1/tasks/<YOUR_TASK_ID>响应示例(通过)
{
    "output":{
        "task_id":"a8532587-fa8c-4ef8-82be-0c46b17950d1",
	"task_status":"SUCCEEDED",
        "detected": true,
        "frame_index": 0,
        "bbox": [[0.1,0.1,0.3,0.2], [0.25,0.37,0.1,0.15]]
    },
    "usage":{
      "video_count": 1,
    },
    "request_id":"7574ee8f-38a3-4b1e-9280-11c33ab46e51"
}响应示例(不通过)
{
    "output":{
        "task_id": "a8532587-fa8c-4ef8-82be-0c46b17950d1", 
    	"task_status": "SUCCEEDED",
        "detected": false,
    },
    "usage":{
      "video_count": 1,
    },
    "request_id":"7574ee8f-38a3-4b1e-9280-11c33ab46e51"
}异常响应示例
{
    "request_id": "7574ee8f-38a3-4b1e-9280-11c33ab46e51"
    "output": {
        "task_id": "a8532587-fa8c-4ef8-82be-0c46b17950d1", 
    	"task_status": "FAILED",
    	"code": "xxx", 
    	"message": "xxxxxx", 
    }  
}状态码说明
大模型服务平台通用状态码请查阅:错误信息。
同时本模型还有如下特定错误码:
| http 返回码* | 错误码(code) | 错误信息(message) | 含义说明 | 
| 400 | InvalidParameter | Missing input | 参数缺失 | 
| 400 | InvalidParameter | Invalid video url. | 视频链接异常 | 
| 400 | InvalidParameter | Input video frame count exceeds the limit xx | 视频帧数超出限制 | 
| 400 | InvalidParameter | Input video resolution exceeds the limit xx | 视频分辨率超出限制 | 
| 400 | InvalidParameter | Input video file size exceeds the limit xx | 视频文件大小超出限制 |