| | |
| | | package compare |
| | | |
| | | import ( |
| | | "encoding/base64" |
| | | "fmt" |
| | | "strconv" |
| | | |
| | |
| | | if args.FaceFeature == nil { |
| | | return nil |
| | | } |
| | | |
| | | floatFeat := ByteSlice2float32Slice(args.FaceFeature) |
| | | |
| | | //指定最低分 |
| | | baseScore := thresholdLimit |
| | |
| | | if args.TreeNodes != nil && len(args.TreeNodes) > 0 { |
| | | for _, id := range args.TreeNodes { |
| | | if _, ok := cache.CacheMap.Area[id]; ok { |
| | | targets := cache.CacheMap.Area[id].Walk(DoSdkCompare, args.FaceFeature, baseScore) |
| | | targets := cache.CacheMap.Area[id].Walk(DoSdkCompare, floatFeat, baseScore) |
| | | if len(targets) > 0 { |
| | | scResult.CompareResult = append(scResult.CompareResult, targets...) |
| | | } |
| | |
| | | continue |
| | | } |
| | | |
| | | targets := val.Walk(DoSdkCompare, args.FaceFeature, baseScore) |
| | | targets := val.Walk(DoSdkCompare, floatFeat, baseScore) |
| | | if len(targets) > 0 { |
| | | scResult.CompareResult = append(scResult.CompareResult, targets...) |
| | | // todo 添加小区外的关联关系, 下次优先比对 |
| | |
| | | return buf |
| | | } |
| | | |
| | | func DoSdkCompare(ci []byte, co string) float32 { |
| | | co_d, err := base64.StdEncoding.DecodeString(co) |
| | | if err != nil { |
| | | logger.Error("DoSdkCompare err:", err) |
| | | return -1 |
| | | } |
| | | sec := DecCompare(ci, co_d) |
| | | func DoSdkCompare(ci, co []float32) float32 { |
| | | sec := DirectCompare(ci, co) |
| | | //logger.Debug("比对得分为:", sec) |
| | | |
| | | sec = ParseScore(sec) |