mxnet fail to import onnx model exported by pytorch. The model is from https://github.com/biubug6/Pytorch_Retinaface
(Paste the complete error message. Please also include stack trace by setting environment variable DMLC_LOG_STACK_TRACE_DEPTH=10 before running your script.)
File "/disk/zhitingz/video-pipeline/sprocket/platform/lambda_program/onnxruntime/detection/detect.py", line 139, in mx_init
sym, arg_params, aux_params = onnx_mxnet.import_model(mpath)
File "/disk/zhitingz/mxnet-cpu/lib/python3.6/site-packages/mxnet/contrib/onnx/onnx2mx/import_model.py", line 59, in import_model
sym, arg_params, aux_params = graph.from_onnx(model_proto.graph)
File "/disk/zhitingz/mxnet-cpu/lib/python3.6/site-packages/mxnet/contrib/onnx/onnx2mx/import_onnx.py", line 115, in from_onnx
inputs = [self._nodes[i] for i in node.input]
File "/disk/zhitingz/mxnet-cpu/lib/python3.6/site-packages/mxnet/contrib/onnx/onnx2mx/import_onnx.py", line 115, in <listcomp>
inputs = [self._nodes[i] for i in node.input]
KeyError: '1'
(If you developed your own code, please provide a short script that reproduces the error. For existing examples, please provide link.)
Get the exported onnx model. I fork the above link: https://github.com/photoszzt/Pytorch_Retinaface with some helper script to reproduce this issue easier.
cd weights
./download_all_pretrain.sh
cd -
./export_models.sh
from mxnet.contrib import onnx as onnx_mxnet
sym, arg_params, aux_params = onnx_mxnet.import_model('./mnet.0.25.onnx')
Welcome to Apache MXNet (incubating)! We are on a mission to democratize AI, and we are glad that you are contributing to it by opening this issue.
Please make sure to include all the relevant context, and one of the @apache/mxnet-committers will be here shortly.
If you are interested in contributing to our project, let us know! Also, be sure to check out our guide on contributing to MXNet and our development guides wiki.
I update the issue with my forked repo that contains some helpful scripts to reproduce this issue.
cc @josephevans and @ChaiBapchya