主要内容

深入学习网络的估计性能

减少所需的时间来设计一个自定义的深度学习网络,满足性能要求,部署网络之前,分析层,延迟。比较深入学习网络表现在定制的比特流处理器配置表现在参考(航运)比特流处理器配置。

学习如何使用信息表中的数据estimatePerformance函数来计算你的网络性能,明白了概要推理运行

估计性能的自定义深度学习网络定制的处理器配置

这个例子展示了如何计算深度学习网络性能的一个定制的处理器配置。

  1. 创建一个文件在你当前的工作目录getLogoNetwork.m。在文件中,输入:

    函数网= getLogoNetwork ()如果~ isfile (“LogoNet.mat”)url =“//www.tianjin-qmedu.com/万博1manbetxsupportfiles/gpucoder/cnn_models/logo_detection/LogoNet.mat”;websave (“LogoNet.mat”url);结束data =负载(“LogoNet.mat”);网= data.convnet;结束

    调用这个函数并保存结果snet

    snet = getLogoNetwork;
  2. 创建一个dlhdl.ProcessorConfig对象。

    hPC = dlhdl.ProcessorConfig;
  3. 调用estimatePerformancesnet检索层LogoNet网络延迟和性能水平。

    hPC.estimatePerformance (snet)
    3创建的内存区域。深度学习处理器估计性能结果LastFrameLatency(周期)LastFrameLatency总延迟(秒)FramesNum帧/ s - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -网络39853460 0.19927 - 1 39853460 5.0 conv_1 6825287 0.03413 maxpool_1 39853460 0.01878 conv_2 10440701 conv_3 0.05220 maxpool_2 1447840 0.00724 10440701 0.04697 maxpool_3 1765856 0.00883 conv_4 1765856 0.00885 28098年maxpool_4 0.00014 fc_1 1765856 0.01322 fc_2 1692532 0.00846 89293年fc_3 0.00045 * DL处理器的时钟频率:200 mhz

    了解参数和返回值estimatePerformance,看到。

评估性能的深入学习网络定制的处理器配置

基准深度学习网络的性能在一个定制的比特流配置通过比较参考(航运)比特流上的性能配置。利用比较结果调整您的自定义深度学习处理器参数达到最优性能。

在这个例子中比较的ResNet-18网络的性能zcu102_single比特流配置默认定制的比特流的性能配置。

先决条件

  • 深度学习HDL工具箱™支持包Xilinx FPGA和S万博1manbetxoC

  • 深度学习工具箱™

  • 深度学习HDL工具箱™

  • 深度学习工具箱ResNet-18网络模型

负载Pretrained网络

加载pretrained网络。

snet = resnet18;

检索zcu102_single比特流配置

检索zcu102_single比特流配置,使用dlhdl.ProcessorConfig对象。有关更多信息,请参见dlhdl.ProcessorConfig。了解处理器的可修改的参数配置,明白了getModulePropertysetModuleProperty

hPC_shipping = dlhdl.ProcessorConfig (“比特流”,“zcu102_single”)
hPC_shipping =处理模块”conv“ModuleGeneration:‘“LRNBlockGeneration:”“ConvThreadNumber: 16 InputMemorySize: [227 227 3] OutputMemorySize: [227 227 3] FeatureSizeLimit: 2048处理模块“俱乐部”ModuleGeneration:”“SoftmaxBlockGeneration:‘off’FCThreadNumber: 4 InputMemorySize: 25088 OutputMemorySize: 4096处理模块”加法器“ModuleGeneration:”“InputMemorySize: 40 OutputMemorySize: 40处理器RunTimeControl顶级属性:“注册”InputDataInterface:“外部存储器”OutputDataInterface:“外部存储器”ProcessorDataType:单一的系统级属性TargetPlatform:“Xilinx Zynq UltraScale + MPSoC ZCU102评估工具包”TargetFrequency: 220 SynthesisTool:“Xilinx Vivado”ReferenceDesign:“AXI-Stream DDR内存访问:3-AXIM”SynthesisToolChipFamily:“Zynq UltraScale + ' SynthesisToolDeviceName:“xczu9eg-ffvb1156-2-e”SynthesisToolPackageName:“SynthesisToolSpeedValue:“

估计ResNet-18性能zcu102_single比特流的配置

估计的性能ResNet-18 DAG网络使用estimatePerformance的函数dlhdl.ProcessorConfig对象。函数返回估计层延迟,网络延迟和网络性能每秒的帧(帧/ s)。

