add ipc run as server or not
| | |
| | | ) |
| | | |
| | | // RunYoloFromIPC recv data from ipc |
| | | func RunYoloFromIPC(ipcURL string) { |
| | | func RunYoloFromIPC(ipcURL string, asServer bool) { |
| | | imageChan := make(chan srv.ImageInfo) |
| | | |
| | | d := srv.NewReciever(ipcURL, imageChan) |
| | | go d.Run() |
| | | go d.Run(asServer) |
| | | |
| | | cfg := "./data/yolo/cfg/yolov3.cfg" |
| | | weights := "./data/yolo/yolov3.weights" |
| | |
| | | package main |
| | | |
| | | import ( |
| | | "analysis/demo" |
| | | "flag" |
| | | "fmt" |
| | | // "videoServer/demo" |
| | | ) |
| | | |
| | | var ( |
| | |
| | | // demo.Yolo(streamURL) |
| | | // demo.CVDraw() |
| | | |
| | | // demo.RunYoloFromIPC(ipcURL) |
| | | demo.RunYoloFromIPC(ipcURL, false) |
| | | |
| | | fakeStartProc() |
| | | } |
| | |
| | | imageChan := make(chan service.ImageInfo) |
| | | |
| | | d := service.NewReciever(ipcURL, imageChan) |
| | | go d.Run() |
| | | go d.Run(false) |
| | | |
| | | if proc == "" { |
| | | d.Stop() |
| | |
| | | Subproject commit 66d8e6695ada4090bdb81279d594f323be875bc7 |
| | | Subproject commit 8841f9d2154a8e0653d30fdc04bde8a772665c8c |
| | |
| | | } |
| | | |
| | | // Run run task from ipc data |
| | | func (r *Reciever) Run() { |
| | | ipc := ipc.NewClient(r.ctxIPC.ctx, r.ipcURL) |
| | | func (r *Reciever) Run(asServer bool) { |
| | | var i *ipc.IPC |
| | | if asServer { |
| | | i = ipc.NewServer(r.ctxIPC.ctx, r.ipcURL) |
| | | } else { |
| | | i = ipc.NewClient(r.ctxIPC.ctx, r.ipcURL) |
| | | } |
| | | |
| | | dataChan := make(chan []byte) |
| | | go unserilizeImageInfo(dataChan, r.chImage) |
| | | |
| | | ipc.RecvToChannel(dataChan) |
| | | i.RecvToChannel(dataChan) |
| | | } |
| | | |
| | | // Stop stop reciever, run in goroutine |