Simulink 深度学习
使用 Simulink 扩展深度学习工作流
通过使用 Deep Learning Toolbox™ 中包含的 Deep Neural Networks、Python Neural Networks 和 Deep Learning Layers 模块库中的模块,或使用 Computer Vision Toolbox™ 中包含的 Analysis & Enhancement 模块库中的 Deep Learning Object Detector 模块,在 Simulink® 模型中实现深度学习功能。
要生成使用 Deep Learning Layers 模块库来表示网络的 Simulink 模型,请使用 exportNetworkToSimulink
函数。
Simulink 中某些深度学习功能使用的 MATLAB Function 模块需要支持的编译器。对于大多数平台,会随 MATLAB® 安装提供一个默认的 C 编译器。使用 C++ 语言时,必须安装兼容的 C++ 编译器。要查看支持的编译器列表,请打开支持和兼容的编译器,点击与您的操作系统对应的选项卡,找到 Simulink Product Family 表,并转至 For Model Referencing, Accelerator mode, Rapid Accelerator mode, and MATLAB Function blocks 列。如果您的系统上安装了多个 MATLAB 支持的编译器,可以使用 mex -setup
命令更改默认编译器。请参阅更改默认编译器。
函数
exportNetworkToSimulink | Generate Simulink model that contains deep learning layer blocks that correspond to deep learning layer objects (自 R2024b 起) |
模块
主题
深度学习层模块
- List of Deep Learning Layer Blocks
Discover all the deep learning layer blocks in Simulink. - Implement Unsupported Deep Learning Layer Blocks
TheexportNetworkToSimulink
function converts deep learning layer objects in adlnetwork
object to deep learning layer blocks in a Simulink model.
图像
- 使用 GoogLeNet 对 Simulink 中的图像进行分类
此示例说明如何使用Image Classifier
模块对 Simulink® 中的图像进行分类。此示例使用预训练的深度卷积神经网络 GoogLeNet 执行分类。 - Acceleration for Simulink Deep Learning Models
Improve simulation speed with accelerator and rapid accelerator modes. - Lane and Vehicle Detection in Simulink Using Deep Learning
This example shows how to use deep convolutional neural networks inside a Simulink® model to perform lane and vehicle detection. - Classify ECG Signals in Simulink Using Deep Learning
This example shows how to use wavelet transforms and a deep learning network within a Simulink (R) model to classify ECG signals. - 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.
序列
- Predict and Update Network State in Simulink
This example shows how to predict responses for a trained recurrent neural network in Simulink® by using theStateful Predict
block. - Classify and Update Network State in Simulink
This example shows how to classify data for a trained recurrent neural network in Simulink® by using theStateful Classify
block. - Speech Command Recognition in Simulink
Detect the presence of speech commands in audio using a Simulink model. - Time Series Prediction in Simulink Using Deep Learning Network
This example shows how to use an LSTM deep learning network inside a Simulink® model to predict the remaining useful life (RUL) of an engine. - Simulate Calorie Burn Using Neural Network in Simulink
This example shows how to include a simple fully connected neural network in a Simulink® model that predicts calorie burn when given five time steps of sensor readings from a smart watch. - Battery State of Charge Estimation Using Deep Learning
Define requirements, prepare data, train deep learning networks, verify robustness, integrate networks into Simulink, and deploy models. (自 R2024b 起) - Physical System Modeling Using LSTM Network in Simulink
This example shows how to create a reduced order model (ROM) to replace a Simscape component in a Simulink® model by training a long short-term memory (LSTM) neural network. - Improve Performance of Deep Learning Simulations in Simulink
This example shows how to use code generation to improve the performance of deep learning simulations in Simulink®.
强化学习
- Control Water Level in a Tank Using a DDPG Agent
Train a controller using reinforcement learning with a plant modeled in Simulink as the training environment. - Train DDPG Agent for Adaptive Cruise Control
Train a reinforcement learning agent for an adaptive cruise control application. - Train DQN Agent for Lane Keeping Assist Using Parallel Computing
Train a reinforcement learning agent for a lane keeping assist application. - Train DDPG Agent for Path-Following Control
Train a reinforcement learning agent for a lane following application.
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®.
代码生成
- 从 Simulink 应用生成深度学习代码
生成用于在桌面或嵌入式目标上部署的 C/C++ 和 GPU 代码 - Export Network to FMU
This example shows how to export a trained network as a Functional Mock-up Unit (FMU). (自 R2023b 起)