主要内容

pretrainedEncoderNetwork

创建网络从网络pretrained编码器

自从R2021a

描述

例子

= pretrainedEncoderNetwork (networkName,深度)网络创造了一个编码器,从pretrained网络,networkName。编码器网络执行深度将采样操作。

这个函数需要深度学习工具箱™。

例子

(,outputNames)= pretrainedEncoderNetwork (networkName,深度)还返回名称,outputNames前,激活层发生直接将采样操作。这些激活对应于感兴趣的特性在特定的空间分辨率或尺度。金宝搏官方网站

例子

全部折叠

创建一个编码器和三个将采样操作基于SqueezeNet pretrained网络。

encoderNet = pretrainedEncoderNetwork (“squeezenet”3)
encoderNet = dlnetwork属性:层:[33 x1 nnet.cnn.layer.Layer]连接:[36 x2表]可学的:[26 x3表]状态:[0 x3表]InputNames:{“数据”}OutputNames: {“fire5-concat”}初始化:1观点总结总结。

显示网络编码器。

analyzeNetwork (encoderNet)

创建一个甘编码器网络四个将采样操作从一个pretrained GoogLeNet网络。

深度= 4;[编码器,outputNames] = pretrainedEncoderNetwork (“googlenet”、深度);

确定输入编码器网络的大小。

inputSize = encoder.Layers (1) .InputSize;

确定激活层编码器的输出大小网络通过创建一个示例数据输入,然后调用向前,它返回激活。

exampleInput = dlarray (0 (inputSize),SSC的);exampleOutput =细胞(1、长度(outputNames));[exampleOutput{}): =前进(exampleInput编码器,“输出”,outputNames);

在译码器模块确定通道的数量在每个激活第三通道的长度。

numChannels = cellfun (@ (x)大小(extractdata (x), 3), exampleOutput);numChannels = fliplr (numChannels (1: end-1));

定义一个函数创建一个数组一个译码器块的层。

decoderBlock = @(块)[transposedConv2dLayer (2, numChannels(块),“步”2)convolution2dLayer (numChannels(块),“填充”,“相同”)reluLayer convolution2dLayer (numChannels(块),“填充”,“相同”)reluLayer);

创建解码器模块与相同数量的upsampling块有downsampling块编码器模块。

解码器= blockedNetwork (decoderBlock、深度);

创建U-Net网络通过连接编码器模块和解码模块和添加跳过连接。

网= encoderDecoderNetwork(224 224 3,编码器,译码器,“OutputChannels”3,“SkipConnections”,“连接”)
网= dlnetwork属性:层:x1 nnet.cnn.layer.Layer[139]连接:[167 x2表]可学的:[116 x3表]状态:[0 x3表]InputNames:{“数据”}OutputNames: {“encoderDecoderFinalConvLayer”}初始化:1观点总结总结。

显示网络。

analyzeNetwork(净)

输入参数

全部折叠

Pretrained网络名称,指定为一个字符串值。您必须安装相关插件所选pretrained网络。

  • “alexnet”——看alexnet(深度学习工具箱)为更多的信息。

  • “googlenet”——看googlenet(深度学习工具箱)为更多的信息。

  • “inceptionresnetv2”——看inceptionresnetv2(深度学习工具箱)为更多的信息。

  • “inceptionv3”——看inceptionv3(深度学习工具箱)为更多的信息。

  • “mobilenetv2”——看mobilenetv2(深度学习工具箱)为更多的信息。

  • “resnet18”——看resnet18(深度学习工具箱)为更多的信息。

  • “resnet50”——看resnet50(深度学习工具箱)为更多的信息。

  • “resnet101”——看resnet101(深度学习工具箱)为更多的信息。

  • “squeezenet”——看squeezenet(深度学习工具箱)为更多的信息。

  • “vgg16”——看vgg16(深度学习工具箱)为更多的信息。

  • “vgg19”——看vgg19(深度学习工具箱)为更多的信息。

数据类型:字符|字符串

编码器将采样操作的数量,指定为一个正整数。编码器downsamples输入2倍^深度。你不能指定一个深度大于pretrained网络的深度。

输出参数

全部折叠

编码器网络,作为一个返回dlnetwork(深度学习工具箱)对象。网络已经深度不同的空间分辨率。金宝搏官方网站编码器网络的最后一层是一层,直接在下次pretrained网络将采样操作。

在网络层的名字直接将采样操作之前,作为字符串返回向量。

版本历史

介绍了R2021a