艾曼努伊尔·佐拉科勒菲瑟拉基斯,MathWorks
用MATLAB®在R2020b中,您可以使用深度学习工具箱™块库以及MATLAB函数块在Simulink中模拟和生成训练过的深度学习模型的代码金宝app®.
了解如何在Simulink中用控制、信号处理和传感器融合组件模拟深度学习网络,以评估深度学习模型对系统金宝app级性能的影响。了解更多关于使用NVIDIA的信息®GPU可加速在Simulink中执行深度学习网络模型。金宝app
从MATLAB的R2020b版本开始®,您可以使用MATLAB函数块以及深度学习工具箱™块库,在Simulink中模拟和生成经过训练的深度学习模型的代码金宝app®.例如,要设计一个高速公路车道跟踪系统,你可以使用深度学习块创建一个Simulink子系统来执行车道和车辆检测,将这个子系统与一个更大的Simulink模型集成,该模型包括额外的组件,如车辆动力学模型、车道跟踪控金宝app制器、传感器融合和三维可视化,并在部署前通过系统级仿真验证总体设计性能。让我们看看如何在Simulink中创建一个执行车辆和车道检测的子系统。金宝app我们首先需要的是一个c++编译器。我们还需要支持包,提供从MATLAB编码器™金宝app和GPU编码器™到特定目标深度学习库的接口。最后,我们假设我们有一个预训练的车道检测网络以及一个预训练的yolov2车辆检测器存储在MATLAB文件中。在Simuli金宝appnk模型中,我们正在读取一个交通视频文件,在车辆和车道检测部分之后,我们将再次显示带有车道和车辆标注的交通视频。对于车道检测,首先我们调整视频帧的大小,以匹配训练车道检测网络所期望的输入。接下来,我们将使用来自深度学习块库的“Predict”块对经过训练的网络进行推理。 To link the block to the lane detector object we are providing the path to the appropriate MATLAB file. Another option here would be to use a MATLAB function. The predict block will output two lane boundaries represented by a parabolic equation with 3 parameters that are then transformed into lanes in image coordinates. For vehicle detection, we will use a MATLAB Function block to perform inference on the pretrained yolov2 vehicle detector. Inside the MATLAB Function block we will load the pretrained network, and call the detect method to get the bounding boxes and associated confidence scores. Next, we will specify the dimensions of the block outputs. The MATLAB Function block can also be used with other types of networks like LSTMs, and you can also use it to output activations from specific layers of the network. The last thing we need to do before we run the simulation, is to set the simulation target language to C++ in the model settings. Clicking the Run button will under the hood generate code from the Predict and MATLAB Function blocks and compile it for CPU-accelerated simulation. The output of the simulation displays the annotated traffic video as expected. Finally, you can also use GPU Coder with NVIDIA®GPU加速Simulink中深度学习模型的模拟。要为GPU加速配置模型,请选中模型设置中模拟目标下的“GPU加速”金宝app框。一旦系统设计在仿真中得到验证,就可以从Simulink模型生成代码进行部署。您可以使用Simulink编码器™, 嵌入式编码器®或GPU编码器生成C++或CUDA代码并在英特尔上部署深度学习网络®臂®,或NVIDIA平台。
您还可以从以下列表中选择网站:
选择中国站点(中文或英文)以获得最佳站点性能。其他MathWorks国家/地区网站未针对您所在地的访问进行优化。