无法导入onnx模型

net = importNetworkFromONNX("model5.onnx")
MEX 文件 'C:\ProgramData\MATLAB\SupportPackages\R2025b\toolbox\nnet\supportpackages\onnx\+nnet\+internal\+cnn\+onnx\onnxmex.mexw64' 无效: 找不到指定的程序。
出错
ModelPtr = onnxmex(int32(FuncName.EdeserializeFromFile), filename);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
出错
modelProto = nnet.internal.cnn.onnx.ModelProto(Filename);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
出错
Network = nnet.internal.cnn.onnx.importONNXNetwork(modelFolder, 'TargetNetwork', 'dlnetwork', ...
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
出错
Network = nnet.internal.cnn.onnx.importNetworkFromONNX(modelfile, varargin{:});
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Answers (1)

Esther
Esther on 4 Jun 2026 at 8:35

0 votes

This is a known compatibility issue between MATLAB R2025b Update 3 (and later) and the 'Deep Learning Toolbox Converter for ONNX Model Format' support package (version 25.2.2 and earlier).
This issue was resolved with MATLAB R2025b Update 4 & the February 2026 release of the 'Deep Learning Toolbox Converter for ONNX Model Format' support package (version 25.2.5), which was released on February 20th, 2026.
First, make sure to upgrade to R2025b Update 4 or later by using Help > Check for Updates:
Then, uninstall the ONNX support package by clicking the "Manage" button in the Add-On Panel and then selcting "Uninstall" in Add-On Manager:
Finally, reinstall the ONNX support package from the Add-On Explorer. To confirm that the most recent version was installed, use:
>> matlabshared.supportpkg.getInstalled
Name Version Base Product
--------------------------------------------------------- ------- ------------
Deep Learning Toolbox Converter for ONNX Model Format 25.2.5

Categories

Products

Release

R2025b

Asked:

on 25 Mar 2026

Answered:

on 4 Jun 2026 at 8:35

Community Treasure Hunt

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

Start Hunting!