Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

[Feature Request] Support ONNX export of MultiBox operators #15181

Open
pinaraws opened this issue Jun 7, 2019 · 11 comments
Open

[Feature Request] Support ONNX export of MultiBox operators #15181

pinaraws opened this issue Jun 7, 2019 · 11 comments

Comments

@pinaraws
Copy link

pinaraws commented Jun 7, 2019

Currently, the MXNet->ONNX model exporter does not support the MultiBox operators
MultiBoxDetection
MultiBoxPrior
MultiBoxTarget

Since there's no builtin ONNX operator (list) for this we would need to add the corresponding operators in ONNX first.

@mxnet-label-bot
Copy link
Contributor

Hey, this is the MXNet Label Bot.
Thank you for submitting the issue! I will try and suggest some labels so that the appropriate MXNet community members can help resolve it.
Here are my recommended labels: ONNX, Feature

@pinaraws
Copy link
Author

pinaraws commented Jun 7, 2019

@mxnet-label-bot add[Feature request, ONNX]

@anirudhacharya
Copy link
Member

tracked on the ONNX repo here - onnx/onnx#2086

@nopattern
Copy link

onnx 1.5 supports ssd now
onnx/onnx#1552

@alicrop
Copy link

alicrop commented Aug 7, 2019

I'm getting a "AttributeError: No conversion function registered for op type _contrib_MultiBoxPrior yet.". Same situations as https://stackoverflow.com/questions/56229207/export-mxnet-model-to-onnx-with-contrib-multiboxprior-error

  • I trained using AWS's object detection algorithm (Resnet50 + SSD).
  • Converted resultant training model (on S3 bucket) to a deploy model using "deploy.py" in mxnet's SSD examples.
  • Attempted to convert to from deploy model to ONNX model. Used
import numpy as np
from mxnet.contrib import onnx as onnx_mxnet
import logging
logging.basicConfig(level=logging.INFO)

# Downloaded input symbol and params files
sym = './deploy_model_algo_1-symbol.json'
params = './deploy_model_algo_1-0000.params'

# Standard Imagenet input - 3 channels, 512*512
input_shape = (1,3,512,512)

# Path of the output file
onnx_file = './mxnet_exported.onnx'

converted_model_path = onnx_mxnet.export_model(sym, params, [input_shape], np.float32, onnx_file)```

@kunal732
Copy link

kunal732 commented Oct 2, 2019

have the same exact issue as @ban1080 :/

@ivansmith7795
Copy link

That makes 3, is there any manual work around for this?

@giaxxi
Copy link

giaxxi commented Jan 3, 2020

Same issue here:
AttributeError: No conversion function registered for op type _contrib_MultiBoxPrior yet.

Incidentally I followed the same process as @ban1080.

@cloudrivers
Copy link

meet the same issue on aws sagemaker. it seams that the version of onnx in sagemaker's mxnet is 1.2.1. however, I tried to upgrade to 1.6.0. after that, the issue still occur.
pip install onnx==1.6.0

AttributeError Traceback (most recent call last)
in ()
1 # Invoke export model API. It returns path of the converted onnx model
----> 2 converted_model_path = onnx_mxnet.export_model(sym, params, [input_shape], np.float16, onnx_file, True)
3
4 print(converted_model_path)
5 #converted_model_path = my_onnx_mxnet.export_model(sym, params, [input_shape], np.float32, onnx_file, True)

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/mxnet/contrib/onnx/mx2onnx/export_model.py in export_model(sym, params, input_shape, input_type, onnx_file_path, verbose)
81 onnx_graph = converter.create_onnx_graph_proto(sym_obj, params_obj, input_shape,
82 mapping.NP_TYPE_TO_TENSOR_TYPE[data_format],
---> 83 verbose=verbose)
84 elif isinstance(sym, symbol.Symbol) and isinstance(params, dict):
85 onnx_graph = converter.create_onnx_graph_proto(sym, params, input_shape,

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/mxnet/contrib/onnx/mx2onnx/export_onnx.py in create_onnx_graph_proto(self, sym, params, in_shape, in_type, verbose)
251 initializer=initializer,
252 index_lookup=index_lookup,
--> 253 idx=idx
254 )
255

~/anaconda3/envs/mxnet_p36/lib/python3.6/site-packages/mxnet/contrib/onnx/mx2onnx/export_onnx.py in convert_layer(node, **kwargs)
88 op = str(node["op"])
89 if op not in MXNetGraph.registry_:
---> 90 raise AttributeError("No conversion function registered for op type %s yet." % op)
91 convert_func = MXNetGraph.registry_[op]
92 return convert_func(node, **kwargs)

AttributeError: No conversion function registered for op type _contrib_MultiBoxPrior yet.

@szha
Copy link
Member

szha commented Jun 9, 2020

@cloudrivers onnx 1.6 has a different version of opset definition than previous versions, see https://github.com/onnx/onnx/blob/master/docs/Versioning.md#released-versions

@imyoungyang
Copy link

@szha any suggestion or sample codes for this issue? Customer trained on the SageMaker but can't transform to ONNX.
Here is the repeatable issue code

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests