• 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:

    • If dataFormat is "channelsLast": [batch, rows, cols, channels]
    • If data_format is "channels_first": [batch, channels, rows, cols].

    Output shape: 4D with shape:

    • If dataFormat is "channelsLast": [batch, croppedRows, croppedCols, channels]
    • If dataFormat is "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]

    Parameters

    • args: Cropping2DLayerArgs

    Returns Cropping2D

    Doc

Generated using TypeDoc