'ValueError: Input 0 of layer "sequential_11" is incompatible with the layer: expected shape=(None, 1681), found shape=(None, 8000, 1, 1)

I want to build a speech recognition model using Convolutional Neural Networks CNN, I use this code

model=Sequential()

###first layer
model.add(Dense(100,input_shape=(1681,)))
model.add(Activation('relu'))
model.add(Dropout(0.5))

###second layer
model.add(Dense(200))
model.add(Activation('relu'))
model.add(Dropout(0.5))

###third layer
model.add(Dense(100))
model.add(Activation('relu'))
model.add(Dropout(0.5))

###final layer
model.add(Dense(num_labels))
model.add(Activation('softmax'))

model.compile(loss='categorical_crossentropy',metrics=['accuracy'],optimizer='adam')
## Trianing my model
from tensorflow.keras.callbacks import ModelCheckpoint
from datetime import datetime 

num_epochs = 100
num_batch_size = 32

checkpointer = ModelCheckpoint(filepath='E:\sound fils\train1\best_model\audio_classification.hdf5', 
                               verbose=1, save_best_only=True)
start = datetime.now()

model.fit(X_train, y_train, batch_size=num_batch_size, epochs=num_epochs, validation_data=(X_test, y_test), callbacks=[checkpointer], verbose=1)



duration = datetime.now() - start
print("Training completed in time: ", duration)

I was getting this error

ValueError: Input 0 of layer "sequential_11" is incompatible with the layer: expected shape=(None, 1681), found shape=(None, 8000, 1, 1)

what is the solution?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source