From 7850c0b26dc32f1ccad56b705bb3bbfc0dcc883a Mon Sep 17 00:00:00 2001
From: panlei <2799247126@qq.com>
Date: 星期二, 19 十一月 2019 10:19:19 +0800
Subject: [PATCH] ---
---
ruleserver/readyDataForRule.go | 37 +++++--------------------------------
1 files changed, 5 insertions(+), 32 deletions(-)
diff --git a/ruleserver/readyDataForRule.go b/ruleserver/readyDataForRule.go
index 576a95a..033a2b3 100644
--- a/ruleserver/readyDataForRule.go
+++ b/ruleserver/readyDataForRule.go
@@ -8,6 +8,7 @@
"errors"
"fmt"
"github.com/golang/protobuf/proto"
+ uuid "github.com/satori/go.uuid"
"math"
"nanomsg.org/go-mangos"
"nanomsg.org/go-mangos/protocol/req"
@@ -92,35 +93,6 @@
//logger.Info("鍒濇淇濈暀涓や綅鎴恠tr::::",value2)
return value2
}
-// 鍙栧嚭鏌愪釜鏃堕棿瑙勫垯鐨勭鍑犲ぉ鐨勮鍒欐闆嗗悎
-func GetTimeById(id string, index int) []structure.TimeRange {
- _, cameraTimeRule := cache.GetTimeRuleById(id)
- var timeRangeList []structure.Day
- err := json.Unmarshal([]byte(cameraTimeRule.TimeRule), &timeRangeList)
- if err != nil {
- logger.Error("鍙栨椂闂磋鍒欐椂鍙嶅簭鍒楀寲閿欒锛�")
- }
- for _, timerange := range timeRangeList {
- if timerange.Day == index {
- //logger.Println("鍙栧埌鐨勬椂闂磋鍒欙細", timerange.TimeRange)
- return timerange.TimeRange
- }
- }
- return nil
-}
-
-// 鏍规嵁浼犲叆鐨勫瓧绗︿覆寰楀埌鍏跺湪涓�鍛ㄥ唴鐨勭储寮� 鍛ㄤ竴鍒板懆鏃ュ垎鍒搴�1鍒�7
-func getIndexOfWeek(weekday string) int {
- var weekdays = [7]string{"Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"}
- for k, value := range weekdays {
- if value == weekday {
- return k + 1 // 鍥犱负鏁版嵁搴撲腑瀛樼殑鏄�1-7浠h〃鐨勫懆涓�鍒板懆鏃�
- }
- }
- return 0
-}
-
-
// 灏嗗瓧绗︿覆鏍煎紡鐨勫潗鏍囧簭鍒楀寲涓篜oint鏍煎紡
func Json2points(areaPoints string) []structure.Point {
@@ -186,7 +158,7 @@
logger.Error("鏍规嵁id鏌ヨ搴曞簱淇℃伅鍑洪敊锛�", err, "--杩斿洖鍊奸暱搴︿负锛�", len(table))
}
logger.Debug("鐪嬬湅杩欎釜base鐨勫姣斿�兼槸澶氬皯锛�", Decimal(m[baseinfo.Id].CompareScore))
- base := structure.BaseInfo{TableId: baseinfo.TableId, TableName: table[0].TableName, BwType: table[0].BwType, CompareScore: Decimal(m[baseinfo.Id].CompareScore), PersonId: baseinfo.Id, PersonName: baseinfo.PersonName, PersonPicUrl: baseinfo.PersonPicUrl, PhoneNum: baseinfo.PhoneNum, Sex: baseinfo.Sex, IdCard: baseinfo.IdCard, MonitorLevel: baseinfo.MonitorLevel, Content: baseinfo.Reserved}
+ base := structure.BaseInfo{TableId: baseinfo.TableId, TableName: table[0].TableName, BwType: table[0].BwType, CompareScore: Decimal(m[baseinfo.Id].CompareScore), TargetId: baseinfo.Id, TargetName: baseinfo.PersonName, TargetPicUrl: baseinfo.PersonPicUrl, MonitorLevel: baseinfo.MonitorLevel, Content: baseinfo.Reserved,DbLabel: baseinfo.PhoneNum+"/"+baseinfo.Sex+"/"+baseinfo.IdCard,}
//os.Exit(1)
arg.Liker = append(arg.Liker, &base)
}
@@ -261,7 +233,7 @@
a.TargetNum = 0
threshold := 80.0 // 鐩镐技搴�
- intersectionper := 0.2 // 鍗犳瘮
+ intersectionper := 20.0 // 鍗犳瘮
size := 0.0 // 灏哄
areaPoints := Json2points(a.AreaJson)
@@ -273,7 +245,8 @@
if obj.Score >= threshold && float64(obj.Rects.Width*obj.Rects.Height) >= size && PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale) >= intersectionper {
// 杩欐瑕佸榻愯〃杈惧紡閲屾墍闇�瑕佺殑鎵�鏈夊弬鏁�
a.TargetNum++
- arg1 := structure.Arg{obj.Id,obj.Score, PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale), float64(obj.Rects.Width * obj.Rects.Height), a.AreaJson,obj.IsYolo, obj.Rects, obj.Feature, obj.ThftRes, []*structure.BaseInfo{},nil}
+ uuid := uuid.NewV4().String()
+ arg1 := structure.Arg{obj.Id,uuid,obj.Score, PgsInterPercent(areaPoints, obj.Rects, widthScale, heigthScale), float64(obj.Rects.Width * obj.Rects.Height), a.AreaJson,obj.Type, obj.Rects, obj.Car,obj.Feature, obj.ThftRes, []*structure.BaseInfo{},"",structure.ResultMsg{}}
//logger.Println("鏀捐繘鍘荤殑arg锛�-------", arg1)
a.Args = append(a.Args, &arg1)
a.FilterData = append(a.FilterData, &arg1)
--
Gitblit v1.8.0