title: What is second Parameter in 1DConv output shape keras Model Summary?
body: <p>I am training 1DConv model, having 4248 instances and 39249 features in each instance. I am trying VGG16 model with 32 batch size, but after 7 layers it returns the following error.</p>
  
  <p>Negative dimension size caused by substracting  3 from 1 for conv1d_8/convolution/Conv2D (op: 'Conv2D') with input shapes: [?,1,1,256] , [1,3,256,512].</p>
  
  <p>To debug further, I have printed the full network using keras model.summary(). Image is attached. I have two concerns.</p>
  
  <ol>
  <li>Why am I getting the negative dimension error?</li>
  <li>I have seen that the second parameter in output shape goes to 2 in conv1d_7 layer and further substraction is not possible. What is second parameter? I have gone through <a href="https://blog.goodaudience.com/introduction-to-1d-convolutional-neural-networks-in-keras-for-time-sequences-3a7ff801a2cf" rel="nofollow noreferrer">this</a> document and I have found that the second parameter is obtained using the following formula (Height -Kernel Size + 1), and represents the number of steps window will slide through the data. Kernel Size in my case is 3 and I am confused about height. The document explains that 'height is the length of one dataset which is fed into the network'. Does the length refer to the input number of features, or batch size* number of input features? How 11250 is calculated in output shape of first layer. Below is my code (I am able to calculate parameters for the rest of the layer, only second parameter is confusing, previous posts explain how to calculate params not about the length of data).</li>
  <li>For such huge features (39249) per sample and only around 4k instances, which deep learning algorithm might be useful in accurate classification?</li>
  </ol>
  
  <p>Any help is appreciated. Thanks.</p>
  
  <pre><code>model = Sequential()
   model.add(Conv1D(filters = 8, kernel_size=3, strides=3, activation='relu', input_shape=(n_timestamps,n_features)))
  
   model.add(Conv1D(filters=16, kernel_size=3, strides=3, activation='relu'))
   model.add(MaxPooling1D(pool_size=2,strides=2))
  
   model.add(Conv1D(filters=32, kernel_size=3, strides=3, activation='relu'))
   model.add(MaxPooling1D(pool_size=2,strides=2))
  
   model.add(Conv1D(filters=64, kernel_size=3, strides=3, activation='relu'))
   model.add(MaxPooling1D(pool_size=2,strides=2))
   model.add(Conv1D(filters=64, kernel_size=3, strides=3, activation='relu'))
   model.add(MaxPooling1D(pool_size=2,strides=2))
  
   model.add(Conv1D(filters=128, kernel_size=3, strides=3, activation='relu'))
   model.add(Conv1D(filters=128, kernel_size=3, strides=3, activation='relu'))
   model.add(MaxPooling1D(pool_size=4,strides=3))
   print(model.summary())
  
   model.add(Conv1D(filters=256, kernel_size=3, strides=3, activation='relu'))
   model.add(Conv1D(filters=256, kernel_size=3, strides=3, activation='relu'))
   model.add(Conv1D(filters=256, kernel_size=3, strides=3, activation='relu'))
   model.add(MaxPooling1D(pool_size=2,strides=2))
   print(model.summary())
  
   model.add(Conv1D(filters=512, kernel_size=3, strides=3, activation='relu'))
   model.add(Conv1D(filters=512, kernel_size=3, strides=3, activation='relu'))
   model.add(Conv1D(filters=512, kernel_size=3, strides=3, activation='relu'))
   model.add(MaxPooling1D(pool_size=2,strides=2))
   print(model.summary())
  
   model.add(Conv1D(filters=512, kernel_size=3, strides=3, activation='relu'))
   model.add(Conv1D(filters=512, kernel_size=3, strides=3, activation='relu'))
   model.add(Conv1D(filters=512, kernel_size=3, strides=3, activation='relu'))
   model.add(MaxPooling1D(pool_size=2,strides=2))
  
   model.add(Flatten())
   model.add(Dense(4096, activation='relu'))
   #model.add(Dropout(0.5))
   model.add(Dense(4096, activation='relu'))
   #model.add(Dropout(0.5))
   model.add(Dense(n_outputs, activation='softmax'))
   print(model.summary())
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/5Bop8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5Bop8.jpg" alt="enter image description here"></a> </p>