| | |
| | | "sync" |
| | | "encoding/base64" |
| | | |
| | | "encoding/json" |
| | | |
| | | "basic.com/pubsub/cache.git/esutil" |
| | | "basic.com/pubsub/cache.git/shardmap" |
| | | "test/cache/esutil" |
| | | "test/cache/shardmap" |
| | | |
| | | "basic.com/valib/gosdk.git" |
| | | ) |
| | |
| | | |
| | | type CmapItem struct { |
| | | sync.Mutex |
| | | cam map[string]*shardmap.ShardMap |
| | | Cam map[string]*shardmap.ShardMap |
| | | } |
| | | |
| | | var Cmap *CmapItem |
| | |
| | | gosdk.InitFaceExtractor(16, 0) |
| | | |
| | | Cmap = &CmapItem{ |
| | | cam: make(map[string]*shardmap.ShardMap), |
| | | Cam: make(map[string]*shardmap.ShardMap), |
| | | } |
| | | |
| | | temptime := time.Now() |
| | |
| | | Cmap.Lock() |
| | | |
| | | for _, value := range escache{ |
| | | if _, ok :=Cmap.cam[value.Tableid]; !ok { |
| | | Cmap.cam[value.Tableid]=shardmap.New(uint8(*threadnum)) |
| | | if _, ok :=Cmap.Cam[value.Tableid]; !ok { |
| | | Cmap.Cam[value.Tableid]=shardmap.New(uint8(*threadnum)) |
| | | } |
| | | |
| | | Cmap.cam[value.Tableid].Set(value.Id,value.FaceFeature) |
| | | Cmap.Cam[value.Tableid].Set(value.Id,value.FaceFeature) |
| | | } |
| | | |
| | | Cmap.Unlock() |
| | |
| | | fmt.Println() |
| | | } |
| | | |
| | | func Getdbpersonmsg(tableid string, teststring []byte, IsCompare bool) (map[string]float32) { |
| | | func Getdbpersonmsg(tableid string, teststring []byte, IsCompare bool) ([]byte) { |
| | | |
| | | totalmap := make(map[string]float32) |
| | | |
| | |
| | | } |
| | | |
| | | if tableid == "" { |
| | | for id, val := range Cmap.cam{ |
| | | for id, val := range Cmap.Cam{ |
| | | fmt.Println("the id is: ", id) |
| | | tmpmap := val.Walk(Printest, teststring) |
| | | for key, sec := range tmpmap { |
| | |
| | | } |
| | | } |
| | | }else{ |
| | | for id, value := range Cmap.cam{ |
| | | for id, value := range Cmap.Cam{ |
| | | if id == tableid{ |
| | | fmt.Println("the id is: ", id) |
| | | tmpmap :=value.Walk(Printest, teststring) |
| | |
| | | } |
| | | } |
| | | |
| | | fmt.Println() |
| | | fmt.Println() |
| | | |
| | | firsttime := time.Now() |
| | | fmt.Println(time.Since(firsttime)) |
| | | return totalmap |
| | | |
| | | buf, err := json.Marshal(totalmap) |
| | | if err != nil { |
| | | fmt.Println("map to json error!", err) |
| | | return nil |
| | | } |
| | | return buf |
| | | } |
| | | |
| | | func Printest(ci []byte, co string ) (float32){ |