图像内容审核(同步批量)(V3)- Batch Image Synchronization
功能介绍
图像审核批量同步接口
调试
您可以在API Explorer中调试该接口,支持自动认证鉴权。API Explorer可以自动生成SDK代码示例,并提供SDK代码示例调试功能。
URI
POST /v3/{project_id}/moderation/image/batch
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| project_id | 是 | String | 项目ID。获取方法请参见获取项目ID。 |
请求参数
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| X-Auth-Token | 是 | String | 用户Token。 用于获取操作API的权限。获取方法请参见获取Token接口,响应消息头中X-Subject-Token的值即为Token。 |
| 参数 | 是否必选 | 参数类型 | 描述 |
|---|---|---|---|
| urls | 是 | Array of urls objects | 图片url列表。最大支持12张图片。 |
| event_type | 否 | String | 事件类型。可选值如下:
|
| categories | 否 | Array of strings | 检测场景。可添加的检测场景如下: |
| image_text_config | 否 | image_text_config object | 图文审核黑白词库配置。 |
| language | 否 | String | 指定图片中文字语种类型。
|
响应参数
状态码: 200
| 参数 | 参数类型 | 描述 |
|---|---|---|
| request_id | String | 本次请求的唯一标识,用于问题排查,建议保存。 |
| results | Array of ImageDetectionResult objects | 调用结果。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| suggestion | String | 审核结果是否通过。
|
| category | String | 检测结果的一级标签。支持category列表如下:
|
| details | Array of ImageDetectionResultDetail objects | 检测详情。 |
| ocr_text | String | 图文审核检测出的文本,只有在category参数配置image_text且检测出文本时展示该字段。 |
| data_id | String | 图片唯一标识。同一次请求中不可重复,由大小写英文字母、数字、下划线(_)、中划线(-)组成,不超过30个字符。 |
| error_code | String | 调用失败时的错误码,具体请参见错误码。 调用成功时无此字段。 |
| error_msg | String | 调用失败时的错误信息。 调用成功时无此字段。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| suggestion | String | 审核结果是否通过。
|
| category | String | 检测结果的一级标签。支持category列表如下:
|
| confidence | Float | 置信度,可选值在0-1之间,值越大,可信度越高。 |
| face_location | FaceLocationDetail object | 人物位置信息,该数组有四个值,分别代表左上角的坐标和右下角的坐标。例如[207,522,340,567],207代表的是左上角的横坐标,522代表左上角的纵坐标,340代表的是右下角的横坐标,567代表的是右下角的纵坐标。 |
| qr_location | QRLocationDetail object | 图片中二维码指向的链接,当请求参数categories中包含image_text时存在。 |
| qr_content | String | 图片中二维码指向的链接,当请求参数categories中包含image_text时存在。 |
| segments | Array of OCRTextDetail objects | image_text场景下命中的文本片段。 |
| label | String | 识别的详细标签。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| top_left_x | Integer | 检测出人脸的左上角横坐标。 |
| top_left_y | Integer | 检测出人脸的左上角纵坐标。 |
| bottom_right_x | Integer | 检测出人脸的右下角横坐标。 |
| bottom_right_y | Integer | 检测出人脸的右下角纵坐标。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| top_left_x | Integer | 检测出的二维码左上角横坐标。 |
| top_left_y | Integer | 检测出的二维码左上角纵坐标。 |
| bottom_right_x | Integer | 检测出的二维码右下角横坐标。 |
| bottom_right_y | Integer | 检测出的二维码右下角纵坐标。 |
| 参数 | 参数类型 | 描述 |
|---|---|---|
| segment | String | 命中的风险片段。 |
| glossary_name | String | 命中的自定义词库名称。命中自定义词库时,才会返回当前字段。 |
状态码: 400
| 参数 | 参数类型 | 描述 |
|---|---|---|
| error_code | String | 错误码 最小长度:8 最大长度:36 |
| error_msg | String | 错误描述 最小长度:2 最大长度:512 |
请求示例
- 使用图片的url
POST https://{endpoint}/v3/{project_id}/moderation/image/batch { "event_type" : "comment", "categories" : [ "string" ], "image_text_config" : { "black_glossary_names" : [ "string" ], "white_glossary_names" : [ "string" ] }, "urls" : [ { "url" : "http://xxxxxx.com/qweqeqeqz.jpg", "data_id" : "1234" } ], "language" : "zh" } - 使用bizType
POST https://{endpoint}/v3/{project_id}/moderation/image/batch { "urls" : [ { "url" : "http://xxxxxx.com/qweqeqeqz.jpg", "data_id" : "1234" } ], "language" : "zh", "biz_type" : "test_type" }
响应示例
状态码: 400
Error response
{
"error_code" : "AIS.0402",
"error_msg" : "The image format is not supported."
} 状态码: 200
{
"request_id": "01394179de7c9ae45c7ea74e1af87ce5",
"results": [
{
"category": "porn",
"data_id": "1234",
"details": [
{
"category": "porn",
"confidence": 0.9761633,
"label": "adult_product",
"suggestion": "block"
},
{
"category": "porn",
"confidence": 0.98022753,
"label": "pornography",
"suggestion": "block"
}
],
"suggestion": "block"
}
]
}
状态码
| 状态码 | 描述 |
|---|---|
| 200 | 图像审核批量同步接口响应体。 |
| 400 | 失败响应示例。 |
错误码
请参见错误码。