From 0dc2579fcb9bc8be589bdc23eeff9e25b24faa9f Mon Sep 17 00:00:00 2001
From: panlei <2799247126@qq.com>
Date: 星期五, 02 八月 2019 19:42:37 +0800
Subject: [PATCH] ---
---
ruleserver/readyDataForRule.go | 19 +++++++++++++------
1 files changed, 13 insertions(+), 6 deletions(-)
diff --git a/ruleserver/readyDataForRule.go b/ruleserver/readyDataForRule.go
index be06ef1..b405fc6 100644
--- a/ruleserver/readyDataForRule.go
+++ b/ruleserver/readyDataForRule.go
@@ -50,7 +50,7 @@
TableId string `json:"tableId"`
TableName string `json:"tableName"`
BwType string `json:"bwType"`
- CompareScore float64 `json:"compareScore"`
+ CompareScore float32 `json:"compareScore"`
PersonId string `json:"personId"`
PersonName string `json:"personName"`
PersonPicUrl string `json:"personPicUrl"`
@@ -70,6 +70,10 @@
if task.TaskId == taskId {
taskGroup = task
}
+ }
+ logger.Debug("褰撳墠鏁版嵁甯ц鍖归厤鐨勮鍒欑粍锛�-------------------------")
+ for _,ruleGroup := range taskGroup.GroupRules{
+ logger.Info(ruleGroup.GroupText)
}
return taskGroup
}
@@ -92,7 +96,10 @@
// float32涓巉loat64浜掕浆浼氭湁浣嶆暟淇濈暀涓嶅噯鐨勯棶棰�
return v
}
-
+func Decimal(value float32) float32 {
+ value1, _ := strconv.ParseFloat(fmt.Sprintf("%.4f", value), 32)
+ return float32(value1)
+}
// 鍙栧嚭鏌愪釜鏃堕棿瑙勫垯鐨勭鍑犲ぉ鐨勮鍒欐闆嗗悎
func GetTimeById(id string, index int) []TimeRange {
_, cameraTimeRule := cache.GetTimeRuleById(id)
@@ -172,14 +179,14 @@
for _, baseinfo := range baseinfos {
// 鏍规嵁tableId鏌ヨ搴曞簱淇℃伅缁檒iker璧嬪��
//logger.Info("---------鐪嬬湅姣忎釜搴曞簱浜哄憳鐨勪俊鎭細",baseinfo.Id,baseinfo.PersonName)
- var tableIds []string
+ tableIds := []string{}
tableIds = append(tableIds, baseinfo.TableId) // 铏界劧鏄紶鍏ユ暟缁勮繑鍥炴暟缁勭殑鎺ュ彛锛屼絾鎴戞寜鍗曚釜鐨勪娇鐢ㄤ簡
table, err := esutil.Dbtablefosbyid(tableIds, "dbtables", serverIp, serverPort)
if err != nil || len(table) == 0 {
logger.Error("鏍规嵁id鏌ヨ搴曞簱淇℃伅鍑洪敊锛�", err, "--杩斿洖鍊奸暱搴︿负锛�", len(table))
}
- logger.Debug("鐪嬬湅杩欎釜base鐨勫姣斿�兼槸澶氬皯锛�",Retain(m[baseinfo.Id]) * 100)
- base := BaseInfo{TableId: baseinfo.TableId, TableName: table[0].TableName, BwType: table[0].BwType, CompareScore: Retain(m[baseinfo.Id]) * 100, PersonId: baseinfo.Id, PersonName: baseinfo.PersonName, PersonPicUrl: baseinfo.PersonPicUrl, PhoneNum: baseinfo.PhoneNum, Sex: baseinfo.Sex, IdCard: baseinfo.IdCard, MonitorLevel: baseinfo.MonitorLevel, Content: baseinfo.Reserved}
+ logger.Debug("鐪嬬湅杩欎釜base鐨勫姣斿�兼槸澶氬皯锛�", Decimal(m[baseinfo.Id]) * 100)
+ base := BaseInfo{TableId: baseinfo.TableId, TableName: table[0].TableName, BwType: table[0].BwType, CompareScore: Decimal(m[baseinfo.Id]) * 100, PersonId: baseinfo.Id, PersonName: baseinfo.PersonName, PersonPicUrl: baseinfo.PersonPicUrl, PhoneNum: baseinfo.PhoneNum, Sex: baseinfo.Sex, IdCard: baseinfo.IdCard, MonitorLevel: baseinfo.MonitorLevel, Content: baseinfo.Reserved}
//os.Exit(1)
arg.Liker = append(arg.Liker, &base)
}
@@ -264,7 +271,7 @@
if threshold <= obj.Score && size <= float64(obj.Rects.Width*obj.Rects.Height) && intersectionper <= PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale) {
// 杩欐瑕佸榻愯〃杈惧紡閲屾墍闇�瑕佺殑鎵�鏈夊弬鏁�
a.targetNum++
- arg1 := Arg{obj.Score, PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale), float64(obj.Rects.Width * obj.Rects.Height), obj.IsYolo, obj.Rects, obj.Feature, obj.ThftRes, []*BaseInfo{}}
+ arg1 := Arg{obj.Id,obj.Score, PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale), float64(obj.Rects.Width * obj.Rects.Height), obj.IsYolo, obj.Rects, obj.Feature, obj.ThftRes, []*BaseInfo{}}
//logger.Println("鏀捐繘鍘荤殑arg锛�-------", arg1)
a.args = append(a.args, &arg1)
a.filterData = append(a.filterData, &arg1)
--
Gitblit v1.8.0