hPC_shipping.estimatePerformance (snet)
# # #系列优化网络:融合“nnet.cnn.layer.BatchNormalizationLayer”到“nnet.cnn.layer.Convolution2DLayer”# # #注意:图层的数据型“nnet.cnn.layer.ImageInputLayer”是在软件中实现。# # #注意:层“ClassificationLayer_predictions”型“nnet.cnn.layer.ClassificationOutputLayer”是在软件中实现。深度学习处理器估计性能结果LastFrameLatency(周期)LastFrameLatency总延迟(秒)FramesNum帧/ s - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -网络23634966 0.10743 646226 0.00984 23634966 9.3 ____conv1 23634966 ____pool1 0.00294 ____res2a_branch2a 0.00096 966221 0.00439 ____res2a_branch2b 966221 0.00439 210750年____res2a ____res2b_branch2a 0.00096 966221 0.00439 ____res2b_branch2b 966221 0.00439 210750年____res2b ____res3a_branch1 0.00418 540749 0.00246 ____res3a_branch2a 763860 0.00347 919117年____res3a_branch2b ____res3a 0.00418 105404 0.00048 ____res3b_branch2a 919117 0.00418 919117年____res3b_branch2b ____res3b 0.00231 105404 0.00048 ____res4a_branch1 509261 0.00231 509261年____res4a_branch2a ____res4a_branch2b 0.00412 905421 0.00412 ____res4a 52724 0.00024 905421年____res4b_branch2a ____res4b_branch2b 905421 0.00412 52724年____res4b 0.00024 ____res5a_branch1 1046605 0.00476 ____res5a_branch2b ____res5a_branch2a 1046605 0.00476 2005197 0.00911 26368年____res5a 0.00012 ____res5b_branch2a 0.00911 ____res5b 26368 0.00012 2005197 0.00911 ____res5b_branch2b 2005197 ____pool5 54594 0.00025 ____fc1000 207852 0.00094 * DL处理器的时钟频率是:220 mhz

创建自定义处理器配置

创建一个定制的处理器配置,使用dlhdl.ProcessorConfig对象。有关更多信息,请参见dlhdl.ProcessorConfig。了解处理器的可修改的参数配置,明白了getModulePropertysetModuleProperty

hPC_custom = dlhdl.ProcessorConfig
hPC_custom =处理模块”conv“ModuleGeneration:‘“LRNBlockGeneration:”“ConvThreadNumber: 16 InputMemorySize: [227 227 3] OutputMemorySize: [227 227 3] FeatureSizeLimit: 2048处理模块“俱乐部”ModuleGeneration:”“SoftmaxBlockGeneration:‘off’FCThreadNumber: 4 InputMemorySize: 25088 OutputMemorySize: 4096处理模块”加法器“ModuleGeneration:”“InputMemorySize: 40 OutputMemorySize: 40处理器RunTimeControl顶级属性:“注册”InputDataInterface:“外部存储器”OutputDataInterface:“外部存储器”ProcessorDataType:单一的系统级属性TargetPlatform:“Xilinx Zynq UltraScale + MPSoC ZCU102评估工具包”TargetFrequency: 200 SynthesisTool:“Xilinx Vivado”ReferenceDesign:“AXI-Stream DDR内存访问:3-AXIM”SynthesisToolChipFamily:“Zynq UltraScale + ' SynthesisToolDeviceName:“xczu9eg-ffvb1156-2-e”SynthesisToolPackageName:“SynthesisToolSpeedValue:“

估计ResNet-18定制的比特流的性能配置

估计的性能ResNet-18 DAG网络使用estimatePerformance的函数dlhdl.ProcessorConfig对象。函数返回估计层延迟,网络延迟和网络性能每秒的帧(帧/ s)。

hPC_custom.estimatePerformance (snet)
# # #系列优化网络:融合“nnet.cnn.layer.BatchNormalizationLayer”到“nnet.cnn.layer.Convolution2DLayer”# # #注意:图层的数据型“nnet.cnn.layer.ImageInputLayer”是在软件中实现。# # #注意:层“ClassificationLayer_predictions”型“nnet.cnn.layer.ClassificationOutputLayer”是在软件中实现。深度学习处理器估计性能结果LastFrameLatency(周期)LastFrameLatency总延迟(秒)FramesNum帧/ s - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -网络21219873 0.10610 646226 0.01083 21219873 9.4 ____conv1 21219873 ____pool1 0.00323 ____res2a_branch2a 0.00105 966221 0.00483 ____res2a_branch2b 966221 0.00483 210750年____res2a ____res2b_branch2a 0.00105 966221 0.00483 ____res2b_branch2b 966221 0.00483 210750年____res2b ____res3a_branch1 0.00460 540749 0.00270 ____res3a_branch2a 708564 0.00354 919117年____res3a_branch2b ____res3a 0.00460 105404 0.00053 ____res3b_branch2a 919117 0.00460 919117年____res3b_branch2b ____res3b 0.00255 105404 0.00053 ____res4a_branch1 509261 0.00255 509261年____res4a_branch2a ____res4a_branch2b 0.00453 905421 0.00453 ____res4a 52724 0.00026 905421年____res4b_branch2a ____res4b_branch2b 905421 0.00453 ____res4b 52724 0.00026 ____res5a_branch1 751693 0.00376 ____res5a_branch2b ____res5a_branch2a 751693 0.00376 1415373 0.00708 26368年____res5a 0.00013 ____res5b_branch2a 0.00708 ____res5b 26368 0.00013 1415373 0.00708 ____res5b_branch2b 1415373 ____pool5 54594 0.00027 ____fc1000 207351 0.00104 * DL处理器的时钟频率是:200 mhz

