From c4bfea06be1257db43f54708fd12330b52b44ced Mon Sep 17 00:00:00 2001
From: panlei <2799247126@qq.com>
Date: 星期五, 06 十二月 2019 18:08:57 +0800
Subject: [PATCH] ---
---
insertdata/insertDataToEs.go | 361 ++++++++++++++++++++++++++------------------------
1 files changed, 187 insertions(+), 174 deletions(-)
diff --git a/insertdata/insertDataToEs.go b/insertdata/insertDataToEs.go
index 9cda419..f432036 100644
--- a/insertdata/insertDataToEs.go
+++ b/insertdata/insertDataToEs.go
@@ -1,25 +1,28 @@
package insertdata
import (
- "basic.com/valib/logger.git"
"encoding/base64"
"encoding/json"
"errors"
"net"
- "ruleprocess/cache"
- "ruleprocess/structure"
"strconv"
"time"
- "basic.com/pubsub/protomsg.git"
"github.com/golang/protobuf/proto"
"github.com/satori/go.uuid"
+ logger "github.com/alecthomas/log4go"
+
+ "ruleprocess/cache"
+ "ruleprocess/structure"
+ "basic.com/pubsub/protomsg.git"
+ "basic.com/pubsub/esutil.git"
"ruleprocess/ruleserver"
"ruleprocess/util"
)
var weedfsUrl, videoPersonUrl, personAction string
-
+var serverIp string
+var serverPort string
type conf struct {
PhotoUrl string `yaml:"photoUrl"`
VideoPersons string `yaml:"videoPersons"`
@@ -27,43 +30,6 @@
ServerIp string `yaml:"serverIp"`
ServerPort string `yaml:"serverPort"`
DbTablePersons string `yaml:"dbTablePersons"`
-}
-
-//func InitInsertEs() {
-// weedfsUrl = "http://"+WeedFs.Ip+":"+strconv.Itoa(WeedFs.UploadPort)+"/submit"
-// videoPersonUrl = "http://"+EsInfo.Masterip+":"+EsInfo.Httpport+"/"+EsInfo.EsIndex.VideoPersons.IndexName+"/"+EsInfo.EsIndex.VideoPersons.IndexType
-// personAction = "http://"+EsInfo.Masterip+":"+EsInfo.Httpport+"/"+EsInfo.EsIndex.Personaction.IndexName+"/"+EsInfo.EsIndex.Personaction.IndexType
-//}
-
-// 浜鸿劯鐨勬暟鎹粨鏋�
-type PerVideoPicture struct {
- Id string `json:"id"`
- CameraId string `json:"cameraId"`
- CameraAddr string `json:"cameraAddr"`
- CameraName string `json:"cameraName"`
- PicDate string `json:"picDate"`
- PicMaxUrl []string `json:"picMaxUrl"`
- TaskId string `json:"taskId"`
- TaskName string `json:"taskName"`
- SdkName string `json:"sdkName"`
- Content string `json:"content"`
- AlarmRules []AlarmRule `json:"alarmRules"`
- LikeDate string `json:"likeDate"`
- ShowLabels string `json:"showLabels"`
- OtherLabels string `json:"otherLabels"`
- VideoUrl string `json:"videoUrl"`
- AnalyServerId string `json:"analyServerId"`
- AnalyServerName string `json:"analyServerName"`
- AnalyServerIp string `json:"analyServerIp"`
- ClusterId string `json:"clusterId"`
- IsAlarm bool `json:"isAlarm"`
- IsAckAlarm bool `json:"isAckAlarm"`
- IsCollect bool `json:"isCollect"`
- IsDelete bool `json:"isDelete"`
- BaseInfo []*structure.BaseInfo `json:"baseInfo"`
- TargetInfo []Target `json:"targetInfo"`
- LinkTag string `json:"linkTag"`
- LinkTagInfo []*LinkInfo `json:"linkTagInfo"`
}
type LinkInfo struct {
@@ -94,12 +60,24 @@
TargetInfo []Target `json:"targetInfo"`
}
-type Target struct {
+// 缁熶竴鐨勬暟鎹粨鏋�
+type PerVideoPicture struct {
+ LinkInfo
+ LinkTag string `json:"linkTag"`
+ LinkTagInfo []*LinkInfo `json:"linkTagInfo"`
+}
+
+type SourceTarget struct {
TargetId string `json:"targetId"`
TargetScore float64 `json:"targetScore"`
- FaceFeature string `json:"feature"`
+ TargetType string `json:"targetType"`
+ Feature string `json:"feature"`
PicSmUrl string `json:"picSmUrl"`
TargetLocation Points `json:"targetLocation"`
+}
+type Target struct {
+ SourceTarget
+ AttachTarget SourceTarget `json:"attachTarget"`
}
type Points struct {
@@ -129,7 +107,7 @@
func InsertToEs(msg structure.ResultMsg) {
defer func() {
if err := recover(); err != nil {
- logger.Error("es妯″潡鍎跨殑寮傚父鎹曡幏锛�", err)
+ _ = logger.Error("es妯″潡鍎跨殑寮傚父鎹曡幏锛�", err)
}
}()
localConfig1, err := cache.GetServerInfo()
@@ -137,117 +115,152 @@
panic("閰嶇疆鏂囦欢涓嶅悎娉�")
}
weedfsUrl = "http://" + localConfig1.WebPicIp + ":" + strconv.Itoa(int(localConfig1.WebPicPort)) + "/submit"
- videoPersonUrl = "http://" + localConfig1.AlarmIp + ":" + strconv.Itoa(int(localConfig1.AlarmPort)) + "/" + EsInfo.EsIndex.AIOcean.IndexName + "/" + EsInfo.EsIndex.AIOcean.IndexType
- InsertFace(msg)
- InsertYolo(msg)
- InsertTarget(msg)
+ videoPersonUrl = "http://" + localConfig1.AlarmIp + ":" + strconv.Itoa(int(localConfig1.AlarmPort)) + "/" + EsInfo.EsIndex.AIOcean.IndexName + "/" + EsInfo.EsIndex.AIOcean.IndexType+"?refresh=true"
+ serverIp = localConfig1.AlarmIp
+ serverPort = strconv.Itoa(int(localConfig1.AlarmPort))
+ for k,results := range msg.RuleResult {
+ if results != nil && len(results.([]structure.Result)) > 0{
+ switch k {
+ case "yolo":
+ InsertYolo(msg,k,results)
+ case "face":
+ InsertFace(msg,k,results)
+ case "plate":
+ InsertFace(msg,k,results)
+ case "track":
+ InsertFace(msg,k,results)
+ case "target":
+ InsertLastTarget(msg)
+ }
+ }
+ }
}
// 寰�es涓彃鍏ヤ汉鑴哥被鍨嬫暟鎹�
-func InsertFace(msg structure.ResultMsg) {
- if (msg.RuleResult["face"] != nil && len(msg.RuleResult["face"].([]structure.Result)) > 0) || (msg.RuleResult["plate"] != nil && len(msg.RuleResult["plate"].([]structure.Result)) > 0) {
- for key, results := range msg.RuleResult {
- if key == "face" || key == "plate" {
- logger.Info("寰�ES鎻掍汉鑴告暟鎹�(鎴栬溅鐗屾暟鎹�)")
- faces := []*ObjAndRules{}
- faces = PutFace(faces, results.([]structure.Result))
- //logger.Info("鏁寸悊鍚庣殑鏁版嵁锛�",faces)
- if faces != nil {
- var imgMaxUrl []string = []string{}
- var picTime string = ""
- for _, face := range faces {
- // 涓婁紶澶у浘
- // 瑙e帇缂╁苟涓婁紶鍥剧墖
- bdata, err := util.UnCompress(msg.Data)
- if err != nil {
- panic("瑙e帇缂╁浘鐗囨椂鍑虹幇閿欒")
- }
- alarmRules := []AlarmRule{}
- for _, faceResult := range face.rules {
- alarm := ChangeToString(faceResult.DefenceState, faceResult.AlarmLevel)
- alarmRules = append(alarmRules, AlarmRule{faceResult.RuleGroupId, alarm, faceResult.RuleText, faceResult.DefenceState, ""})
- }
- 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 len(imgMaxUrl) == 0 {
- bigPhotoUrl := make(map[string]interface{})
- bigPhotoUrl, err = util.DrawPolygonOnImageForFace(msg.Cid, i, msg.RuleResult["face"].([]structure.Result), weedfsUrl)
- logger.Debug("========澶у浘璺緞锛�", bigPhotoUrl)
- imgMaxUrl = append(imgMaxUrl, bigPhotoUrl["fileUrl"].(string))
- picTime = i.Timestamp
- }
- lable, lableAttach := Feature2Jsonstr(*face)
- var target = new(Target)
- target.TargetId = face.Id
- target.TargetScore = face.Score
- target.FaceFeature = base64.StdEncoding.EncodeToString(face.Feature)
- target.PicSmUrl = resp["fileUrl"].(string)
- target.TargetLocation = Points{TopLeft: Point{face.Location.X, face.Location.Y}, BottomRight: Point{face.Location.X + face.Location.Width, face.Location.Y + face.Location.Height}}
- var targetInfos []Target
- targetInfos = append(targetInfos, *target)
+func InsertFace(msg structure.ResultMsg,key string, results interface{}) {
+ logger.Info("寰�es鎻掑叆鎶撴媿鏁版嵁")
+ faces := []*ObjAndRules{}
+ faces = PutFace(faces, results.([]structure.Result))
+ //logger.Info("鏁寸悊鍚庣殑鏁版嵁锛�",faces)
+ if faces != nil {
+ _ = logger.Warn("face涓嶄负nil")
+ var imgMaxUrl []string = []string{}
+ var picTime string = ""
+ for _, face := range faces {
+ // 涓婁紶澶у浘
+ // 瑙e帇缂╁苟涓婁紶鍥剧墖
+ bdata, err := util.UnCompress(msg.Data)
+ if err != nil {
+ panic("瑙e帇缂╁浘鐗囨椂鍑虹幇閿欒")
+ }
+ alarmRules := []AlarmRule{}
+ //logger.Info("寰幆姣忎竴涓洰鏍�")
+ for _, faceResult := range face.rules {
+ alarm := ChangeToString(faceResult.DefenceState, faceResult.AlarmLevel)
+ alarmRules = append(alarmRules, AlarmRule{faceResult.RuleGroupId, alarm, faceResult.RuleText, faceResult.DefenceState, ""})
+ }
+ 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),face.Type)
+ resp, err := util.PostFormBufferData1(weedfsUrl, bytes, uuid.NewV4().String())
+ if err != nil {
+ _ = logger.Error("涓婁紶灏忓浘鍑洪敊")
+ }
+ // 涓婁紶澶у浘
+ if len(imgMaxUrl) == 0 {
+ bigPhotoUrl := make(map[string]interface{})
+ bigPhotoUrl, err = util.DrawPolygonOnImageForFace(msg.Cid, i, msg.RuleResult["face"].([]structure.Result), weedfsUrl)
+ logger.Debug("========澶у浘璺緞锛�", bigPhotoUrl)
+ imgMaxUrl = append(imgMaxUrl, bigPhotoUrl["fileUrl"].(string))
+ picTime = i.Timestamp
+ }
+ lable, lableAttach := Feature2Jsonstr(*face)
+ var target = new(Target)
+ target.TargetId = face.Id
+ target.TargetScore = face.Score
+ target.TargetType = face.Type
+ target.Feature = base64.StdEncoding.EncodeToString(face.Feature)
+ target.PicSmUrl = resp["fileUrl"].(string)
+ target.TargetLocation = Points{TopLeft: Point{face.Location.X, face.Location.Y}, BottomRight: Point{face.Location.X + face.Location.Width, face.Location.Y + face.Location.Height}}
+ target.AttachTarget = SourceTarget{face.AttachArg.Id,face.AttachArg.Score,face.AttachArg.Type,base64.StdEncoding.EncodeToString(face.AttachArg.Feature),"",Points{TopLeft: Point{face.AttachArg.Location.X, face.AttachArg.Location.Y}, BottomRight: Point{face.AttachArg.Location.X + face.AttachArg.Location.Width, face.AttachArg.Location.Y + face.AttachArg.Location.Height}}}
+ var targetInfos []Target
+ targetInfos = append(targetInfos, *target)
- sdkname := ""
- switch key {
- case "face":
- sdkname = "浜鸿劯"
- case "plate":
- sdkname = "杞︾墝璇嗗埆"
- }
- pervideo := PerVideoPicture{
- face.Uuid,
- msg.Cid,
- msg.Push.Cam.Addr,
- msg.Push.Cam.Name,
- picTime,
- imgMaxUrl,
- msg.Tasklab.Taskid,
- msg.Tasklab.Taskname,
- sdkname,
- "",
- alarmRules,
- time.Now().Format("2006-01-02 15:04:05"), // 鍙娴嬶紝娌℃湁姣斿鏃堕棿
- lable,
- lableAttach,
- "",
- msg.Push.ServerId,
- msg.Push.ServerName,
- msg.Push.LocalIp,
- "",
- true,
- false,
- false,
- false,
- face.Liker,
- targetInfos,
- "",
- []*LinkInfo{},
- }
- requstbody, err := json.Marshal(pervideo)
+ sdkname := ""
+ id := face.Uuid
+ switch key {
+ case "face":
+ sdkname = "浜鸿劯"
+ case "plate":
+ sdkname = "杞︾墝璇嗗埆"
+ case "track":
+ sdkname = "浜哄憳璺熻釜"
+ if len(face.Liker) == 1{
+ id = face.Liker[0].TargetId
+ }
+ }
+ //logger.Info("浜鸿劯鐩爣target:",targetInfos)
- if err != nil {
- logger.Info("json parse error ", err)
- return
- }
- resp1, err1 := EsReq("POST", videoPersonUrl, requstbody)
- if err1 != nil {
- logger.Error("涓婁紶ES鍑洪敊锛�---", err1)
- } else {
- logger.Info("鎻掑叆es杩斿洖鐨勪俊鎭細", sdkname,"---",resp1)
- // 鍙戝嚭褰曞儚淇″彿
- ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: face.Uuid, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid, VideoUrl: msg.Push.VideoUrl, ImgId: i.Id, SdkIds: []string{"-1"}, Type: 1})
- }
+ pervideo := PerVideoPicture{LinkInfo{
+ id,
+ msg.Cid,
+ msg.Push.Cam.Addr,
+ msg.Push.Cam.Name,
+ picTime,
+ imgMaxUrl,
+ msg.Tasklab.Taskid,
+ msg.Tasklab.Taskname,
+ sdkname,
+ "",
+ alarmRules,
+ time.Now().Format("2006-01-02 15:04:05"), // 鍙娴嬶紝娌℃湁姣斿鏃堕棿
+ lable,
+ lableAttach,
+ "",
+ msg.Push.ServerId,
+ msg.Push.ServerName,
+ msg.Push.LocalIp,
+ "",
+ true,
+ false,
+ false,
+ false,
+ face.Liker,
+ targetInfos,
+ },
+ "",
+ []*LinkInfo{},
+ }
+ requstbody, err := json.Marshal(pervideo)
+
+ if err != nil {
+ logger.Info("json parse error ", err)
+ return
+ }
+ if key == "track" && len(face.Liker) == 1{
+ esid := face.Liker[0].TargetId
+ returnMsg, err1 := esutil.AppendTargetInfo(esid, string(requstbody),EsInfo.EsIndex.AIOcean.IndexName,serverIp,serverPort)
+ if err1 != nil {
+ _ = logger.Error("杩藉姞鏁版嵁鍑洪敊锛�---", err1)
+ } else {
+ logger.Info("鎻掑叆es杩斿洖鐨勪俊鎭細", returnMsg)
+ // 鍙戝嚭褰曞儚淇″彿
+ ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: face.Uuid, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid, VideoUrl: msg.Push.VideoUrl, ImgId: i.Id, SdkIds: []string{"-1"}, Type: 1})
+ }
+ } else {
+ resp1, err1 := EsReq("POST", videoPersonUrl, requstbody)
+ if err1 != nil {
+ _ = logger.Error("涓婁紶ES鍑洪敊锛�---", err1)
+ } else {
+ logger.Info("鎻掑叆es杩斿洖鐨勪俊鎭細", resp1)
+ // 鍙戝嚭褰曞儚淇″彿
+ ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: face.Uuid, CameraId: msg.Cid, TaskId: msg.Tasklab.Taskid, VideoUrl: msg.Push.VideoUrl, ImgId: i.Id, SdkIds: []string{"-1"}, Type: 1})
}
}
}
}
- }
+
}
// 褰掔疆浜鸿劯
@@ -292,8 +305,7 @@
}
// 寰�es涓彃鍏olo鏁版嵁
-func InsertYolo(msg structure.ResultMsg) {
- if msg.RuleResult["yolo"] != nil && len(msg.RuleResult["yolo"].([]structure.Result)) > 0 {
+func InsertYolo(msg structure.ResultMsg,key string, results interface{}) {
// 鍏堝垽鏂竴涓嬫暟鎹甫鐨勮鍒欐爣绛炬槸鍚︽湁鍙互鎻掑叆鐨�
flag := false
for _, res := range msg.RuleResult["yolo"].([]structure.Result) {
@@ -308,7 +320,7 @@
alarmRules := []AlarmRule{}
var targetInfos []Target
url := []string{}
- for _, yoloResult := range msg.RuleResult["yolo"].([]structure.Result) {
+ for _, yoloResult := range results.([]structure.Result) {
if yoloResult.Others.TimeLabel == "01" || yoloResult.Others.TimeLabel == "10" {
// 鎷煎嚭sdkname
//logger.Info("搴旇杩涙潵鎵嶅鐨�")
@@ -319,7 +331,7 @@
linkInfo = "鑱斿姩浠诲姟"
}
alarmRules = append(alarmRules, AlarmRule{yoloResult.RuleGroupId, alarm, yoloResult.RuleText, yoloResult.DefenceState, linkInfo})
- logger.Info("鎵撳嵃浠诲姟鍚嶇О锛�", )
+ //logger.Info("鎵撳嵃浠诲姟鍚嶇О锛�", )
// 涓婁紶缂撳瓨鏁版嵁鐨勫浘鐗囨嬁鍒皍rl
if yoloResult.Others.CacheData != nil {
//InsertYolo(msg.RuleResult["cacheData"].(ruleserver.ResultMsg))
@@ -335,7 +347,7 @@
err = proto.Unmarshal(bdata, &i)
resp1, err1 := util.DrawPolygonOnImageForYolo(msg1.Cid, i, msg1.RuleResult["yolo"].([]structure.Result), weedfsUrl)
if err1 != nil {
- logger.Error("缂撳瓨鏁版嵁鐢绘鎴栦笂浼犲浘鐗囨湇鍔″櫒鍑洪敊", err)
+ _ = logger.Error("缂撳瓨鏁版嵁鐢绘鎴栦笂浼犲浘鐗囨湇鍔″櫒鍑洪敊", err)
} else {
logger.Info("涓婁紶鐨勫浘鐗囦俊鎭細", resp1)
}
@@ -358,6 +370,7 @@
var target1 = new(Target)
target1.TargetId = target.Id
target1.TargetScore = target.Score
+ target1.TargetType = "action"
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)
}
@@ -394,7 +407,7 @@
//resp, err = util.PostFormBufferData(weedfsUrl, i, uuid.NewV4().String())
resp, err = util.DrawPolygonOnImageForYolo(msg.Cid, i, msg.RuleResult["yolo"].([]structure.Result), weedfsUrl)
if err != nil {
- logger.Error("鐢绘鎴栦笂浼犲浘鐗囨湇鍔″櫒鍑洪敊", err)
+ _ = logger.Error("鐢绘鎴栦笂浼犲浘鐗囨湇鍔″櫒鍑洪敊", err)
return
} else {
logger.Info("涓婁紶鐨勫浘鐗囦俊鎭細", resp)
@@ -407,7 +420,7 @@
if resp["fileUrl"] != nil {
url = append(url, resp["fileUrl"].(string))
//esDataId := uuid.NewV4().String()
- peraction := PerVideoPicture{
+ peraction := PerVideoPicture{LinkInfo{
msg.Push.PushId,
msg.Cid,
msg.Push.Cam.Addr,
@@ -433,6 +446,7 @@
false,
nil,
targetInfos,
+ },
linkTag,
linkTagInfos,
}
@@ -447,7 +461,7 @@
}
resp1, err2 := EsReq("POST", videoPersonUrl, requstbody)
if err2 != nil {
- logger.Error("寰�ES鎻掑叆鏁版嵁澶辫触", err)
+ _ = logger.Error("寰�ES鎻掑叆鏁版嵁澶辫触", err)
} else {
logger.Debug("鎻掑叆es杩斿洖鐨勬暟鎹俊鎭槸锛坹olo锛夛細", resp1)
// 鍙戝嚭褰曞儚淇″彿
@@ -456,19 +470,16 @@
logger.Info("鑱斿姩浠诲姟鐨勫綍鍍忎俊鍙凤細", index)
ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: msg.Push.PushId, CameraId: link.CameraId, TaskId: msg.Tasklab.Taskid, VideoUrl: msg.Push.VideoUrl, ImgId: i.Id, SdkIds: []string{strconv.Itoa(index)}, Type: 2})
}
- logger.Warn("__________________________________________寰�ES鎻掑叆yolo鏁版嵁鎴愬姛")
+ _ = logger.Warn("__________________________________________寰�ES鎻掑叆yolo鏁版嵁鎴愬姛")
//os.Exit(1)
}
}
}
- } else {
- logger.Debug("timeLabel鏉′欢閮戒笉绗﹀悎锛�")
- }
}
// 鎻掑叆鐩爣鎸佺画鏃堕棿鏁版嵁
-func InsertTarget(msg structure.ResultMsg) {
+func InsertLastTarget(msg structure.ResultMsg) {
if msg.RuleResult["target"] != nil && len(msg.RuleResult["target"].([]structure.Result)) > 0 {
// 鍏堝垽鏂竴涓嬫暟鎹甫鐨勮鍒欐爣绛炬槸鍚︽湁鍙互鎻掑叆鐨�
logger.Info("鎻掑叆瀹氭椂鐩爣淇℃伅锛�", len(msg.RuleResult["target"].([]structure.Result)))
@@ -533,7 +544,7 @@
//resp, err = util.PostFormBufferData(weedfsUrl, i, uuid.NewV4().String())
resp, err = util.DrawPolygonOnImageForYolo(msg.Cid, i, msg.RuleResult["target"].([]structure.Result), weedfsUrl)
if err != nil {
- logger.Error("鐢绘鎴栦笂浼犲浘鐗囨湇鍔″櫒鍑洪敊", err)
+ _ = logger.Error("鐢绘鎴栦笂浼犲浘鐗囨湇鍔″櫒鍑洪敊", err)
return
} else {
logger.Info("涓婁紶鐨勫浘鐗囦俊鎭細", resp)
@@ -558,6 +569,7 @@
var target1 = new(Target)
target1.TargetId = target.Id
target1.TargetScore = target.Score
+ target1.TargetType = "action"
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)
}
@@ -568,7 +580,7 @@
return
}
//esDataId := uuid.NewV4().String()
- peraction := PerVideoPicture{
+ peraction := PerVideoPicture{LinkInfo{
msg.Push.PushId,
msg.Cid,
msg.Push.Cam.Addr,
@@ -593,7 +605,8 @@
false,
false,
nil,
- nil,
+ targetInfos,
+ },
linkTag,
linkTagInfos,
}
@@ -608,7 +621,7 @@
}
resp1, err2 := EsReq("POST", videoPersonUrl, requstbody)
if err2 != nil {
- logger.Error("寰�ES鎻掑叆鏁版嵁澶辫触", err)
+ _ = logger.Error("寰�ES鎻掑叆鏁版嵁澶辫触", err)
} else {
logger.Debug("鎻掑叆es杩斿洖鐨勬暟鎹俊鎭槸锛坱arget锛夛細", resp1)
// 鍙戝嚭褰曞儚淇″彿
@@ -617,7 +630,7 @@
logger.Info("鑱斿姩浠诲姟鐨勫綍鍍忎俊鍙凤細", index)
ruleserver.AddLxMessage(&protomsg.VideotapeInfo{EsDataId: msg.Push.PushId, CameraId: link.CameraId, TaskId: msg.Tasklab.Taskid, VideoUrl: msg.Push.VideoUrl, ImgId: i.Id, SdkIds: []string{strconv.Itoa(index)}, Type: 2})
}
- logger.Warn("__________________________________________寰�ES鎻掑叆target鏁版嵁鎴愬姛")
+ _ = logger.Warn("__________________________________________寰�ES鎻掑叆target鏁版嵁鎴愬姛")
//os.Exit(1)
}
}
@@ -691,7 +704,7 @@
err = proto.Unmarshal(bdata, &i)
resp1, err1 := util.DrawPolygonOnImageForTarget(msg.Cid, i, msg.RuleResult["target"].([]structure.Result), weedfsUrl)
if err1 != nil {
- logger.Error("缂撳瓨鏁版嵁鐢绘鎴栦笂浼犲浘鐗囨湇鍔″櫒鍑洪敊", err)
+ _ = logger.Error("缂撳瓨鏁版嵁鐢绘鎴栦笂浼犲浘鐗囨湇鍔″櫒鍑洪敊", err)
} else {
logger.Info("涓婁紶鐨勫浘鐗囦俊鎭細", resp1)
}
@@ -744,16 +757,16 @@
}
race := getRaceString(obj.ThftRes.Race)
ageDescription := getDescription(obj.ThftRes.Age)
- lable = sex + "/" + ageDescription + "/" + race + "/"
+ lable = sex + "/" + ageDescription + "/" + race
lableAttach = strconv.Itoa(int(obj.ThftRes.Age)) + "宀�" + "/" + "寰瑧鍊硷細" + strconv.Itoa(int(obj.ThftRes.Smile)) + "/" + "棰滃�硷細" + strconv.Itoa(int(obj.ThftRes.Beauty))
case "plate":
// 杞︾墝杩愬姩鏂瑰悜锛�0 unknown, 1 left, 2 right, 3 up, 4 down
- logger.Info("杞﹁締杞︾墝淇℃伅锛�",obj.Car.NColor,obj.Car.NCarColor,obj.Car.NCarLogo,obj.Car.NCarType,obj.Car.NDirection)
- lable = obj.Car.License + "/" + cache.GetDic("nColor"+strconv.Itoa(int(obj.Car.NColor))) + "杞︾墝" + "/" +
- cache.GetDic("nCarColor"+strconv.Itoa(int(obj.Car.NCarColor))) + "杞﹁締" + "/" + "鍝佺墝锛�"+cache.GetDic("nCarLogo"+strconv.Itoa(int(obj.Car.NCarLogo))) + "/" + "鍨嬪彿锛�"+cache.GetDic("nCarType"+strconv.Itoa(int(obj.Car.NCarType)))
- lableAttach = cache.GetDic("nDirection"+strconv.Itoa(int(obj.Car.NDirection))) + "/" + "杞︾墝缃俊搴︼細" + strconv.Itoa(int(obj.Car.NConfidence)) + "/" +
- "杞︾墝浜害锛�" + strconv.Itoa(int(obj.Car.NBright)) + "/" + "杞︾殑浜害锛�" + strconv.Itoa(int(obj.Car.NCarBright)) + "/" + "璇嗗埆鏃堕棿锛�" + strconv.Itoa(int(obj.Car.NTime))
+ lable = obj.Car.License + "/" + cache.GetDic("nVehicleColor1"+strconv.Itoa(int(obj.Car.NVehicleColor1))) + "杞﹁締" + "/" +
+ cache.GetDic("nColor"+strconv.Itoa(int(obj.Car.NColor))) + "杞︾墝"
+ lableAttach = "杞︾墝缃俊搴︼細" + strconv.Itoa(int(obj.Car.NConfidence)) + "/" + "杞︾殑浜害锛�" + strconv.Itoa(int(obj.Car.NVehicleBright)) +"/"+ "杞︾墝绫诲瀷"+cache.GetDic("nType"+strconv.Itoa(int(obj.Car.NType)))+
+ "杞﹁韩杈呴鑹诧細"+cache.GetDic("nVehicleColor2"+strconv.Itoa(int(obj.Car.NVehicleColor2)))+"/"+"鏄惁璇嗗埆鍒拌溅鐗岋細"+cache.GetDic("nVehicleColor1"+strconv.Itoa(int(obj.Car.NVehicleColor1)))+"/"+
+ "杞﹁締缃俊搴�"+strconv.Itoa(int(obj.Score))+"/"+"鍝佺墝锛�" +obj.Car.VehicleType1
}
return lable, lableAttach
}
@@ -800,7 +813,7 @@
err = proto.Unmarshal(bdata, &i)
resp1, err1 := util.DrawPolygonOnImageForYolo(msg1.Cid, i, msg1.RuleResult["yolo"].([]structure.Result), weedfsUrl)
if err1 != nil {
- logger.Error("缂撳瓨鏁版嵁鐢绘鎴栦笂浼犲浘鐗囨湇鍔″櫒鍑洪敊", err)
+ _ = logger.Error("缂撳瓨鏁版嵁鐢绘鎴栦笂浼犲浘鐗囨湇鍔″櫒鍑洪敊", err)
} else {
logger.Info("涓婁紶鐨勫浘鐗囦俊鎭細", resp1)
}
@@ -843,7 +856,7 @@
//resp, err = util.PostFormBufferData(weedfsUrl, i, uuid.NewV4().String())
resp, err = util.DrawPolygonOnImageForYolo(msg.Cid, i, msg.RuleResult["yolo"].([]structure.Result), weedfsUrl)
if err != nil {
- logger.Error("鐢绘鎴栦笂浼犲浘鐗囨湇鍔″櫒鍑洪敊", err)
+ _ = logger.Error("鐢绘鎴栦笂浼犲浘鐗囨湇鍔″櫒鍑洪敊", err)
return nil
} else {
logger.Info("涓婁紶鐨勫浘鐗囦俊鎭細", resp)
--
Gitblit v1.8.0