Reputation: 1315
When using Conv2D
we can define the kernel_size
to be 1 dim or 2 dims (or higher value of dims)
for example:
Conv2D(filters=32, kernel_size=3, activation='relu')
or
Conv2D(filters=32, kernel_size=(3,3), activation='relu')
Conv2D
, what is the recommendations ?1D
(kernel_size=7
) and what are the cases we will prefer to choose 2D
(kernel_size=(3,3)
) or other dim ?kernel_size
will affect the choosing of pooling size ? (MaxPooling2D(pool_size=?)
)Upvotes: 1
Views: 2194
Reputation: 5681
The kernel size for Conv2D is always 2 dimensional
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.
You just have the option to write kernel size 3 but in reality means (3,3). For Conv1D, the kernel size is 1d also.
If you use Conv2D you must choose MaxPooling2D , if you use Conv1D you must choose MaxPooling1D.
Upvotes: 1
Reputation: 861
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.
Keras doc. Conv2D performs convolution with 2D filter, it can be square (use single int to define) or not square (use tuple). Regarding size of filter (3, 7, etc.) choice depends on task and architecture. See answer for basic intuition behind particular example
MaxPooling2D
output of specific shape.Upvotes: 2