| | |
| | | package ruleserver |
| | | |
| | | import ( |
| | | "basic.com/pubsub/cache.git/esutil" |
| | | bigCache "basic.com/pubsub/cache.git" |
| | | "basic.com/pubsub/cache.git/esutil" |
| | | "basic.com/pubsub/protomsg.git" |
| | | "encoding/json" |
| | | "fmt" |
| | |
| | | if err != nil || len(table) == 0{ |
| | | logger.Error("根据id查询底库信息出错!",err,"--返回值长度为:",len(table)) |
| | | } |
| | | base := BaseInfo{TableId:baseinfo.TableId,TableName:table[0].TableName,BwType:table[0].BwType,CompareScore:Retain(m[baseinfo.Id]),PersonId:baseinfo.Id,PersonName:baseinfo.PersonName,PersonPicUrl:baseinfo.PersonPicUrl,PhoneNum:baseinfo.PhoneNum,Sex:baseinfo.Sex,MonitorLevel:baseinfo.MonitorLevel,Content:""} |
| | | 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的对比值是多少:",base) |
| | | //os.Exit(1) |
| | | arg.Liker = append(arg.Liker, &base) |
| | |
| | | func Compare(args *SdkDatas, groupRule *protomsg.GroupRule) { |
| | | compareFlag := 0 |
| | | var tableIds []string |
| | | var threshold float32 = 0.2 |
| | | var threshold float32 = 0.5 // 默认阈值为0.5 |
| | | // 看看是否有只配人脸比对算法但没有配对比库的规则,如果有,则比对对象为全部底库 |
| | | for j := 0; j < len(groupRule.Rules); j++ { |
| | | if groupRule.Rules[j].SdkId == "812b674b-2375-4589-919a-5c1c3278a972" { // 配了人脸比对 |
| | | if groupRule.Rules[j].SdkArgAlias == "compareBase" && groupRule.Rules[j].SdkArgValue != "" { // 配了比对底库的参数但没有配全部底库 |
| | | if groupRule.Rules[j].SdkArgAlias == "compareBase" && groupRule.Rules[j].SdkArgValue != "" { // 配了比对底库的参数但不是配的全部底库 |
| | | compareFlag = 2 |
| | | tableIds = append(tableIds,groupRule.Rules[j].SdkArgValue)// 最后会多一个tableId,切出来的数组取len-1就可以 |
| | | } |
| | |
| | | //compareFlag = 1 |
| | | if compareFlag == 0 { |
| | | logger.Info("没有配置对比底库参数") |
| | | //return |
| | | return |
| | | } |
| | | logger.Debug("=====配置的阈值为:",threshold) |
| | | for j := 0; j < len(groupRule.Rules); j++ { |
| | |
| | | } |
| | | } |
| | | } |
| | | return // 比完一次就出去,防止再比第二遍造成重复,因为确实可以有两个人脸比对的小规则,一个底库,一个阈值 |
| | | } |
| | | } |
| | | } |