From b4f22e68212f45aa685e27b2e83be5f82b3a8a3f Mon Sep 17 00:00:00 2001 From: zhangmeng <775834166@qq.com> Date: 星期三, 11 十二月 2019 17:00:27 +0800 Subject: [PATCH] copy from VAProcess --- work/sdk/facetrack.go | 11 +---- /dev/null | 4 -- proc/sdk.go | 1 proc/proc.go | 1 work/sdk/plateIDdetect.go | 9 ---- work/sdk/yolotrack.go | 11 +---- work/ipcsender.go | 24 +----------- work/ipcreciever.go | 4 +- runtime/libdarknet.so | 0 9 files changed, 12 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md deleted file mode 100644 index 5504906..0000000 --- a/README.md +++ /dev/null @@ -1,4 +0,0 @@ -## analysis - -analysis copy from vaprocess, it will stop - diff --git a/proc/proc.go b/proc/proc.go index 0d719b7..fa2f4ec 100644 --- a/proc/proc.go +++ b/proc/proc.go @@ -36,6 +36,7 @@ ) func prepare(name string, gpu int) (string, bool) { + return initSDK(name, gpu) } diff --git a/proc/sdk.go b/proc/sdk.go index a31fc1a..cf6aa42 100644 --- a/proc/sdk.go +++ b/proc/sdk.go @@ -16,6 +16,7 @@ os.Exit(130) return nil, false } + thrds := threads if thrds > sdk.MaxFaceDetectThreadNum { thrds = sdk.MaxFaceDetectThreadNum diff --git a/runtime/libdarknet.so b/runtime/libdarknet.so index ebe5b21..ac55e00 100755 --- a/runtime/libdarknet.so +++ b/runtime/libdarknet.so Binary files differ diff --git a/work/ipcreciever.go b/work/ipcreciever.go index 28802e7..d6fa105 100644 --- a/work/ipcreciever.go +++ b/work/ipcreciever.go @@ -86,7 +86,7 @@ logo.Infoln("ANALYSIS CREATE SHM") } else { if d != nil { - logo.Infoln("~~~~~~shm recv image:", len(d)) + logo.Infoln("~~~shm recv image:", len(d)) dataChan <- d } } @@ -94,7 +94,7 @@ if msg, err := i.Recv(); err != nil { // logo.Errorln("recv error : ", err, " url: ", r.ipcURL) } else { - logo.Infoln("~~~~~~mangos recv image:", len(msg)) + logo.Infoln("~~~mangos recv image:", len(msg)) dataChan <- msg } } diff --git a/work/ipcsender.go b/work/ipcsender.go index b136fc9..e77d187 100644 --- a/work/ipcsender.go +++ b/work/ipcsender.go @@ -1,7 +1,6 @@ package work import ( - "analysis/goconv" "analysis/logo" "context" @@ -80,26 +79,7 @@ if int(i.Msg.Tasklab.Index+1) == len(i.Msg.Tasklab.Sdkinfos) { if s.fn != nil { - imgInfo := unpackImage(i, "sender") - if imgInfo.Data == nil { - continue - } - imgProto := protomsg.Image{ - Data: goconv.YUV2BGR(imgInfo.Data, int(imgInfo.Width), int(imgInfo.Height)), - Width: int32(imgInfo.Width), - Height: int32(imgInfo.Height), - Timestamp: imgInfo.Timestamp, - Id: imgInfo.Id, - Cid: imgInfo.Cid, - } - var sendData []byte - if b, err := proto.Marshal(&imgProto); err == nil { - i.Msg.Data = b - sendData, err = proto.Marshal(&i.Msg) - if err != nil { - continue - } - } + sFlag := true for _, v := range i.Msg.Tasklab.Sdkinfos { if len(v.Sdkdata) < 2 { @@ -107,7 +87,7 @@ break } } - s.fn(sendData, sFlag) + s.fn(d, sFlag) } } diff --git a/work/sdk/facetrack.go b/work/sdk/facetrack.go index dc45d2c..13e4543 100644 --- a/work/sdk/facetrack.go +++ b/work/sdk/facetrack.go @@ -30,7 +30,6 @@ */ import "C" import ( - "analysis/goconv" "analysis/logo" "analysis/work" "context" @@ -156,8 +155,8 @@ for { select { case <-ctx.Done(): - goconv.Free() return + case rMsg := <-in: if !validRemoteMessage(rMsg, typ) { @@ -175,12 +174,8 @@ // conv to bgr24 and resize imgW, imgH := int(i.Width), int(i.Height) - bgrData := goconv.YUV2BGR(i.Data, imgW, imgH) - if bgrData == nil { - ejectResult(nil, rMsg, out) - continue - } - img := gosdk.SDKImage{Data: bgrData, Width: imgW, Height: imgH} + + img := gosdk.SDKImage{Data: i.Data, Width: imgW, Height: imgH} detect := gosdk.FaceTrackSimple(img, dtchn) diff --git a/work/sdk/plateIDdetect.go b/work/sdk/plateIDdetect.go index 08234d0..3c355be 100644 --- a/work/sdk/plateIDdetect.go +++ b/work/sdk/plateIDdetect.go @@ -1,7 +1,6 @@ package sdk import ( - "analysis/goconv" "analysis/logo" "analysis/work" "context" @@ -98,7 +97,6 @@ for { select { case <-ctx.Done(): - goconv.Free() return default: rMsg := <-in @@ -114,12 +112,7 @@ } imgW, imgH := int(i.Width), int(i.Height) - bgrData := goconv.YUV2BGR(i.Data, imgW, imgH) - if bgrData == nil { - ejectResult(nil, rMsg, out) - continue - } - img := gosdk.SDKImage{Data: bgrData, Width: imgW, Height: imgH} + img := gosdk.SDKImage{Data: i.Data, Width: imgW, Height: imgH} rcDetect := gosdk.CRECT{ Left: 0, diff --git a/work/sdk/yolotrack.go b/work/sdk/yolotrack.go index a4d309f..5f864cf 100644 --- a/work/sdk/yolotrack.go +++ b/work/sdk/yolotrack.go @@ -1,7 +1,6 @@ package sdk import ( - "analysis/goconv" "analysis/logo" "analysis/work" "context" @@ -54,7 +53,6 @@ for { select { case <-ctx.Done(): - goconv.Free() return default: @@ -100,12 +98,8 @@ // conv to bgr24 and resize imgW, imgH := int(i.Width), int(i.Height) - bgrData := goconv.YUV2BGR(i.Data, imgW, imgH) - if bgrData == nil { - ejectResult(nil, rMsg, out) - return - } - img := gosdk.SDKImage{Data: bgrData, Width: imgW, Height: imgH} + + img := gosdk.SDKImage{Data: i.Data, Width: imgW, Height: imgH} v, ok := y.tracker[rMsg.Msg.Cid] if !ok { @@ -152,7 +146,6 @@ id, name = rMsg.Msg.Tasklab.Taskid, rMsg.Msg.Tasklab.Taskname } logo.Infoln("CAMERAID: ", rMsg.Msg.Cid, " TASKID: ", id, " TASKNAME: ", name, " DETECT YOLO COUNT: ", len(allO)) - } func convert2ProtoYoloTrack(obj []gosdk.CObjTrackInfo, fx, fy float64) []*protomsg.ObjInfo { -- Gitblit v1.8.0