-
Notifications
You must be signed in to change notification settings - Fork 6.8k
MXNet to ONNX export bug #14875
Comments
Hey, this is the MXNet Label Bot. |
@Roshrini Could you please take a look? |
@ehsanmok mxnet isn't responsible for this error, it's only ONNX. |
@AnaRhisT94 No, my ONNX is already the latest v1.5.0. It's when calling export_model causes that to happen. |
Try to use ONNX 1.2.2 |
Same error with ONNX 1.2.2 |
@mxnet-label-bot add [Bug] @ehsanmok I'm looking into this, could you share your script? |
I see, well just delete the None then? |
@vandanavk here is an MVE 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 = "./output"
DATA = "./data/cat.png"
SIZE = 320
MODEL = "yolo3_mobilenet1.0_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) |
@ehsanmok I tried the following code with the PR #14942.
|
@ehsanmok I met the same problem with you. I saw the issue has been around for 3 months. Did you solve it? |
I found that there are several ops not supported during converting, including slice_axis(..., end =None), slice_like, repeat, arange. But for a fixed input dimension, these operations can be replaced with normal slice_like, concat. The main problem is in box_nms. |
Not sure if this is the right place to post, but I used the fixes from PR #14942, fixed the issue for me but the next error is: Attempting to export 'ssd_512_mobilenet1.0_voc' |
Does anyone have any update on this ? I am having the same issue ... |
the bug is happen in yolo3.py line 161, there is a None param, fix it. and then u will meet the _arange op not regist |
Did you find some ways to fix it? I meet it with "ssd_512_resnet50_v1_voc" |
nope, raised a ticket in Amazon but no one is currently working on this .. |
same problom, when used torch yolov32onnx.py, so easy to convert |
I met the same problem.
|
Had same error on Nov 5, 2019.. tried to build make the operator but didnt work.. |
I'm encountering the same issue.
I'm getting the usual:
|
Hi @LewsTherin511, thanks for reaching out! This should be easy to fix; you can expect this to be fixed by tomorrow :) Meanwhile what version of mxnet are you using and on what os? Our team have been improving onnx lately (on v1.x branch) and here is a simple tool to help update onnx support to your local mxnet #19876 |
Actually as @waytrue17 pointed out in https://discuss.mxnet.apache.org/t/exporting-model-to-onnx-or-alternative-way-to-run-on-android/6862 this might have already been fixed. Would you try #19876 to update to the latest onnx support? |
Hi, thank you very much for your answer! I'm currenlty using mxnet-mkl (1.6.0), gluoncv (0.8.0) and onnx (1.8.1). Anyway, I asked on the forum already, but I have an incredibly lame question. I generally always installed mxnet/gluoncv with pip. In order to try your suggestion, I’m assuming I should follow the instructions for an installation from source and switch to the branch you indicated?
or am I getting this completely wrong? |
No no need to build from source. I know that sucks :) You can just download my python script and run it anywhere and it should work. What the script does is basically 1) detect you current mxnet installation directory 2) pull the latest changes from mxnet repo 3) copy over and overwrite the onnx module to you current mxnet version. You shouldn't need to do anything besides running the script. I think it's fine to keep you current mxnet and gluon versions. Please let us know if you have any questions and feel free to @me. |
Hi! Thanks again for your assistance last time, it worked perfectly! However, I noticed something weird. So, I tried the update script, but running it seems to somehow break the mxnet installation. After the update, whenever I try importing mxnet, I get the error: On the same machine, I tried creating a new virtual environment with: as before, everything works ok (generically using MXNet/GluonCV models), and the ONNX export doesn't. The error this time is different: I still have everything working on the old machine, but I thought it might be useful the problem. :) |
When trying to convert
yolov3_mobilenetv1.0_coco
pretrained from gluonCV v0.5 to ONNX viaonnx_mxnet.export_model
(using mxnet-cu90mkl==1.5.0b20190313 ), I get the following error:This matches this line which is a bug introduced in #12878 .
The text was updated successfully, but these errors were encountered: