| | |
| | | SdkName string `json:"sdkName"` |
| | | Content string `json:"content"` |
| | | LikeDate string `json:"likeDate"` |
| | | Sex int32 `json:"sex"` |
| | | Sex string `json:"sex"` |
| | | Age int32 `json:"age"` |
| | | AgeDescription string `json:"ageDescription"` |
| | | Race int32 `json:"race"` |
| | | Race string `json:"race"` |
| | | SmileLevel int32 `json:"smileLevel"` |
| | | BeautyLevel int32 `json:"beautyLevel"` |
| | | FaceFeature string `json:"faceFeature"` |
| | |
| | | AnalyServerName string `json:"analyServerName"` |
| | | AnalyServerIp string `json:"analyServerIp"` |
| | | ClusterId string `json:"clusterId"` |
| | | IsAlarm string `json:"isAlarm"` |
| | | IsAckAlarm string `json:"isAckAlarm"` |
| | | IsCollect string `json:"isCollect"` |
| | | IsAlarm int `json:"isAlarm"` |
| | | IsAckAlarm int `json:"isAckAlarm"` |
| | | IsCollect int `json:"isCollect"` |
| | | IsDelete int `json:"isDelete"` |
| | | BaseInfo []Base `json:"baseInfo"` |
| | | } |
| | |
| | | PicSmUrl []string `json:"picSmUrl"` |
| | | PicDate string `json:"picDate"` |
| | | VideoUrl string `json:"videoUrl"` |
| | | IsAlarm string `json:"isAlarm"` |
| | | IsAckAlarm string `json:"isAckAlarm"` |
| | | IsCollect string `json:"isCollect"` |
| | | IsAlarm int `json:"isAlarm"` |
| | | IsAckAlarm int `json:"isAckAlarm"` |
| | | IsCollect int `json:"isCollect"` |
| | | IsDelete int `json:"isDelete"` |
| | | } |
| | | |
| | |
| | | } |
| | | i := protomsg.Image{} |
| | | err = proto.Unmarshal(bdata, &i) |
| | | log.Println("-------------------------------------------看下宽和高", i.Width, i.Height) |
| | | bytes := util.SubImg(i, int(face.Location.X), int(face.Location.Y), int(face.Location.X+face.Location.Width), int(face.Location.Y+face.Location.Height)) |
| | | resp, err := util.PostFormBufferData1(weedfsUrl, bytes, uuid.NewV4().String()) |
| | | if err != nil { |
| | | log.Println("上传小图出错") |
| | | } |
| | | sex := "" |
| | | if face.ThftRes.Gender == 1 { |
| | | sex = "男" |
| | | } else { |
| | | sex = "女" |
| | | } |
| | | race := getRaceString(face.ThftRes.Race) |
| | | ageDescription := getDescription(face.ThftRes.Age) |
| | | |
| | | pervideo := PerVideoPicture{ |
| | | uuid.NewV4().String(), |
| | | msg.Cid, |
| | |
| | | "人脸", |
| | | "", |
| | | time.Now().Format("2006-01-02 15:04:05"), // 只检测,没有比对时间 |
| | | face.ThftRes.Gender, |
| | | sex, |
| | | face.ThftRes.Age, |
| | | "", |
| | | face.ThftRes.Race, |
| | | ageDescription, |
| | | race, |
| | | face.ThftRes.Smile, |
| | | face.ThftRes.Beauty, |
| | | "不是每个人脸算法都有", |
| | |
| | | localConfig.ServerName, |
| | | serverIp, |
| | | "", |
| | | "", |
| | | "", |
| | | "", |
| | | 1, |
| | | 0, |
| | | 0, |
| | | 0, |
| | | []Base{}, |
| | | } |
| | |
| | | alarm := ChangeToString(yoloResult.AlarmLevel) |
| | | alarmRules = append(alarmRules, AlarmRule{yoloResult.RuleGroupId, alarm, yoloResult.RuleText}) |
| | | } |
| | | isAlarm := "" |
| | | isAlarm := 0 |
| | | resp := make(map[string]interface{}) |
| | | if len(alarmRules) > 0 { |
| | | isAlarm = "1" |
| | | isAlarm = 1 |
| | | // 解压缩并上传图片 |
| | | bdata, err := util.UnCompress(msg.Data) |
| | | if err != nil { |
| | |
| | | i := protomsg.Image{} |
| | | err = proto.Unmarshal(bdata, &i) |
| | | //resp, err = util.PostFormBufferData(weedfsUrl, i, uuid.NewV4().String()) |
| | | resp, err = util.DrawPolygonOnImage(msg.Cid, i) |
| | | resp, err = util.DrawPolygonOnImage(msg.Cid, i,msg.RuleResult["yolo"].([]ruleserver.Result)) |
| | | if err != nil { |
| | | log.Println("画框或上传图片服务器出错", err) |
| | | } else { |
| | | log.Println("已报警并上传改帧图片到服务器") |
| | | } |
| | | } else { |
| | | isAlarm = "0" |
| | | isAlarm = 0 |
| | | // 不是报警数据不存 |
| | | return |
| | | } |
| | |
| | | time.Now().Format("2006-01-02 15:04:05"), |
| | | "", |
| | | isAlarm, |
| | | "", |
| | | "", |
| | | 0, |
| | | 0, |
| | | 0, |
| | | } |
| | | requstbody, err := json.Marshal(peraction) |
| | |
| | | if err != nil { |
| | | log.Println("往ES插入数据失败", err) |
| | | } else { |
| | | log.Println("__________________________________________往ES插入数据yolo成功") |
| | | log.Println("__________________________________________往ES插入yolo数据成功") |
| | | } |
| | | } |
| | | } |
| | |
| | | } |
| | | return alarm |
| | | } |
| | | |
| | | //获取年龄描述 |
| | | func getDescription(age int32) string { |
| | | ageInfo := "青年" |
| | | if age > 0 && age < 7 { |
| | | ageInfo = "童年" |
| | | } else if age >= 7 && age < 18 { |
| | | ageInfo = "少年" |
| | | } else if age >= 18 && age < 40 { |
| | | ageInfo = "青年" |
| | | } else if age >= 40 && age < 65 { |
| | | ageInfo = "中年" |
| | | } else if age >= 65 { |
| | | ageInfo = "老年" |
| | | } |
| | | return ageInfo |
| | | } |
| | | |
| | | func getRaceString(i int32) string { |
| | | race := "" |
| | | if i == 1 { |
| | | race = "白人" |
| | | } else if i == 2 { |
| | | race = "黄人" |
| | | } else { |
| | | race = "黑人" |
| | | } |
| | | return race |
| | | } |