[GitHub] KineticCookie commented on issue #9361: infer_shape error for 'resnet-152'
KineticCookie commented on issue #9361: infer_shape error for 'resnet-152' URL: https://github.com/apache/incubator-mxnet/issues/9361#issuecomment-362577135 @kevinthesun thanks for the detailed explanation. ? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] KineticCookie commented on issue #9361: infer_shape error for 'resnet-152'
KineticCookie commented on issue #9361: infer_shape error for 'resnet-152' URL: https://github.com/apache/incubator-mxnet/issues/9361#issuecomment-362204536 @kevinthesun > If you don't know exactly what a model does and what kind of inputs it accepts, it might not be a good idea to directly use it in your app. I understand your concerns, but the sole purpose of my app is to provide a simple way to expose models as web service. If I train model with dataset of int32 and 300x300 shape, I think that is obvious that I intend to use it with the same shape and datatype. The point is, why mxnet doesn't provide information about datatypes and shapes, which are already inferred and known in the training process, when I export model? For instance, in TensorFlow: 1. I create Signature for a model with Tensor information (as described in https://www.tensorflow.org/serving/serving_basic). 2. I specify which tensors are inputs and which ones are outputs. Shapes and types, defined statically or inferred, are written to the signature. 3. Signature information is exported with model itself. When I import a model, I know about model inputs/outputs, with their types and shapes at a runtime. This helps me to validate data and pass it to the model. This also gives me an opportunity to create a documentation or an interface, so external users are able to use this model. In conclusion, mxnet doesn't have a Signature mechanism and it infers shape and data at the training. So, why doesn't it save this information along with model? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] KineticCookie commented on issue #9361: infer_shape error for 'resnet-152'
KineticCookie commented on issue #9361: infer_shape error for 'resnet-152' URL: https://github.com/apache/incubator-mxnet/issues/9361#issuecomment-357217016 I executed your snippet, and I can't find information about shapes model was trained with. ``` ResNetV2( (features): HybridSequential( /* layer attributes */) (output): Dense(2048 -> 1000, linear) ) ``` Layer attribute doesn't contain information to get a model input and output shape. Moreover I can't find a data types for each layer. I made an additional search and found this issue #7641 with @jeremiedb explaining shapes implementation: > There's typically no need to specify shape of data input when building the symbolic network. This will typically will be set at training time when the model is bind and the shapes infered from what the iterator provides as input data. This allows the same network to be trained with different batch sizes. Seems like mxnet infers information about shapes and data types at training, but doesn't store it in model files. `infer_[shape, type]` methods are the only way to get this info, but they require hardcoded variables. I try to implement Tensorflow Serving-like server that could handle any exported mxnet model, and serve it via HTTP api. But to do this I need to know: 1. What data model is waiting for? (name of input, shape of input, data type of input) So server can prepare user data to be passed to inference method. 2. What model will return after inference? (name of output, shape of output, data type of ouput) So clients of my server expect some specified values to return after they send a request. If I put away my serving case: I got a mxnet model from datascientist to use in my app. Model ships with no documentation. I can't contact datascientist either. Is there any way to use this mxnet model, considering I have no clue what data was used to train this model? This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] KineticCookie commented on issue #9361: infer_shape error for 'resnet-152'
KineticCookie commented on issue #9361: infer_shape error for 'resnet-152' URL: https://github.com/apache/incubator-mxnet/issues/9361#issuecomment-356953474 The broader question: Is there a way to get information (names, data types, shapes) about model inputs and outputs using only model persistence mechanism? (like Tensorflow model signatures) This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services
[GitHub] KineticCookie commented on issue #9361: infer_shape error for 'resnet-152'
KineticCookie commented on issue #9361: infer_shape error for 'resnet-152' URL: https://github.com/apache/incubator-mxnet/issues/9361#issuecomment-356951215 @zhreshold thanks for pointing it out. But the thing is, what if I don't know what data shape is for current model? In this [tutorial](https://mxnet.incubator.apache.org/tutorials/python/predict_image.html) shape is basically hardcoded: `mod.bind(for_training=False, data_shapes=[('data', (1,3,224,224))], label_shapes=mod._label_shapes)` I try to abstract over that and can't find a proper solution. This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services