csair_visual_project/API_Docs/安检行为检测接口文档 .md

139 lines
4.4 KiB
Markdown
Raw Normal View History

2025-03-06 11:15:51 +08:00
# 安检行为检测接口文档
## 一、接口概述
本接口旨在对视频源进行安检行为检测,可精准定位检测时间与空间范围,明确需检测的行为种类及相关量化阈值,同时支持模型参数调整,以适配不同应用场景的安检需求。
## 二、接口信息
### 1. 接口地址
`http://{ip:port}/security_inspection_behavior_detection`
### 2. 请求方法
`POST`
### 3. 请求头
```
Content-Type: application/json
```
## 三、请求参数
| 参数名 | 类型 | 是否必填 | 描述 |
| ----------- | ------ | -------- | ------------------------------------------------------------ |
| input\_type | String | 是 | 输入类型,取值为`mp4、`rtsp |
| input\_data | String | 是 | 若`input_type`为`mp4`,则为视频文件的本地路径或 URL若为`rtsp`,则为 RTSP 流地址 |
| camera\_id | String | 是 | 摄像头的唯一标识符,用于关联特定的监控设备 |
| start\_time | String | 是 | 检测起始时间,格式为`YYYY-MM-DD HH:MM:SS` |
| info | Object | 否 | 预留字段,用于传递额外信息,如模型参数等,以字典形式存储 |
### 请求参数示例
```markdown
{
"input_type": "rtsp",
"input_data": "rtsp://security_camera_01.com/stream",
"camera_id": "SEC_CAM_001",
"start_time": "2024-10-01 08:00:00",
"info": {
"detection_threshold": 0.8
}
}
```
## 四、响应参数
| 参数名 | 类型 | 描述 |
| ------------------------ | ------- | ------------------------------------------------------------ |
| status | Integer | 响应状态码200 表示成功,其他表示失败 |
| message | String | 状态描述信息,如 "Success" 或 "Input parameter error" |
| total\_inspected\_people | Integer | 安检总人数 |
| inspection\_details | Array | 每个人的安检详细信息列表,每个元素包含以下内容: - `person_id`: 人员唯一标识 -`front_*_inspected`和`back_*_inspected`身体正反面的各部位 是否经过安检经过安检为true未安检为false |
### 响应参数示例
```markdown
{
"status": 200,
"message": "检测成功",
"data":{}
}
```
## 五、错误处理
| 状态码 | 描述 |
| --- | -------------------------------------------------- |
| 400 | 输入参数错误,如参数缺失、格式不正确、`behavior_types`中行为类型不存在于预定义列表等 |
| 404 | 未找到指定的视频文件、无法连接到 RTSP 流或摄像头设备 |
| 500 | 服务器内部错误,如模型加载失败、计算资源不足、检测过程中出现异常 |
### 错误响应示例
```markdown
{
"status": 400,
"message": "输入参数错误start_time格式不正确应为YYYY-MM-DD HH:MM:SS",
}
```
## 六、结果写入(待定)
```markdown
{
"status": 200,
"message": "检测成功",
"data":{
"total_inspected_people": 10,
"inspection_details": [
{
"person_id": 1,
"front_head_inspected": true,
"front_upper_body_inspected": true,
"front_arms_inspected": true,
"front_legs_inspected": true,
"front_shoes_inspected": true,
"back_head_inspected": true,
"back_upper_body_inspected": true,
"back_arms_inspected": true,
"back_legs_inspected": true,
"back_shoes_inspected": true
},
{
"person_id": 2,
"front_head_inspected": true,
"front_upper_body_inspected": true,
"front_arms_inspected": false,
"front_legs_inspected": false,
"front_shoes_inspected": true,
"back_head_inspected": true,
"back_upper_body_inspected": true,
"back_arms_inspected": false,
"back_legs_inspected": false,
"back_shoes_inspected": true
},
// 其他人员的安检信息
]
}
}
```