| | |
| | | |
| | | import ( |
| | | "fmt" |
| | | "sdkCompare/util" |
| | | "strconv" |
| | | |
| | | "sdkCompare/cache" |
| | |
| | | return nil |
| | | } |
| | | |
| | | floatFeat := ByteSlice2float32Slice(args.FaceFeature) |
| | | floatFeat := util.ByteSlice2float32Slice(args.FaceFeature) |
| | | |
| | | //指定最低分 |
| | | baseScore := thresholdLimit |
| | |
| | | if _, ok := cache.CacheMap.Area[id]; ok { |
| | | targets := cache.CacheMap.Area[id].Walk(DoSdkCompare, floatFeat, baseScore) |
| | | if len(targets) > 0 { |
| | | scResult.CompareResult = append(scResult.CompareResult, targets...) |
| | | // 比对结果去重, 同一个人到访过多个小区, 缓存数据内会有多条记录 |
| | | for idx, t := range targets { |
| | | var isRepeat bool |
| | | for _, r := range scResult.CompareResult { |
| | | if t.Id == r.Id { |
| | | isRepeat = true |
| | | break |
| | | } |
| | | } |
| | | if !isRepeat { |
| | | scResult.CompareResult = append(scResult.CompareResult, targets[idx]) |
| | | } |
| | | } |
| | | } |
| | | |
| | | walkedArea[id] = struct{}{} |
| | |
| | | |
| | | targets := val.Walk(DoSdkCompare, floatFeat, baseScore) |
| | | if len(targets) > 0 { |
| | | scResult.CompareResult = append(scResult.CompareResult, targets...) |
| | | if len(targets) > 0 { |
| | | // 比对结果去重, 同一个人到访过多个小区, 缓存数据内会有多条记录 |
| | | for idx, t := range targets { |
| | | var isRepeat bool |
| | | for _, r := range scResult.CompareResult { |
| | | if t.Id == r.Id { |
| | | isRepeat = true |
| | | break |
| | | } |
| | | } |
| | | if !isRepeat { |
| | | scResult.CompareResult = append(scResult.CompareResult, targets[idx]) |
| | | } |
| | | } |
| | | } |
| | | // todo 添加小区外的关联关系, 下次优先比对 |
| | | } |
| | | } |
| | | |
| | | done: |
| | | logger.Debugf("比对结果 %d条", len(scResult.CompareResult)) |
| | | if len(scResult.CompareResult) > 0 { |
| | | logger.Debugf("比对结果%+v", scResult.CompareResult) |
| | | } |
| | | |
| | | buf, err := proto.Marshal(&scResult) |
| | | if err != nil { |
| | | logger.Error("scResult Marshal error!", err) |