What is the default kernel-size, Zero-padding and stride for keras.layers.Conv2D?
Asked Answered
H

2

5

What are the default Kernel-Size, Zero-Padding, and Stride arguments in Conv2D (keras.layers.Conv2D)? What happens if these arguments are not specified?

Haifa answered 21/11, 2018 at 9:59 Comment(0)
K
7

You can find the documentation here: https://keras.io/layers/convolutional/

In python you can give default values for parameters of a function, If you don't specify these parameters while calling the function, defaults are used instead.

In the link above you'll find that Conv2D has the parameters:

filters, kernel_size, strides=(1, 1), padding='valid', data_format=None, dilation_rate=(1, 1), activation=None, use_bias=True, kernel_initializer='glorot_uniform', bias_initializer='zeros', kernel_regularizer=None, bias_regularizer=None, activity_regularizer=None, kernel_constraint=None, bias_constraint=None

only filters and kernel_size parameters must be given, others are optional or has default values next to them.

Kynthia answered 21/11, 2018 at 10:14 Comment(0)
A
1

As this link suggests, it has a structure like this:

tf.keras.layers.Conv2D(
    filters,
    kernel_size,
    strides=(1, 1),
    padding="valid",
    data_format=None,
    dilation_rate=(1, 1),
    groups=1,
    activation=None,
    use_bias=True,
    kernel_initializer="glorot_uniform",
    bias_initializer="zeros",
    kernel_regularizer=None,
    bias_regularizer=None,
    activity_regularizer=None,
    kernel_constraint=None,
    bias_constraint=None,
    **kwargs
    )

You have to specify filters and kernel_size. These parameters have no default.

Default padding is valid, which means no zero-padding, and the default strides is (1,1).

Adames answered 15/1, 2021 at 19:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.