What is the default stride length in Keras' Conv1D?

Multi tool use
Multi tool use
The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP


What is the default stride length in Keras' Conv1D?



Currently, I am tuning my model by testing the Kernel size.



I have the following code :


code


x = embedding_layer(input_4)
x = Conv1D(FILTERS, KERNEL, activation='relu')(x)
x = Dropout(DROPOUT)(x)
x = Conv1D(FILTERS, KERNEL, activation='relu')(x)
x = Dropout(DROPOUT)(x)
x = Conv1D(FILTERS, KERNEL, activation='relu')(x)
x = Dropout(DROPOUT)(x)
x = Conv1D(FILTERS, KERNEL, activation='relu')(x)
x = Dropout(DROPOUT)(x)
x = Conv1D(FILTERS, KERNEL, activation='relu')(x)
x = Dropout(DROPOUT)(x)
x = MaxPooling1D(3)(x)

x = Conv1D(FILTERS, KERNEL, activation='relu')(x)
x = Dropout(DROPOUT)(x)
x = Conv1D(FILTERS, KERNEL, activation='relu')(x)
x = Dropout(DROPOUT)(x)
x = Conv1D(FILTERS, KERNEL, activation='relu')(x)
x = Dropout(DROPOUT)(x)
x = Conv1D(FILTERS, KERNEL, activation='relu')(x)
x = Dropout(DROPOUT)(x)
x = Conv1D(FILTERS, KERNEL, activation='relu')(x)
x = Dropout(DROPOUT)(x)
x = MaxPooling1D(3)(x)



When the Kernel is 2 or 3, the network runs fine, but from 4 onwards it runs into an error about the dimensionality. I suspect that it has to do with the stride length. However, the Keras website (https://keras.io/layers/convolutional/) does not say what the default stride length is.


2


3


4


Keras



My question now is: what is default stride length in Keras' Conv1D? And what would be a good stride length for a kernel size of 4 and for a kernel size of 5?


4


5




1 Answer
1



From Conv1D, the default stride length is 1. Unless you have a concrete justification for another length, a stride length of 1 is usually appropriate.



The error you get is probably because the output dimension of a 1D convolutional layer is:


output_dim = 1 + (input_dim - kernel_size)/stride



And after stacking several 1D convolutional layers, you might be reaching a layer in which the input dimensionality is smaller than the kernel size.






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

865WSEo4WiGzmPb 9KKYMoK4CA4msWArO6iOf6ns3iJ QrW4M yeZ31NSdz9FPYsfEe,QCsrCQmYx,KAAzDjDKh
MEvnY3Oqd3MRdIxBaey9jeA9shdGCNrx yjfSG4ZUeV jPWMFyYPUZLMZNJUsRvlD07GG

Popular posts from this blog

Makefile test if variable is not empty

Will Oldham

Visual Studio Code: How to configure includePath for better IntelliSense results