You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@mxnet.apache.org by GitBox <gi...@apache.org> on 2021/02/12 11:12:24 UTC
[GitHub] [incubator-mxnet] LewsTherin511 edited a comment on issue #14875: MXNet to ONNX export bug
LewsTherin511 edited a comment on issue #14875:
URL: https://github.com/apache/incubator-mxnet/issues/14875#issuecomment-778132510
I'm encountering the same issue.
I fine-tuned an SSD model on a custom dataset (everything working properly), and I'm trying to export it to ONNX in order to run it on Android.
This is what I'm doing I adapted PR #14942 to my case:
`
from os import path as osp
import numpy as np
import mxnet as mx
import gluoncv as gcv
from mxnet.contrib import onnx as onnx_mxnet
from mxnet import gluon
from gluoncv import model_zoo, data, utils
ctx = mx.cpu(0)
OUTPUT = 'oxnn/'
DATA = "./friends.png"
# SIZE = 320
MODEL = "CML_exported"
INPUT_SHAPE = ((1,3,512,683))
CML_classes = ["CML_mug"]
net = gcv.model_zoo.get_model('ssd_512_mobilenet1.0_custom', classes=CML_classes, pretrained_base=False, ctx=ctx)
net.load_parameters("saved_weights/CML_mobilenet_mug_00/ep_035.params", ctx=ctx)
net.hybridize()
# pass an img to trigger init after hybridize
x, _ = data.transforms.presets.yolo.load_test(DATA, short=512)
_ = 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)`
I'm getting the usual:
`File ".../anaconda3/envs/gluon/lib/python3.7/site-packages/mxnet/contrib/onnx/mx2onnx/export_onnx.py", line 92, in convert_layer
return convert_func(node, **kwargs)
File "/home/lews/anaconda3/envs/gluon/lib/python3.7/site-packages/mxnet/contrib/onnx/mx2onnx/_op_translations.py", line 1502, in convert_slice_axis
ends = int(attrs.get("end", None))
ValueError: invalid literal for int() with base 10: 'None'`
Any updates since last year? Was this somehow fixed?
----------------------------------------------------------------
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
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@mxnet.apache.org
For additional commands, e-mail: issues-help@mxnet.apache.org