AI事件通知
最近更新时间:2025-11-21 07:44:44
AI事件回调用于推送AI告警信息,包括人员布控、吸烟检测、口罩检测、安全帽反光服检测、人员聚集、烟雾明火、车牌识别、入侵检测、危险区域、垃圾检测、电动车检测、动物检测、人脸识别等告警信息。您需在回调模板中配置AI事件回调接收服务器URL,并将该模板与业务组或设备进行关联。摄像头成功注册上线且正确配置了AI模板后,天翼云视频监控服务会将设备AI告警信息回调到您设置的接收服务器中。
1. 回调消息参数
| 参数 | 类型 | 描述 |
|---|---|---|
| EventType | Long | AI事件类型。 取值:5。 |
| Expires | Long | 回调消息的失效时间点,1970 年 1 月 1 日以来的秒数。 说明:来自天翼云的消息通知默认过期时间是10分钟,如果一条消息通知中的Expires值所指定的时间已经过期,则可以判定这条通知无效,进而可以防止网络重放攻击。 |
| Signature | String | 回调消息的安全签名,Signature=MD5(CallbackKey+Expires) 说明:天翼云把CallbackKey和Expires进行字符串拼接后通过MD5计算得出Signature值,并将其放在回调消息里,您的后台服务器在收到通知消息后可以根据同样的算法确认Signature是否正确,进而确认消息是否确实来自天翼云后台。 |
| DeviceId | String | 设备ID。 |
| GbId | String | 设备国标ID。 |
| DeviceName | String | 设备名称。 |
| AIType | Long | AI算法类型。 取值: 5:吸烟检测 6:口罩检测 7:安全帽反光服检测 8:行人检测 9:危险区域检测 10:烟雾明火检测 12:人体属性检测 13:蜜蜂数量检测 14:铁塔基站设备检测 15:铁塔基站天线检测 16:医疗防护服检测 17:车牌识别 18:棉花检测 19:入侵检测 21:垃圾检测 23:电动车检测 24:车辆违停检测 25:车辆拥堵检测 26:人群感应检测 27:实时在岗检测 29:垃圾站检测 30:视野遮挡 31:跌倒检测 33:动物检测 34:人脸识别 35:工作服检测 36:河道垃圾检测 37:城市治理 38:水泥表面缺陷检测 |
| Data | JSON | AI告警信息,不同的AIType,Data内容不同,参考下面的表格详情 |
| ImageUrl | String | AI告警图片Url,可以http下载。 |
| EventTime | Long | 事件消息产生的时间戳,单位秒。 |
1.1 人员布控
| 参数 | 类型 | 描述 |
|---|---|---|
| MatchList | FaceItemData[] | 匹配的结果列表,如果输入图像中多个人脸,则这里会返回多个数据。 |
| FaceCount | Long | 检测出来的人脸个数。 |
| FaceRectangles | Long[] | 返回人脸矩形框,分别是[left, top,width, height]。如有多个人脸,则依次顺延,返回矩形框。例如有两个人脸则返回[left1, top1, width1,height1, left2, top2, width2,height2]。 |
FaceItemData
| 参数 | 类型 | 描述 |
|---|---|---|
| FaceItems | FaceInfo[] | 匹配的人脸数据列表 |
| Location | Locate | 输入图像中的人脸坐标信息 |
FaceInfo
| 参数 | 类型 | 描述 |
|---|---|---|
| DbName | String | 匹配到的人脸库名称 |
| FaceId | String | |
| EntityId | String | 实体 ID,用来标识用户的唯一性。 |
| Score | Float | 人脸的相似度,取值范围 0-100,数值越大相似度越高。 |
| ExtraData | String | |
| Labels | String | 人员标签,包括人员姓名、身份信息(可选) |
Locate
| 参数 | 类型 | 描述 |
|---|---|---|
| Height | Long | 高度,单位像素。 |
| Width | Long | 宽度,单位像素。 |
| X | Long | 左上角 x 坐标。 |
| Y | Long | 左上角 y坐标。 |
1.2 吸烟检测
| 参数 | 类型 | 描述 |
|---|---|---|
| DetectBoxes | Long[] | 返回检测矩形框,矩形框坐标是box=[left, top,width, height]。如有多个矩形框则返回[box0, box1]。 |
| DetectScores | float[] | 返回框的分数, 范围是0-1。 |
| DetectClses | Long[] | 返回目标检测id。0 是没吸烟。1 是有吸烟 |
1.3 口罩检测
| 参数 | 类型 | 描述 |
|---|---|---|
| FaceCount | Long | 检测出来的人脸框个数。 |
| FaceRectangles | Long[] | 返回人脸矩形框,分别是[left, top, width, height]。如有多个人脸,则依次顺延,返回矩形框。例如有两个人脸则返回[left1,top1, width1,height1, left2, top2, width2,height2]。 |
| ClassList | Long[] | 返回检测框的分类id,取值范围0,1,2。0:有人脸没有佩戴口罩,1:有人脸有佩戴口罩,2:有人脸但佩戴口罩不规范。如有多个框,则依次返回。例如有两个人脸则返回[cls_id1,cls_id2]。 |
| ProbabilityList | Float[] | 返回检测框属于该分类的分数值得,取值范围0~1。如有多个人脸,则依次返回。例如有两个人脸则返回[prob1,prob2]。 |
1.4 安全帽反光服检测
| 参数 | 类型 | 描述 |
|---|---|---|
| DetectBoxes | Long[] | 返回行人检测矩形框,矩形框坐标是 box =[left,top,width, height]。如有多个矩形框则返回[box0,box1]。 |
| DetectScores | float[] | 返回目标框的置信度分数,范围是0-1。建议阈值为0.5。 |
| DetectClses | Long[] | 返回目标框的类别id。id 索引值0:穿反光服;1:未穿反光服;2:未戴安全帽,3:戴安全帽。 |
1.5 人员聚集
| 参数 | 类型 | 描述 |
|---|---|---|
| DetectBoxes | Long[] | 返回目标矩形框,矩形框坐标是box =[left, top, width, height]。如有多 个矩形框则返回[box0, box1]。 |
| DetectScores | float[] | 回目标框的置信度分数, 范围是 0-1。行人的建议阈值为 0.5。 |
| DetectClses | Long[] | 返回目标框的类别 id。 行人的 id 为 0。 |
1.6 危险区域
| 参数 | 类型 | 描述 |
|---|---|---|
| DetectBoxes | Long[] | 返回行人检测矩形框,矩形框坐标是 box =[left,top,width, height]。如有多个矩形框则返回[box0,box1]。 |
| DetectScores | float[] | 回目标框的置信度分数, 范围是 0-1。行人的建议阈值为 0.5。 |
| DetectClses | Long[] | 返回目标框的类别 id。 行人的 id 为 0。 |
1.7 烟雾明火
| 参数 | 类型 | 描述 |
|---|---|---|
| DetectBoxes | Long[] | 返回检测矩形框,矩形框坐标是 box =[left,top,width, height]。如有多个矩形框则返回[box0,box1]。 |
| DetectScores | Float[] | 回目标框的置信度分数, 范围是 0-1。 |
| DetectClses | Long[] | 返回目标框的类别 id。 0是正常,1是有烟雾明火。 |
1.8 车牌识别
| 参数 | 类型 | 描述 |
|---|---|---|
| Texts | String[] | 检测出来的车牌号码。 |
| Boxes | Long[][4][2] | 检测出来的车牌坐标。三维数组。矩形框坐标是顺时针左上,右上,右下,左下。 |
1.9 入侵检测
| 参数 | 类型 | 描述 |
|---|---|---|
| MatchList | FaceItemData[] | 匹配的结果列表,如果输入图像中多个人脸,则这里会返回多个数据。 |
| FaceCount | Long | 检测出来的人脸个数。 |
| FaceRectangles | Long[] | 返回人脸矩形框,分别是[left, top,width, height]。如有多个人脸,则依次顺延,返回矩形框。例如有两个人脸则返回[left1, top1, width1,height1, left2, top2, width2,height2]。 |
FaceItemData
| 参数 | 类型 | 描述 |
|---|---|---|
| FaceItems | FaceInfo[] | 匹配的人脸数据列表 |
| Location | Locate | 输入图像中的人脸坐标信息 |
FaceInfo
| 参数 | 类型 | 描述 |
|---|---|---|
| DbName | String | 匹配到的人脸库名称 |
| FaceId | String | |
| EntityId | String | 实体 ID,用来标识用户的唯一性。 |
| Score | Float | 人脸的相似度,取值范围 0-100,数值越大相似度越高。 |
| ExtraData | String | |
| Labels | String | 人员标签,包括人员姓名、身份信息(可选) |
Locate
| 参数 | 类型 | 描述 |
|---|---|---|
| Height | Long | 高度,单位像素。 |
| Width | Long | 宽度,单位像素。 |
| X | Long | 左上角 x 坐标。 |
| Y | Long | 左上角 y坐标。 |
1.10 垃圾检测
| 参数 | 类型 | 描述 |
|---|---|---|
| IsAlarm | Bool | 是否需要告警。 |
1.11 电动车检测
| 参数 | 类型 | 描述 |
|---|---|---|
| DetectBoxes | Long[] | 返回检测矩形框,矩形框坐标是box =[left, top,width, height]。如有多个矩形框则返回[box0,box1]。 |
| DetectScores | Float[] | 返回目标框的置信度分数,范围是0-1。 |
| DetectClses | Long[] | 返回目标框的类别id。行人为0,电动车为1。 |
1.12 动物检测
| 参数 | 类型 | 描述 |
|---|---|---|
| Boxes | TBox[] | 返回检测矩形框坐标,相似度和动物种类。 |
TBox
| 参数 | 类型 | 描述 |
|---|---|---|
| TopLeftX | Long | 左上角 x 坐标。 |
| TopLeftY | Long | 左上角 y坐标。 |
| BottomRightX | Long | 右下角 x 坐标。 |
| BottomRightY | Long | 右下角 y 坐标。 |
| Score | Float | 相似度,取值范围 0-100,数值越大相似度越高。 |
| Label | String | 动物种类。 |
1.13 人脸识别
| 参数 | 类型 | 描述 |
|---|---|---|
| Id | Long | 人员ID |
| Name | String | 姓名 |
| Number | String | 人员编号 |
| MatchPicUrl | String | 人脸库中匹配到的人脸图片URL |
| MatchFaceCropUrl | String | 人脸库中人脸图片的抠图URL |
| MatchPicRectangles | Long[] | 人脸库中人脸的坐标box,矩形框坐标是box =[left, top,width, height] |
| FaceRectangles | Long[] | 截图中人脸的坐标 ,矩形框坐标是box =[left, top,width, height] |
| Score | Float | 截图人脸与人脸库中人脸的匹配度 |
2. 回调消息错误码
| ErrorCode | ErrorMessage |
|---|---|
3. 回调消息示例
3.1 人员布控回调消息
{
"EventType":5,
"Expires":1545030873,
"Signature":"ca3e25e5dc17a6f9909a9ae7281e300d",
"DeviceId":"29942114322219022",
"GbId":"34082400011188226858",
"DeviceName":"***",
"AIType":4,
"EventTime":1545047000,
"ImageUrl":"https://",
"Data":{
"FaceCount":1,
"FaceRectangles":[
529,
219,
43,
53
],
"MatchList":[
{
"Location":{
"X":529,
"Y":219,
"Width":43,
"Height":53
},
"FaceItems":[
{
"EntityId":"289575371019796480",
"Score":81.70854814532174,
"DbName":"289502451065044992",
"Labels":"{\"name\":\"晓明\",\"cardId\":null,\"description\":null}"
},
{
"EntityId":"289601072104095744",
"Score":28.600664596359827,
"DbName":"289502451065044992",
"Labels":"{\"name\":\"季\",\"cardId\":null,\"description\":null}"
}
]
}
]
}
}
3.2 吸烟检测回调消息
{
"EventType":5,
"Expires":1545030873,
"Signature":"ca3e25e5dc17a6f9909a9ae7281e300d",
"DeviceId":"29942114322219022",
"GbId":"34082400011188226858",
"DeviceName":"***",
"AIType":5,
"EventTime":1545047000,
"ImageUrl":"https://",
"Data":{
"DetectBoxes":[
987,
312,
216,
759,
832,
278,
185,
620
],
"DetectScores":[
0.9033203125,
0.62158203125
],
"DetectClses":[
1,
1
]
}
}
3.3 口罩检测回调消息
{
"EventType": 5,
"Expires": 1545030873,
"Signature": "ca3e25e5dc17a6f9909a9ae7281e300d",
"DeviceId": "29942114322219022",
"GbId": "34082400011188226858",
"DeviceName": "***",
"AIType": 6,
"EventTime": 1545047000,
"ImageUrl": "https://",
"Data": {
"FaceCount": 1,
"FaceRectangles": [
153,
4,
310,
426
],
"ClassList": [
1
],
"ProbabilityList": [
1
]
}
}
3.4 安全帽反光服检测回调消息
{
"EventType":5,
"Expires":1545030873,
"Signature":"ca3e25e5dc17a6f9909a9ae7281e300d",
"DeviceId":"29942114322219022",
"GbId":"34082400011188226858",
"DeviceName":"***",
"AIType":7,
"EventTime":1545047000,
"ImageUrl":"https://",
"Data":{
"DetectBoxes":[
987,
312,
216,
759,
832,
278,
185,
620
],
"DetectScores":[
0.9033203125,
0.62158203125
],
"DetectClses":[
0,
3
]
}
}
3.5 人员聚集回调消息
{
"EventType":5,
"Expires":1545030873,
"Signature":"ca3e25e5dc17a6f9909a9ae7281e300d",
"DeviceId":"29942114322219022",
"GbId":"34082400011188226858",
"DeviceName":"***",
"AIType":8,
"EventTime":1545047000,
"ImageUrl":"https://",
"Data":{
"DetectBoxes":[
987,
312,
216,
759,
832,
278,
185,
620
],
"DetectScores":[
0.9033203125,
0.62158203125
],
"DetectClses":[
0,
0
]
}
}
3.6 电子围栏回调消息
{
"EventType":5,
"Expires":1545030873,
"Signature":"ca3e25e5dc17a6f9909a9ae7281e300d",
"DeviceId":"29942114322219022",
"GbId":"34082400011188226858",
"DeviceName":"***",
"AIType":9,
"EventTime":1545047000,
"ImageUrl":"https://",
"Data":{
"DetectBoxes":[
987,
312,
216,
759,
832,
278,
185,
620
],
"DetectScores":[
0.9033203125,
0.62158203125
],
"DetectClses":[
0,
0
]
}
}
3.7 烟雾明火回调消息
{
"EventType":5,
"Expires":1545030873,
"Signature":"ca3e25e5dc17a6f9909a9ae7281e300d",
"DeviceId":"29942114322219022",
"GbId":"34082400011188226858",
"DeviceName":"***",
"AIType":10,
"EventTime":1545047000,
"ImageUrl":"https://",
"Data":{
"DetectBoxes":[
987,
312,
216,
759,
832,
278,
185,
620
],
"DetectScores":[
0.9033203125,
0.62158203125
],
"DetectClses":[
0,
0
]
}
}
3.8 车牌识别回调消息
{
"EventType":5,
"Expires":1545030873,
"Signature":"ca3e25e5dc17a6f9909a9ae7281e300d",
"DeviceId":"29942114322219022",
"GbId":"34082400011188226858",
"DeviceName":"***",
"AIType":17,
"EventTime":1545047000,
"ImageUrl":"https://",
"Data":{
"Boxes":[
[
[
782,
1393
],
[
921,
1376
],
[
926,
1419
],
[
787,
1438
]
],
[
[
1706,
913
],
[
1807,
906
],
[
1810,
940
],
[
1709,
947
]
]
],
"Texts":[
"青E73731",
"青BB3045"
]
}
}
3.9入侵检测回调消息
{
"EventType":5,
"Expires":1545030873,
"Signature":"ca3e25e5dc17a6f9909a9ae7281e300d",
"DeviceId":"29942114322219022",
"GbId":"34082400011188226858",
"DeviceName":"***",
"AIType":19,
"EventTime":1545047000,
"ImageUrl":"https://",
"Data":{
"FaceCount":1,
"FaceRectangles":[
529,
219,
43,
53
],
"MatchList":[
{
"Location":{
"X":529,
"Y":219,
"Width":43,
"Height":53
},
"FaceItems":[
{
"EntityId":"289575371019796480",
"Score":81.70854814532174,
"DbName":"289502451065044992",
"Labels":"{\"name\":\"晓明\",\"cardId\":null,\"description\":null}"
},
{
"EntityId":"289601072104095744",
"Score":28.600664596359827,
"DbName":"289502451065044992",
"Labels":"{\"name\":\"季\",\"cardId\":null,\"description\":null}"
}
]
}
]
}
}
3.10 垃圾检测回调消息
{
"EventType": 5,
"Expires": 1545030873,
"Signature": "ca3e25e5dc17a6f9909a9ae7281e300d",
"DeviceId": "29942114322219022",
"GbId": "34082400011188226858",
"DeviceName": "***",
"AIType": 21,
"EventTime": 1545047000,
"ImageUrl": "https://",
"Data": {
"IsAlarm": true
}
}
3.11 电动车检测回调消息
{
"EventType":5,
"Expires":1545030873,
"Signature":"ca3e25e5dc17a6f9909a9ae7281e300d",
"DeviceId":"29942114322219022",
"GbId":"34082400011188226858",
"DeviceName":"***",
"AIType":23,
"EventTime":1545047000,
"ImageUrl":"https://",
"Data":{
"DetectBoxes":[
987,
312,
216,
759,
832,
278,
185,
620
],
"DetectScores":[
0.9033203125,
0.62158203125
],
"DetectClses":[
1,
1
]
}
}
3.12 动物检测回调消息
{
"EventType":5,
"Expires":1545030873,
"Signature":"ca3e25e5dc17a6f9909a9ae7281e300d",
"DeviceId":"29942114322219022",
"GbId":"34082400011188226858",
"DeviceName":"***",
"AIType":33,
"EventTime":1545047000,
"ImageUrl":"https://",
"Data":{
"Boxes ":[
{
"TopLeftX":100,
"TopLeftY":100,
"BottomRightX":200,
"BottomRightY":200,
"Score":81.7,
"Label":"bear"
}
]
}
}
3.13 人脸识别回调消息
{
"EventType": 5,
"Expires": 1545030873,
"Signature": "ca3e25e5dc17a6f9909a9ae7281e300d",
"DeviceId": "29942114322219022",
"GbId": "34082400011188226858",
"DeviceName": "***",
"AIType": 34,
"EventTime": 1545047000,
"ImageUrl": "https://",
"Data": "[{\"Id\": 40223,\"Name\": \"吴\",\"Number\": \"1234\",\"MatchPicUrl\": \"https://\",\"MatchFaceCropUr\":\"https://\",\"MatchPicRectangles\": \"[766,687,1664,2327]\",\"Score\": 0.6068044,\"FaceRectangles\": \"[1188,661,119,134]\"}]"
}
本页目录: