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