I need to pass an image (numpy array), additional meta-information about the image like height, width, etc. from the python grpc client to python grpc server.
I need to run this method.
import numpy as np
def predict(img, w, h):
# some operations
return img.shape[2], np.mean(img)
I looked into the documentation, but there is no compatible datatype for numpy array in protobuf.
https://developers.google.com/protocol-buffers/docs/proto3
image_procedure.proto
syntax = "proto3";
// input image, width, height
message Image {
image_type image = 1;
int32 width = 2;
int32 height = 3;
}
// output prediction
message Prediction {
int32 channel = 4;
float mean = 5;
}
// service
service ImageProcedure {
rpc ImageMeanWH(Image) returns (Prediction) {}
}
How can I send the image and other related data to the server and get the response?