| | |
| | | } else { |
| | | // 最后成功报警才把符合条件的人脸数据塞进结果标签里 |
| | | faces := []Arg{} |
| | | for _, sdkData := range args.Sdkdata { |
| | | for _, areaMap := range sdkData.AreaMapList { |
| | | faceFlag := false |
| | | for j := 0; j < len(groupRule.Rules); j++ { |
| | | faces = append(faces, putFaceToResult(groupRule.Rules[j], &areaMap)...) |
| | | if groupRule.Rules[j].SdkId == "812b674b-2375-4589-919a-5c1c3278a97e" || groupRule.Rules[j].SdkId == "812b674b-2375-4589-919a-5c1c3278a972" { |
| | | faceFlag = true |
| | | } |
| | | } |
| | | for _, sdkData := range args.Sdkdata { |
| | | if sdkData.IpcId == "A8B73405-373D-4F23-CED2-A617EBD7EC55" && faceFlag { // sdkData里有人脸数据且配置了算法才把符合条件的数据塞进标签里去 |
| | | for _, areaMap := range sdkData.AreaMapList { |
| | | faces = append(faces, putFaceToResult(&areaMap)...) |
| | | } |
| | | } |
| | | } |
| | | // 配了人脸的算法才把人脸的数据甩出来打标签 |
| | | flag11 := false |
| | | for j := 0; j < len(groupRule.Rules); j++ { |
| | | if groupRule.Rules[j].SdkId == "812b674b-2375-4589-919a-5c1c3278a97e" || groupRule.Rules[j].SdkId == "812b674b-2375-4589-919a-5c1c3278a972" { |
| | | flag11 = true |
| | | } |
| | | } |
| | | if flag11 { |
| | | if faceFlag { |
| | | args.RuleResult["face"] = faces |
| | | } |
| | | // 去看池子里是否有与本帧数据有关的定时器,如果有,看此时是否走到0,没有此定时器或有定时器走到0的话返回成功报警 |
| | |
| | | // 把他们的位置数据也传下去 |
| | | locations := []Rect{} |
| | | for _, sdkData := range args.Sdkdata { |
| | | if sdkData.IpcId == "02D54B61-0F16-C604-8567-FC4BE493C523" && sdkNames != "" { // 把yolo数据的各个目标的坐标输出方便后面画框 |
| | | for _, areaMap := range sdkData.AreaMapList { |
| | | for j := 0; j < len(groupRule.Rules); j++ { |
| | | locations = append(locations, putYolosToResult(groupRule.Rules[j], &areaMap)...) |
| | | locations = append(locations, putYolosToResult(&areaMap)...) |
| | | } |
| | | } |
| | | } |
| | | //// 配了人脸的算法才把人脸的数据甩出来打标签 |
| | | //flag11 := false |
| | | //for j := 0; j < len(groupRule.Rules); j++ { |
| | | // if groupRule.Rules[j].SdkId == "812b674b-2375-4589-919a-5c1c3278a97e" || groupRule.Rules[j].SdkId == "812b674b-2375-4589-919a-5c1c3278a971" { |
| | | // flag11 = true |
| | | // } |
| | | //} |
| | | //if flag11 { |
| | | // args.RuleResult["face"] = faces |
| | | //} |
| | | if sdkNames != "" { |
| | | args.RuleResult["yolo"] = append(args.RuleResult["yolo"].([]Result), Result{taskId, sdkNames, groupRule.GroupId, groupRule.AlarmLevel, groupRule.GroupText, locations}) |
| | | logger.Info("-------------------yolo结果标签", args.RuleResult["yolo"].([]Result)) |
| | |
| | | } |
| | | } |
| | | |
| | | func putFaceToResult(rule *protomsg.Rule, am *AreaMap) []Arg { |
| | | func putFaceToResult(am *AreaMap) []Arg { |
| | | faces := []Arg{} |
| | | if rule.SdkId == "812b674b-2375-4589-919a-5c1c3278a97e" || rule.SdkId == "812b674b-2375-4589-919a-5c1c3278a972" { |
| | | if len(am.filterData) > 0 { |
| | | for _, data := range am.filterData { |
| | | faces = append(faces, data) |
| | | } |
| | | } |
| | | } |
| | | |
| | | //logger.Println("-----------------------------------------------听说你是空的?",faces) |
| | | return faces |
| | | } |
| | | |
| | | func putYolosToResult(rule *protomsg.Rule, am *AreaMap) []Rect { |
| | | func putYolosToResult(am *AreaMap) []Rect { |
| | | locations := []Rect{} |
| | | if rule.SdkId != "812b674b-2375-4589-919a-5c1c3278a97e" && rule.SdkId != "812b674b-2375-4589-919a-5c1c3278a972" { |
| | | if len(am.filterData) > 0 { |
| | | for _, data := range am.filterData { |
| | | locations = append(locations, data.Location) |
| | | } |
| | | } |
| | | } |
| | | //logger.Println("-----------------------------------------------听说你是空的?",faces) |
| | |
| | | } |
| | | // 先清空过滤后的数据,再往里塞本次过滤后的数据 |
| | | am.filterData = am.filterData[0:0] |
| | | logger.Info("-----------------------人脸过滤的args:", args) |
| | | for _, arg := range args { |
| | | var formula string |
| | | if rule.SdkArgAlias == "score" { |