awslabs / multi-model-server

Multi Model Server is a tool for serving neural net models for inference
Apache License 2.0
998 stars 230 forks source link

How to represent any size in the signature.json file #767

Open wangce888 opened 5 years ago

wangce888 commented 5 years ago

My input image is [batch, 3, None, None], how to represent any size in the signature.json file. I think a solution is to remove image.resize(img_arr, w, h) in mxnet_vision_servion_service.py. But how can I represent any size in the signature.json file?

wangce888 commented 5 years ago

Sorry, I mean image.resize(img_arr, w, h) can turn the image into any size.

vdantu commented 5 years ago

I am not sure I understand your question. The "mxnet_vision_service.py" file is completely in the model owners control. The assumption is that the model owner brings in this file, along with other model artifacts to MMS. You could modify the value of "w", "h" on every request based on the image size or the network that you choose (if you have multiple networks in the model).

vdantu commented 5 years ago

@aikudexiaohai : Would you be able to give more information about this question or let us know if the above explanation of signature.json help?

vdantu commented 5 years ago

@aikudexiaohai : Following up on this question. If you solved your issue, would you be able to share how you solved it?

JustinhoCHN commented 5 years ago

@vdantu \mxnet-model-server\examples\model_service_template\mxnet_model_service.py line 96, the model will bind the input_shape, can we just comment this line to accept arbitrary size of image?

vdantu commented 5 years ago

@JustinhoCHN : Firstly I am assuming that you are talking about the "batch" dimension of the input shape. I don't think MXNet supports arbitrary size for input shape. You might have to rebind every time you get different shape, or pad the incoming requests with 0's if you want to bind it once and reuse that bound MXNet module.

JustinhoCHN commented 5 years ago

@vdantu sorry, I mean arbitrary w and h, not the batch dimension, since rebind will cost a lot, maybe fix the w and h size would be better. Thanks V~