title: ValueError: Error when checking target: expected dense_17 to have shape (None, 1) but got array with shape (8, 4800000)
body: <p>Hi everyone I must implement a cnn + lstm model and I've this error:</p>
  
  <pre><code>ValueError: Error when checking target: expected dense_17 to have shape (None, 1) but got array with shape (8, 4800000)
  </code></pre>
  
  <p>this is my code with:</p>
  
  <pre><code>X_train.shape = (8, 4800000, 1)
  y_train_arousal.shape=(8, 4800000).
  </code></pre>
  
  <p>X_train are 8 audio tracks, 4800000 are the samples and 1 channel</p>
  
  <p>y_train_arousal: for each audio track and for each sample correspond to an arousal value.</p>
  
  <p>So my model reads sequentially the samples and for each sample produces 1 value, I must evaluate the variance between the output value vary with the sample</p>
  
  <pre><code>model_arousal = Sequential()
  
  model_arousal.add(Conv1D(filters=40, kernel_size=40, strides=2, activation='tanh', input_shape=(4800000, 1)))
  model_arousal.add(MaxPooling1D(pool_size=2))
  model_arousal.add(Dropout(0.5))
  
  model_arousal.add(Conv1D(filters=40, kernel_size=400, strides=2, activation='tanh'))
  model_arousal.add(MaxPooling1D(pool_size=20))
  model_arousal.add(Dropout(0.5))
  
  model_arousal.add(LSTM(128, activation='tanh', return_sequences=True))
  model_arousal.add(LSTM(128, activation='tanh', return_sequences=True))
  
  model_arousal.add(Flatten())
  model_arousal.add(Dense(2))
  
  adam = Adam(0.002)
  model_arousal.compile(loss='mse', optimizer=adam, metrics=['accuracy'])
  model_arousal.summary()
  
  
  _________________________________________________________________
  Layer (type)                 Output Shape              Param #   
  =================================================================
  conv1d_47 (Conv1D)           (None, 2399981, 40)       1640      
  _________________________________________________________________
  max_pooling1d_42 (MaxPooling (None, 1199990, 40)       0         
  _________________________________________________________________
  dropout_39 (Dropout)         (None, 1199990, 40)       0         
  _________________________________________________________________
  conv1d_48 (Conv1D)           (None, 599796, 40)        640040    
  _________________________________________________________________
  max_pooling1d_43 (MaxPooling (None, 29989, 40)         0         
  _________________________________________________________________
  dropout_40 (Dropout)         (None, 29989, 40)         0         
  _________________________________________________________________
  lstm_19 (LSTM)               (None, 29989, 128)        86528     
  _________________________________________________________________
  lstm_20 (LSTM)               (None, 29989, 128)        131584    
  _________________________________________________________________
  flatten_19 (Flatten)         (None, 3838592)           0         
  _________________________________________________________________
  dense_17 (Dense)             (None, 1)                 3838593   
  =================================================================
  Total params: 4,698,385
  Trainable params: 4,698,385
  Non-trainable params: 0
  _________________________________________________________________
  
  h = model_arousal.fit(X_train, y_train_arousal, batch_size=50, epochs=5, verbose=1)
  </code></pre>
  
  <p>UPDATE</p>
  
  <p>I'm trying to explain myself as clear as I can be.</p>
  
  <p>For simplicity I consider just one audio track. For each sample of the track correspond an arousal value.
  So my network must predict for each sample an arousal value, then compare it with the corresponding arousal value for the sample-ith</p>