From 35f6dd60f51b44b1e6b4ddaacd17f95b9aa87edc Mon Sep 17 00:00:00 2001
From: panlei <2799247126@qq.com>
Date: 星期一, 16 十二月 2019 15:22:50 +0800
Subject: [PATCH] 特征值从开始时就存为string

---
 algorithm/middleware/readyData.go |   24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/algorithm/middleware/readyData.go b/algorithm/middleware/readyData.go
index a1e0662..e173812 100644
--- a/algorithm/middleware/readyData.go
+++ b/algorithm/middleware/readyData.go
@@ -2,7 +2,9 @@
 
 import (
 	"basic.com/pubsub/protomsg.git"
-	logger "github.com/alecthomas/log4go"
+	"basic.com/valib/logger.git"
+	"encoding/base64"
+	"encoding/json"
 	"github.com/golang/protobuf/proto"
 	uuid "github.com/satori/go.uuid"
 	"ruleprocess/ruleserver"
@@ -21,7 +23,7 @@
 func CountAreaObjs(a *structure.AreaMap,arg *structure.SdkData) {
 
 	a.TargetNum = 0
-	threshold := 70.0       // 鐩镐技搴�
+	threshold := 0.0       // 鐩镐技搴�
 	intersectionper := 20.0 // 鍗犳瘮
 	size := 0.0            // 灏哄
 
@@ -54,7 +56,7 @@
 	}
 	for _, polygon := range cameraPolygons {
 		//logger.Println("++++++鍦ㄨ繖鍎跨湅涓�涓嬪尯鍩熷晩:", polygon.Polygon)
-		areaMap := structure.AreaMap{CameraId: cameraId, AreaId: polygon.Id, AreaJson: polygon.Polygon, TriggerLine: polygon.TriggerLine, DirectionLine: polygon.DirectionLine}
+		areaMap := structure.AreaMap{CameraId: cameraId, AreaId: polygon.Id,AreaJson: polygon.Polygon, TriggerLine: polygon.TriggerLine, DirectionLine: polygon.DirectionLine}
 		// 涓烘瘡涓憚鍍忔満鍖哄煙濉厖鏁版嵁
 		CountAreaObjs(&areaMap,arg)
 		arg.AreaMapList = append(arg.AreaMapList, &areaMap)
@@ -80,7 +82,6 @@
 		if err := recover(); err != nil {
 			logger.Info("瑙e寘杩囩▼鐨勫紓甯告崟鑾�", err.(string))
 		}
-
 	}()
 	// 鍙嶅簭鍒楀寲鏁版嵁寰楀埌sdk鍏ュ弬
 	m := protomsg.SdkMessage{}
@@ -135,7 +136,7 @@
 		logger.Info("--------------杩借釜涔嬪悗浜鸿劯鐨勪釜鏁帮細", len(faceParam.Faces))
 		for _, info := range faceParam.Faces {
 			//logger.Info("_______________________________________________绗竴娆$湅鐩镐技鍊硷細",info.Pos.FAngle.Confidence*100)
-			photoMap := structure.PhotoMap{structure.SourcePhoto{Id: strconv.Itoa(int(info.Pos.FaceID)) , Rects: rectFormat(info.Pos.RcFace), Score: float64(info.Pos.FAngle.Confidence * 100), Type: "face", ThftRes: *(info.Result), Feature: info.Feats},nil}
+			photoMap := structure.PhotoMap{structure.SourcePhoto{Id: strconv.Itoa(int(info.Pos.FaceID)) , Rects: rectFormat(info.Pos.RcFace), Score: float64(info.Pos.FAngle.Confidence * 100), Type: "face", ThftRes: *(info.Result), Feature: base64.StdEncoding.EncodeToString(info.Feats)},structure.SourcePhoto{}}
 			arg.Photo = append(arg.Photo, photoMap)
 		}
 		args.Sdkdata = append(args.Sdkdata, &arg)
@@ -162,7 +163,7 @@
 		for _, info := range yoloParam.Infos {
 			if info.Typ == 0 {
 				//logger.Debug("-------------yolo鐨勫潗鏍囨湁鍑犱釜",info.RcObj)
-				photoMap := structure.PhotoMap{structure.SourcePhoto{Rects: rectFormat(info.RcObj), Score: float64(info.Prob) * 100, Type: "yolo",Id:strconv.Itoa(int(info.ObjID))},nil}
+				photoMap := structure.PhotoMap{structure.SourcePhoto{Rects: rectFormat(info.RcObj), Score: float64(info.Prob) * 100, Type: "yolo",Id:strconv.Itoa(int(info.ObjID))},structure.SourcePhoto{}}
 				arg.Photo = append(arg.Photo, photoMap)
 				yoloNum++
 			}
@@ -193,7 +194,7 @@
 			logger.Info("鎺ユ敹杞︾墝鏁版嵁锛�",info.FvdConf,info.NVehicleColor1,info.NPlateFlag,info.RcCarLocation)
 			if info.NConfidence > 70 {
 				logger.Info("杞︾墝涔熺鍚堢殑鏁版嵁",info.FvdConf,info.NVehicleColor1,info.NPlateFlag,info.RcCarLocation,info.NConfidence,)
-				photoMap := structure.PhotoMap{structure.SourcePhoto{Id: info.License,Score: float64(info.FvdConf)*100,Rects: rectFormat(info.RcCarLocation), Type: "plate", Car:info},nil}
+				photoMap := structure.PhotoMap{structure.SourcePhoto{Id: info.License,Score: float64(info.FvdConf)*100,Rects: rectFormat(info.RcCarLocation), Type: "plate", Car:info},structure.SourcePhoto{}}
 				arg.Photo = append(arg.Photo, photoMap)
 			}
 		}
@@ -220,10 +221,9 @@
 			return
 		}
 		for _, info := range Track.Result {
-			logger.Info("鎺ユ敹璺熻釜鏁版嵁锛�",info.Id,info.Confidence)
-			photoMap := structure.PhotoMap{structure.SourcePhoto{Id: strconv.Itoa(int(info.Id)),Score: float64(info.Confidence)*100,Rects: rectFormat(info.RcHuman), Type: "track"},nil}
-			FacePush2Body(&photoMap,m.Tasklab.Sdkinfos)
-			logger.Info("缁勮鍚庣殑璺熻釜鏁版嵁锛�",photoMap)
+			logger.Info("鎺ユ敹璺熻釜鏁版嵁锛�",info.Id,info.Confidence,info.Feature)
+			b,_ := json.Marshal(info.Feature)
+			photoMap := structure.PhotoMap{structure.SourcePhoto{Id: strconv.Itoa(int(info.Id)),Score: float64(info.Confidence)*100,Rects: rectFormat(info.RcHuman), Type: "track",Feature: base64.StdEncoding.EncodeToString(b)},structure.SourcePhoto{}}
 			arg.Photo = append(arg.Photo, photoMap)
 		}
 		args.Sdkdata = append(args.Sdkdata, &arg)
@@ -246,7 +246,7 @@
 			for _, info := range faceParam.Faces {
 				percent := ruleserver.PgsInterPercent(Rect2Point(photomap.Rects),rectFormat(info.Pos.RcFace), 1, 1)
 				if percent > 99 {
-					photomap.AttachObj = structure.SourcePhoto{Id:strconv.Itoa(int(info.Pos.FaceID)),Rects: rectFormat(info.Pos.RcFace),Score: float64(info.Pos.FAngle.Confidence * 100), Type: "face", ThftRes: *(info.Result), Feature: info.Feats}
+					photomap.AttachObj = structure.SourcePhoto{Id:strconv.Itoa(int(info.Pos.FaceID)),Rects: rectFormat(info.Pos.RcFace),Score: float64(info.Pos.FAngle.Confidence * 100), Type: "face", ThftRes: *(info.Result), Feature: base64.StdEncoding.EncodeToString(info.Feats)}
 				}
 			}
 		}

--
Gitblit v1.8.0