ResNet-18网络定制的比特流的性能配置低于上的性能zcu102_single比特流配置。自定义的区别和比特流配置zcu102_single比特流配置目标频率。

修改自定义处理器配置

修改自定义处理器配置增加目标频率。了解处理器的可修改的参数配置,明白了dlhdl.ProcessorConfig

hPC_custom。TargetFrequency = 220;hPC_custom
hPC_custom =处理模块”conv“ModuleGeneration:‘“LRNBlockGeneration:”“ConvThreadNumber: 16 InputMemorySize: [227 227 3] OutputMemorySize: [227 227 3] FeatureSizeLimit: 2048处理模块“俱乐部”ModuleGeneration:”“SoftmaxBlockGeneration:‘off’FCThreadNumber: 4 InputMemorySize: 25088 OutputMemorySize: 4096处理模块”加法器“ModuleGeneration:”“InputMemorySize: 40 OutputMemorySize: 40处理器RunTimeControl顶级属性:“注册”InputDataInterface:“外部存储器”OutputDataInterface:“外部存储器”ProcessorDataType:单一的系统级属性TargetPlatform:“Xilinx Zynq UltraScale + MPSoC ZCU102评估工具包”TargetFrequency: 220 SynthesisTool:“Xilinx Vivado”ReferenceDesign:“AXI-Stream DDR内存访问:3-AXIM”SynthesisToolChipFamily:“Zynq UltraScale + ' SynthesisToolDeviceName:“xczu9eg-ffvb1156-2-e”SynthesisToolPackageName:“SynthesisToolSpeedValue:“

重新评估ResNet-18修改定制的比特流的性能配置

估计的性能ResNet-18 DAG网络修改自定义比特流配置。

hPC_custom.estimatePerformance (snet)
# # #系列优化网络:融合“nnet.cnn.layer.BatchNormalizationLayer”到“nnet.cnn.layer.Convolution2DLayer”# # #注意:图层的数据型“nnet.cnn.layer.ImageInputLayer”是在软件中实现。# # #注意:层“ClassificationLayer_predictions”型“nnet.cnn.layer.ClassificationOutputLayer”是在软件中实现。深度学习处理器估计性能结果LastFrameLatency(周期)LastFrameLatency总延迟(秒)FramesNum帧/ s - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -网络23634966 0.10743 646226 0.00984 23634966 9.3 ____conv1 23634966 ____pool1 0.00294 ____res2a_branch2a 0.00096 966221 0.00439 ____res2a_branch2b 966221 0.00439 210750年____res2a ____res2b_branch2a 0.00096 966221 0.00439 ____res2b_branch2b 966221 0.00439 210750年____res2b ____res3a_branch1 0.00418 540749 0.00246 ____res3a_branch2a 763860 0.00347 919117年____res3a_branch2b ____res3a 0.00418 105404 0.00048 ____res3b_branch2a 919117 0.00418 919117年____res3b_branch2b ____res3b 0.00231 105404 0.00048 ____res4a_branch1 509261 0.00231 509261年____res4a_branch2a ____res4a_branch2b 0.00412 905421 0.00412 ____res4a 52724 0.00024 905421年____res4b_branch2a ____res4b_branch2b 905421 0.00412 52724年____res4b 0.00024 ____res5a_branch1 1046605 0.00476 ____res5a_branch2b ____res5a_branch2a 1046605 0.00476 2005197 0.00911 26368年____res5a 0.00012 ____res5b_branch2a 0.00911 ____res5b 26368 0.00012 2005197 0.00911 ____res5b_branch2b 2005197 ____pool5 54594 0.00025 ____fc1000 207852 0.00094 * DL处理器的时钟频率是:220 mhz

另请参阅

||||

相关的话题