| | |
| | | "github.com/knetic/govaluate" |
| | | "plugin" |
| | | "ruleprocess/cache" |
| | | "ruleprocess/logger" |
| | | logger "github.com/alecthomas/log4go" |
| | | "ruleprocess/structure" |
| | | "sort" |
| | | "strconv" |
| | |
| | | args.RuleResult["yolo"] = []structure.Result{} |
| | | args.RuleResult["face"] = []structure.Result{} |
| | | args.RuleResult["target"] = []structure.Result{} |
| | | args.RuleResult["plate"] = []structure.Result{} |
| | | //logger.Warn("传进去之前是什么德行:",args.RuleResult["yolo"]) |
| | | if taskGroup != nil && len(taskGroup.GroupRules) > 0 { |
| | | // 先过独立,再过联动 |
| | |
| | | // 车辆目标统计 |
| | | cars := []*structure.Arg{} |
| | | for _, sdkData := range args.Sdkdata { |
| | | if sdkData.IpcId == "91d923ef-6200-4549-ab1b-8e773e85d729" && sdkNames != "" { // 把车牌数据的各个目标的坐标输出方便后面画框 |
| | | logger.Info("看看sdkNames",sdkNames) |
| | | if sdkData.IpcId == "91d923ef-6200-4549-ab1b-8e773e85d729" { // 把车牌数据的各个目标的坐标输出方便后面画框 |
| | | for _, areaMap := range sdkData.AreaMapList { |
| | | if areaMap.IsEffective { |
| | | cars = append(cars, putFaceToResult(areaMap, cars)...) |
| | |
| | | } else { |
| | | islink = false |
| | | } |
| | | logger.Info("触发的区域id:",polygonId) |
| | | var labelTypes []int // 0为yolo标签,1为face标签 2为两者标签 |
| | | if sdkNames != "" && len(targets) == 0 { |
| | | args.RuleResult["yolo"] = append(args.RuleResult["yolo"].([]structure.Result), structure.Result{taskId, sdkNames, groupRule.GroupId, groupRule.DefenceState, groupRule.AlarmLevel, groupRule.GroupText, yolos, polygonId, islink,label}) |
| | |
| | | } |
| | | if faceFlag { |
| | | args.RuleResult["face"] = append(args.RuleResult["face"].([]structure.Result), structure.Result{taskId, sdkNames, groupRule.GroupId, groupRule.DefenceState, groupRule.AlarmLevel, groupRule.GroupText, faces, polygonId, islink,label}) |
| | | //logger.Info("-------------------face结果标签", len(args.RuleResult["face"].([]FaceResult))) |
| | | logger.Info("-------------------face结果标签", len(args.RuleResult["face"].([]structure.Result))) |
| | | labelTypes = append(labelTypes,1) |
| | | } |
| | | if len(targets) > 0 { |
| | |
| | | } |
| | | } |
| | | } |
| | | //logger.Println("-----------------------------------------------听说你是空的?",faces) |
| | | return faces |
| | | } |
| | | |
| | |
| | | if len(am.FilterData) > 0 { |
| | | locations = am.FilterData |
| | | } |
| | | //logger.Println("-----------------------------------------------听说你是空的?",faces) |
| | | return locations |
| | | } |
| | | func putTargetsToResult(am *structure.AreaMap) []*structure.Arg { |
| | |
| | | if len(am.AlarmObj) > 0 { |
| | | locations = am.AlarmObj |
| | | } |
| | | //logger.Println("-----------------------------------------------听说你是空的?",faces) |
| | | return locations |
| | | } |
| | | // 联动任务的处理 |
| | |
| | | timeEle := TimeElement{N: timeLength, InitN: timeLength, AlarmFlag: false, BufferFlag: 10, CacheSdkData: structure.ResultMsg{message, m}} // 扔进去一个定时器元素(并缓存当前画面帧数据) |
| | | //TimeEleList = make(map[string]timeElement) |
| | | TimeEleList[groupId+"+"+rule.Id] = &timeEle // 定时器元素以当前持续时间小规则id为键 |
| | | logger.Info("创建了计数器") |
| | | //logger.Info("创建了计数器") |
| | | //cacheId = groupId+"+"+rule.Id |
| | | } |
| | | rw.Unlock() |