| | |
| | | handle *ReID |
| | | fnLogger func(...interface{}) |
| | | |
| | | gpu int |
| | | ipc string |
| | | } |
| | | |
| | |
| | | if rGPU == -1 { |
| | | rGPU = gogpu.ValidGPU(gpuM + 512) |
| | | } |
| | | if rGPU == -1 { |
| | | fn("Reid SDK Create Error When Find GPU") |
| | | return nil |
| | | } |
| | | |
| | | handle := NewSDK(rGPU, cfg.Param[sModel]) |
| | | if handle == nil { |
| | |
| | | handle: handle, |
| | | fnLogger: fn, |
| | | |
| | | gpu: rGPU, |
| | | ipc: cfg.Param[sIPC], |
| | | } |
| | | } |
| | |
| | | |
| | | feat := s.handle.Extract2(unsafe.Pointer(&i.Data[0]), int(i.Width), int(i.Height), 3) |
| | | if feat == nil { |
| | | feat = make([]float32, 1) |
| | | // feat = make([]float32, 1) |
| | | } else { |
| | | for k := 0; k < 3; k++ { |
| | | s.fnLogger("REID~~~~~~extractor---human_feats------%f", feat[k+2000]) |
| | | } |
| | | s.fnLogger("REID~~~~~~Run Reid Use GPU: ", s.gpu) |
| | | } |
| | | buf := float32SliceAsByteSlice(feat) |
| | | c.Send(buf) |
| | |
| | | |
| | | l := len(src) * 4 |
| | | ptr := unsafe.Pointer(&src[0]) |
| | | // It is important to keep in mind that the Go garbage collector |
| | | // will not interact with this data, and that if src if freed, |
| | | // the behavior of any Go code using the slice is nondeterministic. |
| | | // Reference: https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices |
| | | return (*[1 << 26]byte)((*[1 << 26]byte)(ptr))[:l:l] |
| | | } |