외부 플랫폼의 사전 훈련된 신경망
R2026b외부 딥러닝 플랫폼의 사전 훈련된 신경망을 사용하기 위한 두 가지 접근 방식은 모델을 가져오거나 또는 연동실행을 사용하여 외부 모델을 훈련시키고 테스트하는 것입니다. 권장되는 방법은 가능하면 모델을 가져오는 것입니다.
Deep Learning Toolbox™는 TensorFlow™ 2, TensorFlow-Keras, Keras 3, PyTorch®, ONNX™(Open Neural Network Exchange) 모델 형식 및 Caffe에서 신경망 가져오기를 지원합니다. 심층 신경망 디자이너 앱을 사용하여 대화형 방식으로 신경망을 가져오거나, 명령줄 함수를 사용하여 프로그래밍 방식으로 가져옵니다. 이 앱은 가져오기 프로세스가 요약되어 있고 필요한 조치가 강조 표시된 가져오기 리포트를 생성합니다. 자세한 내용은 사전 훈련된 심층 신경망 항목과 Interoperability Between Deep Learning Toolbox, TensorFlow, PyTorch, and ONNX 항목을 참조하십시오.
Deep Learning Toolbox의 가져오기 함수를 사용하려면 특정 지원 패키지가 필요합니다. 필요한 지원 패키지가 설치되어 있지 않은 경우, 각 함수는 해당 지원 패키지를 다운로드할 수 있는 애드온 탐색기 링크를 제공합니다. 사용 중인 MATLAB® 버전의 디폴트 위치에 지원 패키지를 다운로드하십시오. 다음과 같이 지원 패키지를 직접 다운로드할 수도 있습니다.
importNetworkFromONNX를 사용하려면 Deep Learning Toolbox Converter for ONNX Model Format이 필요합니다. 지원 패키지를 다운로드하려면 https://www.mathworks.com/matlabcentral/fileexchange/67296-deep-learning-toolbox-converter-for-onnx-model-format 항목으로 이동하십시오.importNetworkFromPyTorch를 사용하려면 Deep Learning Toolbox Converter for PyTorch Models가 필요합니다. 지원 패키지를 다운로드하려면 https://www.mathworks.com/matlabcentral/fileexchange/111925-deep-learning-toolbox-converter-for-pytorch-models 항목으로 이동하십시오.importNetworkFromTensorFlow및importNetworkFromKeras를 사용하려면 Deep Learning Toolbox Converter for TensorFlow Models가 필요합니다. 지원 패키지를 다운로드하려면 https://www.mathworks.com/matlabcentral/fileexchange/64649-deep-learning-toolbox-converter-for-tensorflow-models 항목으로 이동하십시오.
MATLAB과 외부 딥러닝 플랫폼 사이의 상호 운용
사전 훈련된 신경망을 가져올 수 없는 경우, 연동실행을 사용하여 외부 모델을 실행할 수 있습니다. 연동실행은 TensorFlow, ONNX, PyTorch, 사용자 지정 Python® 모델을 포함하여 Python 기반 모델에 대해 지원됩니다. PyTorch 모델의 경우, PyTorchModel 객체를 사용하여 MATLAB에서 직접 모델을 실행할 수 있습니다. 이 객체는 MATLAB–Python 인터페이스를 통해 Python으로 모델을 실행하는 래퍼 역할을 하며, 모델을 가져올 필요 없이 연동할 수 있도록 지원합니다. arrayToTorchTensor 함수와 torchTensorToArray 함수를 사용하여 MATLAB 숫자형 배열과 PyTorch 텐서 간에 변환할 수도 있습니다.
앱
| 심층 신경망 디자이너 | 딥러닝 신경망을 설계하고 시각화합니다 |
함수
객체
PyTorchModel | Reference to a PyTorch model for Python execution (R2026b 이후) |
도움말 항목
가져오기
- Use PyTorch and MATLAB for Deep Learning Workflows
Learn how to use PyTorch models with MATLAB and Simulink® for deep learning workflows. - Interoperability Between Deep Learning Toolbox, TensorFlow, PyTorch, and ONNX
Learn how to import networks from TensorFlow, Keras 3, 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 from TensorFlow, Keras, PyTorch, and ONNX. - Import PyTorch Model Using Deep Network Designer
This example shows how to import a PyTorch® model interactively by using the Deep Network Designer app. (R2023b 이후) - 사전 훈련된 심층 신경망
분류, 전이 학습 및 특징 추출을 위해 사전 훈련된 컨벌루션 신경망을 다운로드하고 사용하는 방법을 알아봅니다. - Inference Comparison Between TensorFlow and Imported Networks for Image Classification
Perform prediction in TensorFlow with a pretrained network, import the network into MATLAB usingimportTensorFlowNetwork, 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 usingimportONNXNetwork, and then compare inference results between ONNX and MATLAB networks. - Classify Images in Simulink with Imported TensorFlow Network
Import a pretrained TensorFlow network usingimportTensorFlowNetwork, 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™. - View Autogenerated Custom Layers Using Deep Network Designer
This example shows how to import a pretrained TensorFlow™ network and view the autogenerated layers in Deep Network Designer. - Verify Robustness of Imported ONNX Network
This example shows how to verify the adversarial robustness of an imported ONNX™ deep neural network. (R2024a 이후)
Simulink 블록에 대한 Python 연동실행
- Classify Images Using TensorFlow Model Predict Block
Classify images using TensorFlow Model Predict block. - Classify Images Using ONNX Model Predict Block
Classify images using ONNX Model Predict block. - Classify Images Using PyTorch Model Predict Block
Classify images using PyTorch Model Predict block. - Predict Responses Using TensorFlow Model Predict Block
Predict Responses Using TensorFlow Model Predict block. - Predict Responses Using ONNX Model Predict Block
Predict Responses Using ONNX Model Predict block. - Predict Responses Using PyTorch Model Predict Block
Predict Responses Using PyTorch Model Predict block. - Predict Responses Using Custom Python Model in Simulink (Statistics and Machine Learning Toolbox)
This example shows how to use the Custom Python Model Predict (Statistics and Machine Learning Toolbox) block for prediction in Simulink®. - Set Up Python Environment for Deep Learning with PyTorch Workflows
Configure Python and install PyTorch for use with MATLAB deep learning workflows.
MATLAB 명령줄에서의 PyTorch 연동실행
- Offline Training and Testing of PyTorch Model for CSI Feedback Compression (5G Toolbox)
Train an autoencoder-based PyTorch neural network offline and test for CSI compression. (R2025a 이후)
사용자 지정 계층
- 사용자 지정 딥러닝 계층 정의하기
사용자 지정 딥러닝 계층을 정의하는 방법을 알아봅니다.
관련 정보
- 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-deep-learning-toolbox-converter-for-pytorch-models
- https://www.mathworks.com/matlabcentral/fileexchange/61735-deep-learning-toolbox-importer-for-caffe-models
