Main Content

resize2dlayer.

2-D调整层

Description

2-D调整层的大小将由比例系数的2-D输入,指定的高度和宽度,或参考输入特征映射的大小。Use of this layer requires Deep Learning Toolbox™.

创建

Description

例子

tillay = resize2dlayer('Scale',scale的)创建一个2-D调整层并设置Scaleproperty as the scale factor specified byscale

例子

tillay = resize2dlayer('outputsize',输出的)创建一个2-D调整层并设置输出属性具有指定的高度和宽度输出

例子

tillay = resize2dlayer('EnableRefifficInput',TF)创建一个2-D调整层并设置EnableReferenceInput.property with the boolean specified byTF.。When you specify the value astrue,该图层添加了接受引用特征映射的附加输入,并将输入大小调整为参考特征映射的大小。

例子

tillay = resize2dlayer(___姓名那Value的)设置可选方法GeometricTransformMode.NearestRoundingMode那and姓名属性使用名称值对参数。您可以指定多个名称值对参数。将每个属性名称括在单引号中。

Example:tillay = resize2dlayer('outputsize',[128 128],'方法','bilinear')creates a 2-D resize layer that resizes input to 128-by-128 pixels using bilinear interpolation

特性

expand all

Resize

调整输入大小的规模因子,指定为正数的2元素行向量。比例因子分别用于行和列尺寸。创建图层时,可以指定Scaleas a scalar to use the same value for both dimensions.

调整大小输入的输出大小,指定为表单的正整数的2元素行向量[批号尼尔斯]。您可以将一个元素指定为NAN,在这种情况下,该图层自动计算值以保留输入的宽高比。

添加参考功能映射作为输入to the layer, specified asa numeric or logical0.错误的的)or1true的)。When you specify the value astrue,该图层调整输入的高度和宽度以匹配引用特征图的高度和宽度。调整大小操作不会改变输入的通道数。

When you enable a reference feature map, the inputs to the layer have the names'in1'and'ref'那where'ref'is the name of the reference feature map. Use the input names when connecting or disconnecting the layer by usingconnectLayers(深度学习工具箱)ordisconnectLayers(深度学习工具箱)

Interpolation method, specified as'nearest'for nearest neighbor interpolation or'双线性'用于双线性插值。

几何变换模式to map points from input space to output space, specified as'半像素'or'asymmetric'

最近邻插值的舍入模式,指定为以下之一。

  • '圆形的'- 使用与matlab相同的舍入行为®round功能。

  • 'floor'- 使用与matlab相同的舍入行为floor功能。

  • 'onnx-10'- 再现Onnx™(开放神经网络交换)Opset 10调整运算符的调整大小行为。

此属性有效方法property is'nearest'

Layer

图层名称那specified as a character vector or a string scalar. ForLayer阵列输入,trainNetworkassembleNetworklayerGraph那anddlnetworkfunctions automatically assign names to layers with姓名调成''

数据类型:char|细绳

图层的输入数,指定为1when theEnableReferenceInput.property is错误的or2when theEnableReferenceInput.property istrue

数据类型:double

输入名称of the layer, specified as{'在'}when theEnableReferenceInput.property is错误的or{'in','ref'}when theEnableReferenceInput.property istrue

数据类型:cell

This property is read-only.

产出数量of the layer. This layer has a single output only.

数据类型:double

This property is read-only.

Output names of the layer. This layer has a single output only.

数据类型:cell

Examples

collapse all

创建一个2-D调整层with a horizontal scale factor of 2 and a vertical scale factor of 4.

tillay = resize2dlayer('Scale',[2 4])
tillay = resize2dlayer with属性:name:''缩放:[2 4]输出:[] EnableRefirewInput:0方法:'最近的'GeometricTransformMode:'半像素'referyRoundingMode:'圆'学习参数无属性。状态参数无属性。显示所有属性

创建一个2-D调整层named 'resize224' with an output size of [224 224].

tillay = resize2dlayer('输出',[224 224],'姓名''resize224'的)
layer = Resize2DLayer with properties: Name: 'resize224' Scale: [] OutputSize: [224 224] EnableReferenceInput: 0 Method: 'nearest' GeometricTransformMode: 'half-pixel' NearestRoundingMode: 'round' Learnable Parameters No properties. State Parameters No properties. Show all properties

创建一个n array of layers that includes a 2-D resize layer that accepts a reference input feature map.

图层= [imageInputlayer([32 32 3],'姓名''image'的)resize2dlayer.('EnableReferenceInput',真的,'姓名''resize'的)]
layers = 2x1 Layer array with layers: 1 'image' Image Input 32x32x3 images with 'zerocenter' normalization 2 'resize' Resize nnet.cnn.layer.Resize2DLayer

创建一个layerGraph。2-D调整层的第一个输入自动连接到图像输入层的输出。

lgraph = layerGraph(layers);

连接'ref'将2-D的输入调整为通过使用使用的图层的输出,该图层提供参考特征映射的图层connectLayers功能。This example shows a trivial connection in which the'ref'输入也连接到图像输入层的输出。

Lgraph = ConnectLayers(Lapraphay,'image''调整大小/ ref'的);

创建一个名为“Rescale0.5”的2-D调整大小层,均匀比例因子为0.5。指定插值方法作为双线性插值。

tillay = resize2dlayer('Scale'那0.。5,'方法''双线性''姓名''Rescale0.5'的)
layer = Resize2DLayer with properties: Name: 'rescale0.5' Scale: [0.5000 0.5000] OutputSize: [] EnableReferenceInput: 0 Method: 'bilinear' GeometricTransformMode: 'half-pixel' NearestRoundingMode: 'round' Learnable Parameters No properties. State Parameters No properties. Show all properties

References

[1]开放神经网络交换https://github.com/onnx/

[2]ONNXhttps://onnx.ai/

扩展能力

GPU代码生成
Generate CUDA® code for NVIDIA® GPUs using GPU Coder™.

也可以看看

||(深度学习工具箱)|(深度学习工具箱)|(深度学习工具箱)

话题

在R2020B中介绍