zhangmeng
2019-12-19 33a6b067fd5af5f3afc3576243103968fd1bac20
dupate
1个文件已修改
20 ■■■■■ 已修改文件
work/sdk/humantrack.go 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
work/sdk/humantrack.go
@@ -52,10 +52,7 @@
// Init impl
func (t *HumanTracker) Init() bool {
    if t.batchSize != 1 {
        logo.Errorln("ONLY SUPPORT BATCH SIZE = 1")
        return false
    }
    gpu := t.gpu
    if gpu == -1 {
@@ -129,8 +126,10 @@
    // mapCameraImageIndex map[string]int
    // images              []gohumantrack.ImageHumanTracker
    t.recvImageCount++
    if t.mapCameraImageIndex == nil {
        t.recvImageCount = 0
        t.index = 0
        t.mapCameraImageIndex = make(map[string]int)
        for i := 0; i < t.batchSize; i++ {
            t.images[i] = nil
@@ -139,6 +138,9 @@
            t.msgs[i] = nil
        }
    }
    t.recvImageCount++
    if i, ok := t.mapCameraImageIndex[rMsg.Msg.Cid]; ok {
        if i < t.batchSize {
            t.images[i] = &img
@@ -153,13 +155,15 @@
        t.index++
    }
    if t.recvImageCount < t.batchSize+t.batchSize/2 {
        logo.Infoln("batch~~~~~~Current Index: ", t.index)
        return
    }
    res, err := t.tracker.ProcessImagePointer(t.images[:])
    t.mapCameraImageIndex = nil
    if err != nil {
        t.mapCameraImageIndex = nil
        logo.Infoln("batch~~~~~~Track Failed: ", err)
        ejectResult(nil, rMsg, out)
        return
    }
@@ -172,7 +176,7 @@
        result := protomsg.HumanTrackResult{Result: hr}
        data, err := proto.Marshal(&result)
        if err != nil {
            logo.Errorln("HUMAN TRACKER MARSHAL PROTO PLATE IDS ERROR", err)
            logo.Errorln("batch~~~~~~HUMAN TRACKER MARSHAL PROTO PLATE IDS ERROR", err)
            data = nil
        }
        msg := *t.msgs[i]
@@ -181,7 +185,7 @@
        if msg.Msg.Tasklab != nil {
            id, name = msg.Msg.Tasklab.Taskid, msg.Msg.Tasklab.Taskname
        }
        logo.Infoln("CAMERAID: ", msg.Msg.Cid, " TASKID: ", id, " TASKNAME: ", name, " Human Track COUNT: ", len(hr))
        logo.Infoln("batch~~~~~~CAMERAID: ", msg.Msg.Cid, " TASKID: ", id, " TASKNAME: ", name, " Human Track COUNT: ", len(hr))
    }