alicera edited a comment on issue #19808:
URL: 
https://github.com/apache/incubator-mxnet/issues/19808#issuecomment-770659754


   By the way, I based on NGC "nvcr.io/nvidia/mxnet:20.12-py3" to do 
   git clone --recursive https://github.com/apache/incubator-mxnet mxnet
   cd mxnet
   git checkout v1.x
   cp -r ./python/mxnet/contrib/onnx/mx2onnx/ 
/opt/mxnet/python/mxnet/contrib/onnx/
   
   then I run the script.
   here is the script
   
   
   > from gluoncv import model_zoo
   import numpy as np
   import mxnet as mx
   
   model_name = 'resnest101'
   resnet50 = model_zoo.get_model(model_name, pretrained=True)
   print(model_name+' downloaded')
   
   resnet50.hybridize()
   print(model_name+' hybridized')
   input_shape=(1,3,224,224)
   data_array = np.random.uniform(0, 255, size=input_shape).astype("float32")
   mx_data = mx.nd.array(data_array)
   resnet50(mx_data)
   
   resnet50.export(model_name)
   print(model_name+' exported')
   
   #convert using onnx
   from mxnet.contrib import onnx as onnx_mxnet
   onnx_file='./tp.onnx'
   params = './'+model_name+'-0000.params'
   #sym = mx.sym.load('./resnetfifty-symbol.json')
   sym='./'+model_name+'-symbol.json'
   onnx_mxnet.export_model(sym, params, [input_shape], np.float32, onnx_file)
   print('onnx export done')
   
   > 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to