Skip to main content

What is Keras Conv2D?

Keras Conv2D is a 2D Convolution layer. This creates a convolution kernel that is wind with layers input which helps produce a tensor of outputs.
What is Keras Conv2D?
What is Keras Conv2D?

The Keras Conv2D class constructor has the following arguments:

filters

It is an integer value and also determines the number of output filters in the convolution.

kernel_size 

An integer or tuple/list of 2 integers, specifying the height and width of the 2D convolution window. Can be a single integer to specify the same value for all spatial dimensions. Common dimensions include 1x1, 3x3, 5x5, 7x7 which can be passed as (1,1), (3,3), (5,5) or (7,7) tuples.

strides 

An integer or tuple/list of 2 integers, specifying the strides of the convolution along the height and width. Can be a single integer to specify the same value for all spatial dimensions.

Its default value is always set to (1x1) which means that the given Conv2D filter is applied to the current location of the input volume and the given filters take a 1 pixel step to the right and again the filter is applied to the input volume and it is performed until we reach the far right border of the volume in which we are moving our filter.

padding

padding can take 2 values: 'valid' or 'same'.

Setting the value to 'valid' parameter means that the input volume is not zero-padded and the spatial dimensions are allowed to reduce via the natural application of convolution.

Setting the value to 'same' parameter preserves the spatial dimensions of the volume such that the output size matches the input volume size.

data_format 

The parameter can be set to "channels_last" or "channels_first" value.

dilation_rate 

The dilation_rate parameter of the Conv2D class is a 2-tuple of integers, which controls the dilation rate for dilated convolution. Can be a single integer to specify the same value for all the spatial dimensions.

activation

The activation parameter to the Conv2D class is simply a convenience parameter which allows you to supply a string, which specifies the name of the activation function you want to apply after performing convolution. If you don't specify anything, no activation is applied.

use_bias 

It determines whether a bias vector will be added to the convolutional layer. By default, its value is set to true.

kernel_initializer

This parameter controls the initialization method which is used to initialize all the values in the Conv2D class before actually training the model. It is the initializer for the kernel weights matrix.

bias_initializer

It is the initializer for the bias vector.

Kernel_regularizer

It is the regularizer function which is applied to the kernel weights matrix.

bias_regularizer

It is the regularizer function which is applied to the bias vector.

activity_regularizer

It is the regularizer function which is applied to the output of the layer.(i.e. activation)

All the above regularization techniques reduce the error by fitting a function appropriately on the given training set and avoid over fitting.

kernel_constraint

kernel_constraint is a constraint function applied to the kernel matrix.

bias_constraint

bias constraint is a constraint function applied to the bias vector.

A constraint is a condition of an optimization problem that the solution must satisfy.

Above are all the arguments which a Keras Conv2D can take.

Comments

Popular posts from this blog