Neural network layer in a neural network that can be used to crop an input feature map
A crop layer contains information about how to crop a feature map.
A crop layer has two inputs:
'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 Neural Network
layer = crop2dLayer('centercrop')
layer = crop2dLayer(Location)
layer = crop2dLayer(___,'Name',Name)
layer = crop2dLayer('centercrop') 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
layer = crop2dLayer(___,'Name',Name) creates
a layer for cropping and sets the optional
Name— Layer name
''(default) | character vector
Layer name, specified as a character vector. If
is set to
'', then the software automatically assigns a name at
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
Create a 2-D drop 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]