error: Input 0 of layer sequential is incompatible with the layer expected min_ndim=3, found ndim=2. Full shape received: (None, 178)
error: Input 0 of layer sequential is incompatible with the layer expected min_ndim=3, found ndim=2. Full shape received: (None, 178)
# Xtrain.shape
# (14720, 178, 1)
epochs = 20
model = Sequential()
model.add(Conv1D(filters=32, kernel_size=2, activation='relu',strides=1,input_shape=Xtrain[0].shape))
model.add(BatchNormalization())
model.add(MaxPooling1D(pool_size=2, strides=2))
model.add(Dropout(0.1))
model.add(Conv1D(filters=64, kernel_size=2, activation='relu'))
model.add(BatchNormalization())
model.add(MaxPooling1D(pool_size=2, strides=2))
model.add(Dropout(0.2))
model.add(Flatten())
model.add(Dropout(0.4))
model.add(Dense(256, activation='relu'))
model.add(Dropout(0.5))
model.add(Dense(1, activation='sigmoid'))
model.summary()
model.compile(optimizer=Adam(0.001), loss='binary_crossentropy', metrics=['acc'])
plot_model(model,to_file='model_plot.png',show_shapes=True,show_layer_names=True)
history1= model.fit(Xtrain, ytrain, validation_data = (Xval, yval),batch_size=200, epochs=epochs)
generates error
Input 0 of layer sequential_2 is incompatible with the layer: : expected min_ndim=3, found ndim=2. Full shape received: (None, 178)