Main Content

resize3dLayer

3-D resize layer

Description

A 3-D resize layer resizes 3-D input by a scale factor or to a specified height, width, and depth. Use of this layer requires Deep Learning Toolbox™.

Creation

Description

example

layer = resize3dLayer('Scale',scale) creates a 3-D resize layer and sets the Scale property as the scale factor specified by scale.

example

layer = resize3dLayer('OutputSize',outputSize) creates a 3-D resize layer and sets the OutputSize property with the height and width specified by outputSize.

example

layer = resize3dLayer(___,Name,Value) sets the optional Method, GeometricTransformMode, NearestRoundingMode, and Name properties using name-value pair arguments. You can specify multiple name-value pair arguments. Enclose each property name in single quotes.

Properties

expand all

Resize

Scale factor to resize input, specified as 3-element row vector of positive numbers. The scale factors are for the row, column, and plane dimensions, respectively. When creating the layer, you can specify Scale as a scalar to use the same value for all dimensions.

Output size of resized input, specified as a 3-element row vector of positive integers of the form [nrows ncols nplanes]. You can specify two elements as NaN, in which case the layer computes the values automatically to preserve the aspect ratio of the input.

Interpolation method, specified as 'nearest' for nearest neighbor interpolation or 'trilinear' for trilinear interpolation.

Geometric transformation mode to map points from input space to output space, specified as'half-pixel' or 'asymmetric'.

Rounding mode for nearest neighbor interpolation, specified as 'round' or 'onnx-10'. The value 'round' uses the same rounding behavior as the MATLAB® round function. The value 'onnx-10' reproduces the resizing behavior of the ONNX™ (Open Neural Network Exchange) opset 10 resize operator.

This property is valid when the Method property is 'nearest'.

Layer

Layer name, specified as a character vector or a string scalar. To include a layer in a layer graph, you must specify a nonempty unique layer name. If you train a series network with the layer and Name is set to '', then the software automatically assigns a name to the layer at training time.

Data Types: char | string

Number of inputs of the layer. This layer accepts a single input only.

Data Types: double

Input names of the layer. This layer accepts a single input only.

Data Types: cell

Number of outputs of the layer. This layer has a single output only.

Data Types: double

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

Data Types: cell

Examples

collapse all

Create a 3-D resize layer. Specify a horizontal and vertical scale factor of 2 and a depthwise scale factor of 4.

layer = resize3dLayer('Scale',[2 2 4])
layer = 
  Resize3DLayer with properties:

                      Name: ''
                     Scale: [2 2 4]
                OutputSize: []
                    Method: 'nearest'
    GeometricTransformMode: 'half-pixel'
       NearestRoundingMode: 'round'

  Show all properties

Create a 3-D resize layer named 'resize224' with an output size of [224 224 224].

layer = resize3dLayer('OutputSize',[224 224 224],'Name','resize224')
layer = 
  Resize3DLayer with properties:

                      Name: 'resize224'
                     Scale: []
                OutputSize: [224 224 224]
                    Method: 'nearest'
    GeometricTransformMode: 'half-pixel'
       NearestRoundingMode: 'round'

  Show all properties

Create a 3-D resize layer named 'rescale0.5' with a uniform scale factor of 0.5. Specify the interpolation method as trilinear interpolation.

layer = resize3dLayer('Scale',0.5,'Method','trilinear','Name','rescale0.5')
layer = 
  Resize3DLayer with properties:

                      Name: 'rescale0.5'
                     Scale: [0.5000 0.5000 0.5000]
                OutputSize: []
                    Method: 'trilinear'
    GeometricTransformMode: 'half-pixel'
       NearestRoundingMode: 'round'

  Show all properties

References

[1] Open Neural Network Exchange. https://github.com/onnx/.

[2] ONNX. https://onnx.ai/.

See Also

| | (Deep Learning Toolbox) | (Deep Learning Toolbox) | (Deep Learning Toolbox)

Topics

Introduced in R2020b