From 5d8d13cb8324b63f1f0e4cc14a90b90f4b930679 Mon Sep 17 00:00:00 2001 From: Dimitrii Date: Wed, 12 Aug 2020 14:18:28 +0300 Subject: [PATCH] update gRPC --- cmd/client/main.go | 11 ++++++++--- cmd/server/main.go | 10 +++++----- go.mod | 2 +- go.sum | 4 ++++ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/cmd/client/main.go b/cmd/client/main.go index ea942a6..652cb87 100644 --- a/cmd/client/main.go +++ b/cmd/client/main.go @@ -7,11 +7,12 @@ import ( "fmt" "image" "image/jpeg" - engine "license_plate_recognition" "log" "os" "time" + engine "github.com/LdDl/odam" + "google.golang.org/grpc" ) @@ -61,17 +62,21 @@ func main() { defer conn.Close() // Init gRPC client - client := engine.NewSTYoloClient(conn) + client := engine.NewServiceYOLOClient(conn) ctx, cancel := context.WithTimeout(context.Background(), time.Minute) defer cancel() // Send message to gRPC server r, err := client.SendDetection( ctx, - &engine.CamInfo{ + &engine.ObjectInformation{ CamId: "my_new_uuid", Timestamp: time.Now().Unix(), Image: sendS3, + Class: &engine.ClassInfo{ + ClassId: 100, + ClassName: "find_ocr", + }, Detection: &engine.Detection{ XLeft: int32(*xConfig), YTop: int32(*yConfig), diff --git a/cmd/server/main.go b/cmd/server/main.go index 6450eac..5dd6844 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -70,7 +70,7 @@ func main() { grpcInstance := grpc.NewServer() // Register servers - grpc_server.RegisterSTYoloServer( + grpc_server.RegisterServiceYOLOServer( grpcInstance, rs, ) @@ -83,9 +83,9 @@ func main() { } -// RecognitionServer Wrapper around engine.STYoloServer +// RecognitionServer Wrapper around engine.ServiceYOLOServer type RecognitionServer struct { - grpc_server.STYoloServer + grpc_server.ServiceYOLOServer netW *engine.YOLONetwork framesQueue chan *vehicleInfo maxLen int @@ -165,12 +165,12 @@ func (rs *RecognitionServer) SendToQueue(n *vehicleInfo) { } type vehicleInfo struct { - imageInfo *grpc_server.CamInfo + imageInfo *grpc_server.ObjectInformation img *image.NRGBA } // SendDetection Imeplented function or accepting image -func (rs *RecognitionServer) SendDetection(ctx context.Context, in *grpc_server.CamInfo) (*grpc_server.Response, error) { +func (rs *RecognitionServer) SendDetection(ctx context.Context, in *grpc_server.ObjectInformation) (*grpc_server.Response, error) { imgBytes := in.GetImage() imgReader := bytes.NewReader(imgBytes) diff --git a/go.mod b/go.mod index 8e636dd..cc3b68e 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.14 require ( github.com/LdDl/go-darknet v1.1.0 github.com/LdDl/gocv-blob v1.0.1 // indirect - github.com/LdDl/odam v0.3.1 + github.com/LdDl/odam v0.4.1 github.com/disintegration/imaging v1.6.2 github.com/satori/go.uuid v1.2.0 // indirect gocv.io/x/gocv v0.23.0 // indirect diff --git a/go.sum b/go.sum index 6514ec3..8793771 100644 --- a/go.sum +++ b/go.sum @@ -12,6 +12,10 @@ github.com/LdDl/odam v0.3.0 h1:+FChOURz8GILnpdbfAsuaLfpMMizurVw3QE3zvWJSls= github.com/LdDl/odam v0.3.0/go.mod h1:Ah61oMuI+U8SkS1ihRGd9Ngb7boy1PHC418/UKS+coA= github.com/LdDl/odam v0.3.1 h1:PfCjcoTYzQM3T3wyfwEhu+1BEyXUAs2wx9hScRgB7wM= github.com/LdDl/odam v0.3.1/go.mod h1:Ah61oMuI+U8SkS1ihRGd9Ngb7boy1PHC418/UKS+coA= +github.com/LdDl/odam v0.4.0 h1:Ue7/2Cc01E5Yi7AoVsH936wgKOOmrMdSyBp7qh8E8U8= +github.com/LdDl/odam v0.4.0/go.mod h1:Ah61oMuI+U8SkS1ihRGd9Ngb7boy1PHC418/UKS+coA= +github.com/LdDl/odam v0.4.1 h1:MWxRZp58A6/Xf+w7/5lc5t4RTdBQqJkkWYusF7GrjCo= +github.com/LdDl/odam v0.4.1/go.mod h1:K1STBUV4Wg2fqfpfepSWE+ucdiW5FQH5Z3RMWp1G9Io= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=