From 8c3063e420502667043e0e1bdb35eef05fbd133b Mon Sep 17 00:00:00 2001
From: panlei <2799247126@qq.com>
Date: 星期四, 14 十一月 2019 15:11:28 +0800
Subject: [PATCH] 结果标签大改动
---
insertdata/insertDataToEs.go | 45 +++++++++++++++++++++++++--------------------
1 files changed, 25 insertions(+), 20 deletions(-)
diff --git a/insertdata/insertDataToEs.go b/insertdata/insertDataToEs.go
index 5d21eaa..7af0fa4 100644
--- a/insertdata/insertDataToEs.go
+++ b/insertdata/insertDataToEs.go
@@ -184,7 +184,7 @@
// 寰�es涓彃鍏ヤ汉鑴告暟鎹�
func InsertFace(msg structure.ResultMsg) {
- if msg.RuleResult["face"] != nil && len(msg.RuleResult["face"].([]structure.FaceResult)) > 0 {
+ if msg.RuleResult["face"] != nil && len(msg.RuleResult["face"].([]structure.Result)) > 0 {
logger.Info("寰�ES鎻掍汉鑴告暟鎹�")
faces := []*FaceAndRules{}
faces = PutFace(faces, msg)
@@ -216,7 +216,7 @@
// 涓婁紶澶у浘
if imgMaxUrl == "" {
bigPhotoUrl := make(map[string]interface{})
- bigPhotoUrl, err = util.DrawPolygonOnImageForFace(msg.Cid, i, msg.RuleResult["face"].([]structure.FaceResult), weedfsUrl)
+ bigPhotoUrl, err = util.DrawPolygonOnImageForFace(msg.Cid, i, msg.RuleResult["face"].([]structure.Result), weedfsUrl)
logger.Debug("========澶у浘璺緞锛�", bigPhotoUrl)
imgMaxUrl = bigPhotoUrl["fileUrl"].(string)
picTime = i.Timestamp
@@ -295,8 +295,8 @@
// 褰掔疆浜鸿劯
func PutFace(faces []*FaceAndRules, msg structure.ResultMsg) []*FaceAndRules {
- if msg.RuleResult["face"] != nil && len(msg.RuleResult["face"].([]structure.FaceResult)) > 0 {
- for _, faceResult := range msg.RuleResult["face"].([]structure.FaceResult) {
+ if msg.RuleResult["face"] != nil && len(msg.RuleResult["face"].([]structure.Result)) > 0 {
+ for _, faceResult := range msg.RuleResult["face"].([]structure.Result) {
faces = hebingFace(faces, faceResult)
}
return faces
@@ -304,8 +304,8 @@
return nil
}
}
-func hebingFace(faces []*FaceAndRules, faceResult structure.FaceResult) []*FaceAndRules {
- for _, arg := range faceResult.Args {
+func hebingFace(faces []*FaceAndRules, faceResult structure.Result) []*FaceAndRules {
+ for _, arg := range faceResult.AlarmObj {
// 鎷垮埌姣忎竴寮犱汉鑴�
//logger.Info("褰掔疆浜鸿劯鏃剁浉浼艰�呯殑鏁伴噺锛�", len(arg.Liker))
flag := false
@@ -315,7 +315,7 @@
//}
if arg.Id == face.Id {
flag = true
- face.rules = append(face.rules, faceResult.Result)
+ face.rules = append(face.rules, faceResult)
// 鐩镐技鑰呭幓閲嶅綊骞�
for _, liker := range arg.Liker {
flag1 := true
@@ -332,7 +332,7 @@
}
}
if !flag {
- faces = append(faces, &FaceAndRules{arg, []structure.Result{faceResult.Result}})
+ faces = append(faces, &FaceAndRules{*arg, []structure.Result{faceResult}})
}
}
return faces
@@ -391,20 +391,20 @@
}
}
// 瑁呴厤鐩爣淇℃伅鏁版嵁
- for _, target := range yoloResult.Location {
+ for _, target := range yoloResult.AlarmObj {
// 鍘婚噸娣诲姞
var flag = true
for _, selectTarget := range targetInfos {
- if strconv.FormatUint(target.TargetId, 10) == selectTarget.TargetId {
+ if strconv.FormatUint(target.Id, 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}}
+ target1.TargetId = strconv.FormatUint(target.Id, 10)
+ target1.TargetScore = target.Score
+ target1.TargetLocation = Points{TopLeft: Point{target.Location.X, target.Location.Y}, BottomRight: Point{target.Location.X + target.Location.Width, target.Location.Y + target.Location.Height}}
targetInfos = append(targetInfos, *target1)
}
}
@@ -416,7 +416,9 @@
if (yoloResult.Others.TimeLabel == "01" || yoloResult.Others.TimeLabel == "10") && yoloResult.Others.LinkCache != nil && len(yoloResult.Others.LinkCache) > 1 {
for _, msg2 := range yoloResult.Others.LinkCache {
// 鎶妋sg2鐨勬暟鎹閰嶆垚涓�涓狿erVideoPicture缁撴瀯浣�
- linkTagInfos = append(linkTagInfos, msg2PersonVideo(msg2))
+ if msg2.Cid != msg.Cid {
+ linkTagInfos = append(linkTagInfos, msg2PersonVideo(msg2))
+ }
}
}
}
@@ -477,7 +479,10 @@
linkTagInfos,
}
requstbody, err := json.Marshal(peraction)
- logger.Info("涓婁紶鍙傛暟json",peraction)
+
+ if len(linkTagInfos)>0 {
+ logger.Info("鑱斿姩浠诲姟1111")
+ }
if err != nil {
logger.Info("json parse error ", err)
return
@@ -634,20 +639,20 @@
}
}
// 瑁呴厤鐩爣淇℃伅鏁版嵁
- for _, target := range yoloResult.Location {
+ for _, target := range yoloResult.AlarmObj {
// 鍘婚噸娣诲姞
var flag = true
for _, selectTarget := range targetInfos {
- if strconv.FormatUint(target.TargetId, 10) == selectTarget.TargetId {
+ if strconv.FormatUint(target.Id, 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}}
+ target1.TargetId = strconv.FormatUint(target.Id, 10)
+ target1.TargetScore = target.Score
+ target1.TargetLocation = Points{TopLeft: Point{target.Location.X, target.Location.Y}, BottomRight: Point{target.Location.X + target.Location.Width, target.Location.Y + target.Location.Height}}
targetInfos = append(targetInfos, *target1)
}
}
--
Gitblit v1.8.0