importONNXLayers, importONNXNetwork, and importONNXFunction can't import my onnx model?

5 次查看(过去 30 天)
As of March 3, 2021, importONNXLayers, importONNXNetwork, and importONNXFunction in the latest official version of onnx importer/exporter cannot import my onnx model?
My model link: R3D_50.onnx
Extraction code: kuni
net = importONNXLayers('R3D_50.onnx',...
'OutputLayerType','classification')
analyzeNetwork(net)
importONNXFunction :
params = importONNXFunction('R3D_50.onnx',...
'resnet3D_50');
In both cases, the following internal errors occurred:
Error using nnet.internal.cnn.onnx.onnxmex
Invalid MEX-file
'C:\ProgramData\MATLAB\SupportPackages\R2020b\toolbox\nnet\supportpackages\onnx\+nnet\+internal\+cnn\+onnx\onnxmex.mexw64':
动态链接库(DLL)初始化例程失败。
Error in nnet.internal.cnn.onnx.ModelProto (line 31)
ModelPtr = onnxmex(int32(FuncName.EdeserializeFromFile), filename);
Error in nnet.internal.cnn.onnx.importONNXLayers (line 7)
modelProto =
nnet.internal.cnn.onnx.ModelProto(Filename);
Error in importONNXLayers (line 48)
Layers = nnet.internal.cnn.onnx.importONNXLayers(modelfile, varargin{:});
Error in testONNX2 (line 1)
net = importONNXLayers('D:\python_work\video_classification_pytorch\model\R3D_50.onnx',...
Error using nnet.internal.cnn.onnx.onnxmex

采纳的回答

cui,xingxing
cui,xingxing 2021-3-16
As of March 15, 2021, using the latest version of MATLAB 2021a+Deep Learning Toolbox Converter for ONNX Model Format (version21.1.0) can import R3D_50.onnx, but the prerequisite is:
mv C:\ProgramData\MATLAB\SupportPackages\ R2021a\bin\win64\onnxpb.dll C:\ProgramData\MATLAB\SupportPackages\R2021a\toolbox\nnet\supportpackages\onnx\+nnet\+internal\+cnn\+onnx\
  2 个评论
cui,xingxing
cui,xingxing 2021-5-8
Functions affected by this bug are listed below.
  1. importONNXNetwork
  2. importONNXLayers
  3. importONNXFunction
  4. exportONNXNetwork
  5. importCaffeNetwork
  6. importCaffeLayers
Workaround
As a workaround, move the DLL to the directory where the MEX-file is located.
If you use Deep Learning Toolbox Converter for ONNX Model Format, type the following at the MATLAB command line.
>> source = fullfile( matlabshared.supportpkg.getSupportPackageRoot, "bin", "win64", "onnxpb.dll" );
>> destination = fullfile( matlabshared.supportpkg.getSupportPackageRoot, "toolbox", "nnet", "supportpackages", "onnx", "+nnet", "+internal", "+cnn", "+onnx", "onnxpb.dll" );
>> movefile( source, destination );
If you use Deep Learning Toolbox Importer for Caffe Models, type the following at the MATLAB command line.
>> source = fullfile( matlabshared.supportpkg.getSupportPackageRoot, "bin", "win64", "caffelib.dll" );
>> destination = fullfile( matlabshared.supportpkg.getSupportPackageRoot, "toolbox", "nnet", "supportpackages", "caffe_importer", "+nnet", "+internal", "+cnn", "+caffe", "caffelib.dll" );
>> movefile( source, destination );
Reference here:

请先登录,再进行评论。

更多回答(1 个)

Ting Su
Ting Su 2021-3-15
Hi
Can you tell us which release of MATLAB you are using?
Ting

类别

Help CenterFile Exchange 中查找有关 Image Data Workflows 的更多信息

产品


版本

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by