1

My input is simply a matrix with 441 rows and 216 columns :

The 216 feature values

The 441 trials

Total class label 6

I am trying to train my data on a CNN model:

model = Sequential()

model.add(Conv1D(128, 5, input_shape=(441, 216)))
model.add(Activation('relu'))
model.add(Conv1D(128, 5,padding='same'))
model.add(Activation('relu'))
model.add(Dropout(0.1))
model.add(MaxPooling1D(pool_size=(8)))
model.add(Conv1D(128, 5,padding='same',))
model.add(Activation('relu'))
model.add(Conv1D(128, 5,padding='same',))
model.add(Activation('relu'))
model.add(Conv1D(128, 5,padding='same',))
model.add(Activation('relu'))
model.add(Dropout(0.2))
model.add(Conv1D(128, 5,padding='same',))
model.add(Activation('relu'))
model.add(Flatten())
model.add(Dense(10))
model.add(Activation('softmax'))
opt = keras.optimizers.rmsprop(lr=0.00001, decay=1e-6)

model.compile(loss='categorical_crossentropy', 
           optimizer=opt,metrics=['accuracy'])

This throws the error: ValueError: Error when checking model input: expected conv1d_1_input to have shape (None, 441, 216) but got array with shape (1, 441, 216)

How can I feed in my input to the CNN ?

1 Answer 1

1

You need to add a coma at the end of the first conv1d call: input_shape = (416, 234,) BTW, using "dropouts" between conv layers is less efficient than BatchNormalisation to avoid overfitting.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.