From 33a6b067fd5af5f3afc3576243103968fd1bac20 Mon Sep 17 00:00:00 2001
From: zhangmeng <775834166@qq.com>
Date: 星期四, 19 十二月 2019 13:59:23 +0800
Subject: [PATCH] dupate
---
work/sdk/humantrack.go | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
diff --git a/work/sdk/humantrack.go b/work/sdk/humantrack.go
index 209952e..dae08ae 100644
--- a/work/sdk/humantrack.go
+++ b/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))
}
--
Gitblit v1.8.0