You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/08/07 01:26:29 UTC

[GitHub] Roshrini opened a new issue #12057: Error In Loading Pretrained ShuffleNet ONNX Model

Roshrini opened a new issue #12057: Error In Loading Pretrained ShuffleNet ONNX Model
URL: https://github.com/apache/incubator-mxnet/issues/12057
 
 
   Hi there. Recently I am trying doing one simple experiment on training with ShuffleNet.
   The pre-trained shuffleNet ONNX model is here: https://github.com/onnx/models/tree/master/shufflenet 2
   
   From the tutorial of the loading of ONNX model (https://mxnet.incubator.apache.org/tutorials/onnx/super_resolution.html?highlight=onnx), the simple model loading code is here:
   
   import mxnet.contrib.onnx as onnx_mxnet
   import json
   def loadShuffleNet():
   path = ‘/model/shufflenet/’
   onnx_path = path + ‘model.onnx’
   sym, arg_params, aux_params = onnx_mxnet.import_model(onnx_path)
   print(sym.get_internals().list_outputs())
   
   The error information is on the following:
   —> 30 sym, arg_params, aux_params = onnx_mxnet.import_model(onnx_path)
   31 print(sym.get_internals().list_outputs())
   32 ln = ‘flatten0’
   
   ~/.local/lib/python3.6/site-packages/mxnet/contrib/onnx/_import/import_model.py in import_model(model_file)
   51 # loads model file and returns ONNX protobuf object
   52 model_proto = onnx.load(model_file)
   —> 53 sym, arg_params, aux_params = graph.from_onnx(model_proto.graph)
   54 return sym, arg_params, aux_params
   55
   
   ~/.local/lib/python3.6/site-packages/mxnet/contrib/onnx/_import/import_onnx.py in from_onnx(self, graph)
   112 onnx_attr = self._parse_attr(node.attribute)
   113 inputs = [self._nodes[i] for i in node.input]
   –> 114 mxnet_sym = self._convert_operator(node_name, op_name, onnx_attr, inputs)
   115
   116 for k, i in zip(list(node.output), ran
   ge(len(mxnet_sym.list_outputs()))):
   
   ~/.local/lib/python3.6/site-packages/mxnet/contrib/onnx/_import/import_onnx.py in _convert_operator(self, node_name, op_name, attrs, inputs)
   56 “”"
   57 if op_name in convert_map:
   —> 58 op_name, new_attrs, inputs = convert_map[op_name](attrs, inputs, self)
   59 else:
   60 raise NotImplementedError(“Operator {} not implemented.”.format(op_name))
   
   ~/.local/lib/python3.6/site-packages/mxnet/contrib/onnx/_import/op_translations.py in batch_norm(attrs, inputs, cls)
   172
   173 # in test mode “fix_gamma” should be unset.
   –> 174 new_attrs[‘fix_gamma’] = 0 if new_attrs[‘fix_gamma’] == 1 else 1
   175 return ‘BatchNorm’, new_attrs, inputs
   176
   
   KeyError: ‘fix_gamma’
   
   After testing with all versions of the pre-trained shuffleNet, only the version 1.1 can be loaded successfully.
   
   Is there anyone meeting this problem? Thank you.
   
   Creating this issue on behalf of @jmnie 
   https://discuss.mxnet.io/t/error-in-loading-pretrained-shufflenet-onnx-model/1520
   
   @sandeep-krishnamurthy Can you please add label: ONNX

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services