From 2b2576642ae036b1930c1abbb628626e7fc500f5 Mon Sep 17 00:00:00 2001 From: panlei <2799247126@qq.com> Date: 星期四, 07 十一月 2019 17:57:37 +0800 Subject: [PATCH] --- --- main.go | 25 ++++++++++++------------- 1 files changed, 12 insertions(+), 13 deletions(-) diff --git a/main.go b/main.go index fa28b33..32fa0e0 100644 --- a/main.go +++ b/main.go @@ -7,24 +7,19 @@ "net/http" _ "net/http/pprof" "ruleprocess/insertdata" + "ruleprocess/labelFilter" "ruleprocess/structure" "ruleprocess/util" "time" - //"bufio" - //"bytes" + "basic.com/valib/logger.git" "flag" "fmt" "github.com/golang/protobuf/proto" - "basic.com/valib/logger.git" - //"gocv.io/x/gocv" - //"image" - //"image/color" - //"os" + "github.com/spf13/viper" "ruleprocess/cache" "ruleprocess/ruleserver" "sync" - "github.com/spf13/viper" ) var dbIp = flag.String("dbIp", "127.0.0.1", "dbserver ip") @@ -62,6 +57,7 @@ go cache.Init(initchan, *dbIp, *surveyPort, *pubPort) logger.Info("cache init completed!!!", <-initchan) //dbserver鍒濆鍖栧畬姣� ruleserver.Init() + labelFilter.Init() go ruleserver.TimeTicker() go ruleserver.StartServer() nReciever("ipc:///tmp/sdk-2-rules-process.ipc", deliver.PushPull, 1) @@ -101,12 +97,15 @@ ruleserver.Judge(&arg, &m) // 鎶妔dkMessage浼犺繘鍘伙紝鏂逛究缂撳瓨鏁版嵁鏃舵嫾鍑轰竴涓猺esultMag // 鎶奱rg閲岀殑鎵撶殑鏍囩鎷垮嚭鏉ョ粰m鍐嶅皝瑁呬竴灞� resultMsg := structure.ResultMsg{SdkMessage: &m, RuleResult: arg.RuleResult} - logger.Debug("瑙勫垯鍒ゆ柇瀹屾墍鐢ㄦ椂闂达細", time.Since(start)) + ruleserver.GetAttachInfo(resultMsg.SdkMessage) + ruleEnd := time.Since(start) + logger.Debug("瑙勫垯鍒ゆ柇瀹屾墍鐢ㄦ椂闂达細", ruleEnd) // 灏嗘墦瀹屾爣绛剧殑鏁版嵁鎻掑叆鍒癊S insertdata.InsertToEs(resultMsg) - logger.Debug("鎻掑叆瀹孍s鎵�鐢ㄦ椂闂达細", time.Since(start)) + esEnd := time.Since(start) + logger.Debug("鎻掑叆瀹孍s鎵�鐢ㄦ椂闂达細", esEnd) //浜嬩欢鎺ㄩ�� - //go labelFilter.Judge(resultMsg) + labelFilter.PushSomthing(resultMsg) //}(msg) } } @@ -117,7 +116,7 @@ // 灏嗗閮ㄤ紶杩涙潵鐨剅ect锛坱op,bottom,left,right锛夎浆鍖栦负鑷繁鍐呴儴鐨剅ect(left top width height) func rectFormat(rcobj *protomsg.Rect) structure.Rect { //logger.Info("++++++++++++++++++++++++++++++鏀跺埌鐨剏olo鐨勫尯鍩熷潗鏍囷細",rcobj) - rect := ruleserver.Rect{} + rect := structure.Rect{} rect.X = float64(rcobj.Left) rect.Y = float64(rcobj.Top) rect.Width = float64(rcobj.Right - rcobj.Left) @@ -183,7 +182,7 @@ for _, info := range yoloParam.Infos { if info.Typ == 0 { //logger.Debug("-------------yolo鐨勫潗鏍囨湁鍑犱釜",info.RcObj) - photoMap := structure.PhotoMap{Rects: rectFormat(info.RcObj), Score: float64(info.Prob) * 100, IsYolo: true} + photoMap := structure.PhotoMap{Rects: rectFormat(info.RcObj), Score: float64(info.Prob) * 100, IsYolo: true,Id:info.ObjID} arg.Photo = append(arg.Photo, photoMap) yoloNum++ } -- Gitblit v1.8.0