Neural network layer in a neural network that can be used to crop an input feature map
A 2-D crop layer applies 2-D cropping to the input.
There are two inputs to this layer:
'in' — The feature map that will be cropped
'ref' — A reference layer used to determine the size,
width], of the cropped output
Once you create this layer, you can add it to a
make serial connections between layers. To connect the crop layer to other layers, call
connectLayers and specify the input names. The
connectLayers function returns a connected
LayerGraph object ready to train a network. Connecting layers
requires Deep Learning
layer = crop2dLayer(Mode)
layer = crop2dLayer(Location)
layer = crop2dLayer(___,'Name',Name)
layer = crop2dLayer( returns a
layer that crops an input feature map, and sets the
layer = crop2dLayer(
returns a layer that crops an input feature map using a rectangular window, and
property that indicates the position of
Mode— Cropping mode
Cropping mode, specified as
|The location of the cropping window is the center of the input feature map.|
|The location of the cropping window is based on the
Location— Cropping window location
'auto'(default) | 2-element row vector
Cropping window location, specified as
'auto' or a
2-element row vector.
2-element row vector in the format [x y]
The upper-left corner of the cropping window is at the location [x y] of the input feature map. x indicates the location in the horizontal direction and y is the vertical direction.
|The cropping window is located at the center of the
input feature map. This value is automatically set when
NumInputs— Number of inputs
Number of inputs of the layer. This layer has two inputs.
InputNames— Input names
Input names of the layer. This layer has two inputs, named
NumOutputs— Number of outputs
Number of outputs of the layer. This layer has a single output only.
OutputNames— Output names
Output names of the layer. This layer has a single output only.
Create a 2-D crop layer and connect both of the inputs using a layerGraph object.
Create the layers.
layers = [ imageInputLayer([32 32 3],'Name','image') crop2dLayer('centercrop','Name','crop') ]
layers = 2x1 Layer array with layers: 1 'image' Image Input 32x32x3 images with 'zerocenter' normalization 2 'crop' Crop 2D center crop
layerGraph. The first input of
crop2dLayer is automatically connected to the first output of the image input layer.
lgraph = layerGraph(layers)
lgraph = LayerGraph with properties: Layers: [2x1 nnet.cnn.layer.Layer] Connections: [1x2 table]
Connect the second input to the image layer output.
lgraph = connectLayers(lgraph,'image','crop/ref')
lgraph = LayerGraph with properties: Layers: [2x1 nnet.cnn.layer.Layer] Connections: [2x2 table]