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 2019/07/10 17:32:08 UTC

[GitHub] [incubator-mxnet] vandanavk commented on issue #14875: MXNet to ONNX export bug

vandanavk commented on issue #14875: MXNet to ONNX export bug
URL: https://github.com/apache/incubator-mxnet/issues/14875#issuecomment-510156252
 
 
   @ehsanmok I tried the following code with the PR https://github.com/apache/incubator-mxnet/pull/14942. `ValueError: invalid literal for int() with base 10: 'None'` error doesn't occur anymore but I do see `AttributeError: No conversion function registered for op type _arange yet.`. _arange export can be filed as separate feature request. Please try PR https://github.com/apache/incubator-mxnet/pull/14942 and let me know if it works for you.
   
   ```
   from os import path as osp
   import numpy as np
   import mxnet as mx
   from mxnet.contrib import onnx as onnx_mxnet
   from mxnet import gluon
   from gluoncv import model_zoo, data, utils
   
   OUTPUT = "./"
   DATA = "./cat.jpg"
   SIZE = 320
   MODEL = "yolo3_darknet53_coco"
   INPUT_SHAPE = (1, 3, SIZE, SIZE)
   
   net = model_zoo.get_model(MODEL, pretrained=True)
   net.hybridize()
   # pass an img to trigger init after hybridize
   x, _ = data.transforms.presets.yolo.load_test(DATA, short=SIZE)
   _ = net(x)
   
   net.export(osp.join(OUTPUT, MODEL))
   sym = osp.join(OUTPUT, MODEL + "-symbol.json")
   params = osp.join(OUTPUT, MODEL + "-0000.params")
   onnx_file = osp.join(OUTPUT, MODEL + ".onnx")
   
   converted_model_path = onnx_mxnet.export_model(sym, params, [INPUT_SHAPE], np.float32, onnx_file, verbose=True)
   ```

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


With regards,
Apache Git Services