深度学习导入和导出
从 TensorFlow™ 2、TensorFlow-Keras、PyTorch®、ONNX™(开放式神经网络交换)模型格式和 Caffe 中导入网络和层图。您还可以将 Deep Learning Toolbox™ 网络和层图导出为 TensorFlow 2 和 ONNX 模型格式。有关详细信息,请参阅预训练的深度神经网络和Interoperability Between Deep Learning Toolbox, TensorFlow, PyTorch, and ONNX。
您必须有支持包才能在 Deep Learning Toolbox 中运行导入和导出函数。如果未安装支持包,则每个函数都会在附加功能资源管理器中提供对应支持包的下载链接。建议将支持包下载到您正在运行的 MATLAB® 版本的默认位置。您也可以从以下链接直接下载支持包。
importONNXNetwork
、importONNXLayers
、importONNXFunction
和exportONNXNetwork
函数需要 Deep Learning Toolbox Converter for ONNX Model Format。要下载支持包,请转至 https://www.mathworks.com/matlabcentral/fileexchange/67296-deep-learning-toolbox-converter-for-onnx-model-format。importTensorFlowNetwork
、importTensorFlowLayers
、exportNetworkToTensorFlow
、importKerasNetwork
和importKerasLayers
函数需要 Deep Learning Toolbox Converter for TensorFlow Models。要下载支持包,请转至 https://www.mathworks.com/matlabcentral/fileexchange/64649-deep-learning-toolbox-converter-for-tensorflow-models。importNetworkFromPyTorch
函数需要 Deep Learning Toolbox Converter for PyTorch Models。要下载支持包,请转至 https://www.mathworks.com/matlabcentral/fileexchange/111925。importCaffeNetwork
和importCaffeLayers
函数需要 Deep Learning Toolbox Importer for Caffe Models。要下载支持包,请转至 https://www.mathworks.com/matlabcentral/fileexchange/61735-deep-learning-toolbox-importer-for-caffe-models。
函数
主题
- Interoperability Between Deep Learning Toolbox, TensorFlow, PyTorch, and ONNX
Learn how to import networks from TensorFlow, PyTorch, and ONNX and use the imported networks for common Deep Learning Toolbox workflows. Learn how to export networks to TensorFlow and ONNX.
- Tips on Importing Models from TensorFlow, PyTorch, and ONNX
Tips on importing Deep Learning Toolbox networks or layer graphs from TensorFlow, PyTorch, and ONNX.
- 预训练的深度神经网络
了解如何下载和使用预训练的卷积神经网络进行分类、迁移学习和特征提取。
- Inference Comparison Between TensorFlow and Imported Networks for Image Classification
Perform prediction in TensorFlow with a pretrained network, import the network into MATLAB using
importTensorFlowNetwork
, and then compare inference results between TensorFlow and MATLAB networks. - Inference Comparison Between ONNX and Imported Networks for Image Classification
Perform prediction in ONNX with a pretrained network, import the network into MATLAB using
importONNXNetwork
, and then compare inference results between ONNX and MATLAB networks. - 基于预训练的 Keras 层组合网络
此示例说明如何从预训练的 Keras 网络中导入层、用自定义层替换不支持的层,以及将各层组合成可以进行预测的网络。
- Replace Unsupported Keras Layer with Function Layer
This example shows how to import the layers from a pretrained Keras network, replace the unsupported layers with function layers, and assemble the layers into a network ready for prediction.
- Classify Images in Simulink with Imported TensorFlow Network
Import a pretrained TensorFlow network using
importTensorFlowNetwork
, and then use the Predict block for image classification in Simulink®. - Deploy Imported TensorFlow Model with MATLAB Compiler
Import third-party pretrained networks and deploy the networks using MATLAB Compiler™.
- Select Function to Import ONNX Pretrained Network
Import an ONNX pretrained network using
importONNXNetwork
,importONNXLayers
, orimportONNXFunction
.
相关信息
- https://www.mathworks.com/matlabcentral/fileexchange/67296-deep-learning-toolbox-converter-for-onnx-model-format
- https://www.mathworks.com/matlabcentral/fileexchange/64649-deep-learning-toolbox-converter-for-tensorflow-models
- https://www.mathworks.com/matlabcentral/fileexchange/111925
- https://www.mathworks.com/matlabcentral/fileexchange/61735-deep-learning-toolbox-importer-for-caffe-models