From ae5ae33cf858da04c638beffe2bcfb9066923b8e Mon Sep 17 00:00:00 2001
From: panlei <2799247126@qq.com>
Date: 星期六, 16 十一月 2019 14:46:21 +0800
Subject: [PATCH] ---

---
 main.go |   62 +++++++++++++++++--------------
 1 files changed, 34 insertions(+), 28 deletions(-)

diff --git a/main.go b/main.go
index ddb2b73..3528a6a 100644
--- a/main.go
+++ b/main.go
@@ -7,24 +7,20 @@
 	"net/http"
 	_ "net/http/pprof"
 	"ruleprocess/insertdata"
+	"ruleprocess/labelFilter"
 	"ruleprocess/structure"
 	"ruleprocess/util"
 	"time"
 
 	"basic.com/valib/logger.git"
-	//"bufio"
-	//"bytes"
 	"flag"
 	"fmt"
 	"github.com/golang/protobuf/proto"
-	"github.com/spf13/viper"
-	//"gocv.io/x/gocv"
-	//"image"
-	//"image/color"
-	//"os"
+
 	"ruleprocess/cache"
 	"ruleprocess/ruleserver"
 	"sync"
+	"github.com/spf13/viper"
 )
 
 var dbIp = flag.String("dbIp", "127.0.0.1", "dbserver ip")
@@ -62,6 +58,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 +98,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)
 			}
 		}
@@ -159,17 +159,8 @@
 			arg.TaskId = m.Tasklab.Taskid
 			arg.IpcId = sdkinfo.Ipcid
 			arg.IsYolo = true
-			//bdata, err := util.UnCompress(m.Data)
-			//if err != nil {
-			//	panic("瑙e帇缂╁浘鐗囨椂鍑虹幇閿欒")
-			//}
-			//i := protomsg.Image{}
-			//err = proto.Unmarshal(bdata, &i)
 			arg.ImageWidth = int(i.Width)
 			arg.ImageHeight = int(i.Height)
-			// 鏆傛椂鍐欐锛宻dk杩樻病鏈夎繖淇╃畻娉�
-			arg.KeepRight = false
-			arg.IsStatic = false
 			logger.Info("-----杩借釜涔嬪悗sdkinfo.Sdkdata鐨勯暱搴︿负锛�----", len(sdkinfo.Sdkdata))
 			if len(sdkinfo.Sdkdata) > 1 {
 				// 澶т簬1鎵嶆湁鏁版嵁
@@ -200,17 +191,8 @@
 			arg.TaskId = m.Tasklab.Taskid
 			arg.IpcId = sdkinfo.Ipcid
 			arg.IsYolo = false
-			//bdata, err := util.UnCompress(m.Data)
-			//if err != nil {
-			//	panic("瑙e帇缂╁浘鐗囨椂鍑虹幇閿欒")
-			//}
-			//i := protomsg.Image{}
-			//err = proto.Unmarshal(bdata, &i)
 			arg.ImageWidth = int(i.Width)
 			arg.ImageHeight = int(i.Height)
-			// 鏆傛椂鍐欐锛宻dk杩樻病鏈夎繖淇╃畻娉�
-			arg.KeepRight = false
-			arg.IsStatic = false
 			if len(sdkinfo.Sdkdata) > 1 {
 				faceParam := protomsg.ParamFacePos{}
 				err = proto.Unmarshal(sdkinfo.Sdkdata, &faceParam)
@@ -229,6 +211,30 @@
 				continue
 			}
 		}
+		if sdkinfo.Sdktype == "Plate" { // 杞︾墝璇嗗埆
+			arg := structure.SdkData{}
+			arg.TaskId = m.Tasklab.Taskid
+			arg.IpcId = sdkinfo.Ipcid
+			arg.IsYolo = false
+			arg.ImageWidth = int(i.Width)
+			arg.ImageHeight = int(i.Height)
+			if len(sdkinfo.Sdkdata) > 1 {
+				plateIDResult  := protomsg.PlateIDResult {}
+				err = proto.Unmarshal(sdkinfo.Sdkdata, &plateIDResult )
+				if err != nil {
+					logger.Info("瑙f瀽杞︾墝鏁版嵁鏃跺嚭鐜伴敊璇�", err)
+					continue
+				}
+				for _, info := range plateIDResult.Result {
+					logger.Info("鎺ユ敹杞︾墝鏁版嵁锛�",info)
+					photoMap := structure.PhotoMap{Rects: rectFormat(info.RcLocation), IsYolo: false, Car:info}
+					arg.Photo = append(arg.Photo, photoMap)
+				}
+				args.Sdkdata = append(args.Sdkdata, &arg)
+			} else {
+				continue
+			}
+		}
 	}
 	return m
 }

--
Gitblit v1.8.0