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/09/19 08:54:30 UTC

[GitHub] [incubator-mxnet] LeicongLi opened a new issue #16210: Load pre-trained AlexNet ONNX official model

LeicongLi opened a new issue #16210: Load pre-trained AlexNet ONNX official model
URL: https://github.com/apache/incubator-mxnet/issues/16210
 
 
   Note: Providing complete information in the most concise form is the best way to get help. This issue template serves as the checklist for essential information to most of the technical issues and bug reports. For non-technical issues and feature requests, feel free to present the information in what you believe is the best form.
   
   For Q & A and discussion, please start a discussion thread at https://discuss.mxnet.io 
   
   ## Description
   Using mxnet ONNX module to load pre-trained AlexNet model obtained from ONNX official website, but got an error message.
   
   ## Environment info (Required)
   
   ```
   What to do:
   1. Download the diagnosis script from https://raw.githubusercontent.com/apache/incubator-mxnet/master/tools/diagnose.py
   2. Run the script using `python diagnose.py` and paste its output here.
   ----------Python Info----------
   Version      : 3.5.2
   Compiler     : GCC 5.4.0 20160609
   Build        : ('default', 'Jul 10 2019 11:58:48')
   Arch         : ('64bit', 'ELF')
   ------------Pip Info-----------
   Version      : 19.2.2
   Directory    : /usr/local/lib/python3.5/dist-packages/pip
   ----------MXNet Info-----------
   Version      : 1.4.0
   Directory    : /home/leicongl/.local/lib/python3.5/site-packages/mxnet
   Commit Hash   : a03d59ed867ba334d78d61246a1090cd1868f5da
   Library      : ['/home/leicongl/.local/lib/python3.5/site-packages/mxnet/libmxnet.so']
   Build features:
   No runtime build feature info available
   ----------System Info----------
   Platform     : Linux-4.15.0-58-generic-x86_64-with-Ubuntu-16.04-xenial
   system       : Linux
   node         : llc-dev
   release      : 4.15.0-58-generic
   version      : #64~16.04.1-Ubuntu SMP Wed Aug 7 14:10:35 UTC 2019
   ----------Hardware Info----------
   machine      : x86_64
   processor    : x86_64
   Architecture:          x86_64
   CPU op-mode(s):        32-bit, 64-bit
   Byte Order:            Little Endian
   CPU(s):                16
   On-line CPU(s) list:   0-15
   Thread(s) per core:    2
   Core(s) per socket:    8
   Socket(s):             1
   NUMA node(s):          1
   Vendor ID:             GenuineIntel
   CPU family:            6
   Model:                 158
   Model name:            Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
   Stepping:              12
   CPU MHz:               2418.735
   CPU max MHz:           5000.0000
   CPU min MHz:           800.0000
   BogoMIPS:              7200.00
   Virtualization:        VT-x
   L1d cache:             32K
   L1i cache:             32K
   L2 cache:              256K
   L3 cache:              16384K
   NUMA node0 CPU(s):     0-15
   Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault invpcid_single ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities
   ----------Network Test----------
   Setting timeout: 10
   Timing for MXNet: https://github.com/apache/incubator-mxnet, DNS: 0.0019 sec, LOAD: 1.8096 sec.
   Timing for Gluon Tutorial(cn): https://zh.gluon.ai, DNS: 0.0166 sec, LOAD: 2.0959 sec.
   Timing for Conda: https://repo.continuum.io/pkgs/free/, DNS: 0.0157 sec, LOAD: 1.5621 sec.
   Timing for Gluon Tutorial(en): http://gluon.mxnet.io, DNS: 0.0067 sec, LOAD: 2.2819 sec.
   Timing for PYPI: https://pypi.python.org/pypi/pip, DNS: 0.0017 sec, LOAD: 5.2355 sec.
   Timing for FashionMNIST: https://apache-mxnet.s3-accelerate.dualstack.amazonaws.com/gluon/dataset/fashion-mnist/train-labels-idx1-ubyte.gz, DNS: 0.0138 sec, LOAD: 1.8591 sec.
   ----------Environment----------
   KMP_DUPLICATE_LIB_OK="True"
   
   ```
   
   Package used (Python/R/Scala/Julia):
   (I'm using ...)
   
   For Scala user, please provide:
   1. Java version: (`java -version`)
   2. Maven version: (`mvn -version`)
   3. Scala runtime if applicable: (`scala -version`)
   
   For R user, please provide R `sessionInfo()`:
   
   ## Build info (Required if built from source)
   
   Compiler (gcc/clang/mingw/visual studio):
   
   MXNet commit hash:
   (Paste the output of `git rev-parse HEAD` here.)
   
   Build config:
   (Paste the content of config.mk, or the build command.)
   
   ## Error Message:
   (Paste the complete error message, including stack trace.)
   
   ## Minimum reproducible example
   (If you are using your own code, please provide a short script that reproduces the error. Otherwise, please provide link to the existing example.)
   
   ## Steps to reproduce
   (Paste the commands you ran that produced the error.)
   
   1. Link to the model, https://github.com/onnx/models/blob/master/vision/classification/alexnet/README.md
   
   2. mxnet code used to load 
   ```
   import mxnet.contrib.onnx as onnx_mxnet
   import numpy as np
   import mxnet as mx
   from PIL import Image
   from collections import namedtuple
   
   alexnet_path = "/path/to/file"
   alexnet_tensor = np.random.random([10, 3, 224, 224])
   sym, arg_params, aux_params = onnx_mxnet.import_model(alexnet_path)
   alexnet_tensor = mx.nd.array(alexnet_tensor)
   mod = mx.mod.Module(symbol=sym, data_names=['actual_input_1'], label_names=None)
   mod.bind(for_training=False, data_shapes=[('actual_input_1', alexnet_tensor.shape)])
   mod.set_params(arg_params=arg_params, aux_params=aux_params, allow_missing=True, allow_extra=True)
   Batch = namedtuple('Batch', ['data'])
   mod.forward(Batch([alexnet_tensor]))
   mx_out = mod.get_outputs()[0][0][0]
   ```
   
   3. error message 
   ```
   Traceback (most recent call last):
     File "<stdin>", line 1, in <module>
     File "/home/xxx/.local/lib/python3.5/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 "/home/xxx/.local/lib/python3.5/site-packages/mxnet/contrib/onnx/onnx2mx/import_onnx.py", line 115, in from_onnx
       mxnet_sym = self._convert_operator(node_name, op_name, onnx_attr, inputs)
     File "/home/xxx/.local/lib/python3.5/site-packages/mxnet/contrib/onnx/onnx2mx/import_onnx.py", line 61, in _convert_operator
       op_name, new_attrs, inputs = convert_map[op_name](attrs, inputs, self)
     File "/home/xxx/.local/lib/python3.5/site-packages/mxnet/contrib/onnx/onnx2mx/_op_translations.py", line 434, in reshape
       reshape_shape = list(proto_obj._params[inputs[1].name].asnumpy())
   KeyError: 'concat1'
   ```
   
   4. Model graph structure
   ![onnx_alexnet_structure](https://user-images.githubusercontent.com/24490992/65228625-60600f80-dafd-11e9-9bfa-dc27caf5414e.png)
   
   
   ## What have you tried to solve it?
   
   1.
   2.
   

----------------------------------------------------------------
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