From 5a6639ba0450e5f58955f5d7d906b9e454a4295e Mon Sep 17 00:00:00 2001 From: panlei <2799247126@qq.com> Date: 星期一, 04 十一月 2019 17:08:11 +0800 Subject: [PATCH] 关闭推送看cpu占用 --- insertdata/insertDataToEs.go | 52 +++++++++++++++++++++++++++++++++------------------- 1 files changed, 33 insertions(+), 19 deletions(-) diff --git a/insertdata/insertDataToEs.go b/insertdata/insertDataToEs.go index 0b56736..b5f88c7 100644 --- a/insertdata/insertDataToEs.go +++ b/insertdata/insertDataToEs.go @@ -109,6 +109,7 @@ IsAckAlarm int `json:"isAckAlarm"` IsCollect int `json:"isCollect"` IsDelete int `json:"isDelete"` + TargetInfo []Target } type AlarmRule struct { @@ -164,20 +165,7 @@ videoPersonUrl = "http://" + localConfig1.AlarmIp + ":" + strconv.Itoa(int(localConfig1.AlarmPort)) + "/" + EsInfo.EsIndex.VideoPersons.IndexName + "/" + EsInfo.EsIndex.VideoPersons.IndexType personAction = "http://" + localConfig1.AlarmIp + ":" + strconv.Itoa(int(localConfig1.AlarmPort)) + "/" + EsInfo.EsIndex.Personaction.IndexName + "/" + EsInfo.EsIndex.Personaction.IndexType InsertFace(msg, "") - // 濡傛灉鏍囩涓惈鏈夋寔缁椂闂撮娆℃姤璀︾殑timeLabel鐨勮瘽鍒欎笉闇�瑕佽繃浜轰綋杩借釜锛屼笉鐒跺氨娌$殑鎻掑叆浜� - fk := ruleserver.TrackOrNot(msg.RuleResult) - if fk { - InsertYolo(msg, "") - //if msg.Cid == "61de081a-7ed9-4970-8432-41d642c35456" { - // logger.Warn("鎹曟崏188鎽勫儚鏈虹殑鎸佺画鏃堕棿浠诲姟.....") - // os.Exit(1) - //} - } else { - flag := ruleserver.BodyIsSame(msg.SdkMessage) - if !flag { - InsertYolo(msg, "") - } - } + InsertYolo(msg, "") } // 寰�es涓彃鍏ヤ汉鑴告暟鎹� @@ -206,6 +194,13 @@ } i := protomsg.Image{} err = proto.Unmarshal(bdata, &i) + // 鍏堜紶灏忓浘锛屽啀浼犲ぇ鍥撅紝闃叉鑴镐笂鏈夌嚎 + 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 { + logger.Error("涓婁紶灏忓浘鍑洪敊") + } + // 涓婁紶澶у浘 if imgMaxUrl == "" { bigPhotoUrl := make(map[string]interface{}) bigPhotoUrl, err = util.DrawPolygonOnImageForFace(msg.Cid, i, msg.RuleResult["face"].([]structure.FaceResult), weedfsUrl) @@ -224,11 +219,7 @@ if err != nil { logger.Error("鏌ヨ鎽勫儚鏈轰俊鎭け璐�") } - 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 { - logger.Error("涓婁紶灏忓浘鍑洪敊") - } + //logger.Info("================灏忓浘鍦板潃:", resp["fileUrl"].(string)) sex := "" logger.Info(sex) @@ -364,6 +355,7 @@ logger.Info("寰�ES鎻抷olo鏁版嵁") var sdkNames string = "" alarmRules := []AlarmRule{} + var targetInfos []Target url := []string{} for _, yoloResult := range msg.RuleResult["yolo"].([]structure.Result) { if yoloResult.Others.TimeLabel == "01" || yoloResult.Others.TimeLabel == "10" { @@ -398,6 +390,25 @@ if resp1["fileUrl"] != nil { url = append(url, resp1["fileUrl"].(string)) } + } + } + // 瑁呴厤鐩爣淇℃伅鏁版嵁 + for _,target := range yoloResult.Location { + // 鍘婚噸娣诲姞 + logger.Info("瑁呴厤鍓嶇殑鍘熷鏁版嵁鏄細",target) + var flag = true + for _,selectTarget := range targetInfos { + if strconv.FormatUint(target.TargetId, 10) == selectTarget.TargetId { + flag = false + break + } + } + if flag { + var target1 = new(Target) + target1.TargetId = strconv.FormatUint(target.TargetId, 10) + target1.TargetScore = target.TargetScore + target1.TargetLocation = Points{TopLeft:Point{target.X,target.Y},BottomRight:Point{target.X+target.Width,target.Y+target.Height}} + targetInfos = append(targetInfos,*target1) } } } @@ -455,7 +466,9 @@ if err != nil { logger.Error("鏌ヨ鎽勫儚鏈轰俊鎭け璐�") } + logger.Info("鎽勫儚鏈轰俊鎭細",camera) serverIp, err := GetLocalIP() + logger.Info("%%%%%%%%%%%%%%%%%yolo鐨則arget淇℃伅锛�",targetInfos) if resp["fileUrl"] != nil { url = append(url, resp["fileUrl"].(string)) esDataId := uuid.NewV4().String() @@ -485,6 +498,7 @@ 0, 0, 0, + targetInfos, } requstbody, err := json.Marshal(peraction) -- Gitblit v1.8.0