Cropping layer for 2D input (e.g., image).
This layer can crop an input at the top, bottom, left and right side of an image tensor.
Input shape: 4D tensor with shape:
dataFormat
"channelsLast"
[batch, rows, cols, channels]
data_format
"channels_first"
[batch, channels, rows, cols]
Output shape: 4D with shape:
[batch, croppedRows, croppedCols, channels]
"channelsFirst"
[batch, channels, croppedRows, croppedCols]
Examples
const model = tf.sequential();model.add(tf.layers.cropping2D({cropping:[[2, 2], [2, 2]], inputShape: [128, 128, 3]}));//now output shape is [batch, 124, 124, 3] Copy
const model = tf.sequential();model.add(tf.layers.cropping2D({cropping:[[2, 2], [2, 2]], inputShape: [128, 128, 3]}));//now output shape is [batch, 124, 124, 3]
Generated using TypeDoc
Cropping layer for 2D input (e.g., image).
This layer can crop an input at the top, bottom, left and right side of an image tensor.
Input shape: 4D tensor with shape:
dataFormat
is"channelsLast"
:[batch, rows, cols, channels]
data_format
is"channels_first"
:[batch, channels, rows, cols]
.Output shape: 4D with shape:
dataFormat
is"channelsLast"
:[batch, croppedRows, croppedCols, channels]
dataFormat
is"channelsFirst"
:[batch, channels, croppedRows, croppedCols]
.Examples