2
$\begingroup$

I am trying to use conv1D but getting that error. My dataset's is batched and has a shape of [None, 25, 25, 1] I am using input_shape=(25,25) I am not able to figure out what should I change so I can get it to work.

My model:

model = Sequential()
model.add(Conv1D(32, kernel_size=3, activation='relu', input_shape=(25,25))
model.add(Flatten())
model.add(Dense(1, activation='sigmoid'))
$\endgroup$

2 Answers 2

2
$\begingroup$

I have solved the problem by changing the shape of my dataset using:

tf.reshape(data, [25, 25])
$\endgroup$
2
  • $\begingroup$ where did you use this code? i am getting the same error $\endgroup$
    – Coder
    Commented Dec 27, 2021 at 21:41
  • $\begingroup$ I reshaped the dataset I use to train the model. you can use data = tf.reshape(data, [25, 25]) $\endgroup$
    – Lukas
    Commented Dec 29, 2021 at 10:57
0
$\begingroup$

ValueError: Input 0 of layer "sequential" is incompatible with the layer: expected shape=(None, 30, 30, 3), found shape=(None, 30, 30, 4) I am not able to figure out what should i change

$\endgroup$
1
  • $\begingroup$ I think it is because you are using 2 different shapes: (30, 30, 3) and (30, 30, 4). $\endgroup$
    – Lukas
    Commented Jun 19, 2023 at 7:23

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.