What should be input shape be?

I’m confused about what dimensions input shapes in keras models should be.

From the course, it seems that the input shape should be the same dimensions of a single record in the data set.

Example from week 3, course 1 lab (C1_W3_Lab_1_improving_accuracy_using_convolutions):

model = tf.keras.models.Sequential([

  • tf.keras.layers.Conv2D(64, (3,3), activation=‘relu’, input_shape=(28, 28, 1)),*

  • tf.keras.layers.MaxPooling2D(2, 2),*

However, elsewhere, I have read that the input shape should be same dimensions as the training set. For example, see the following S.O. post:

In Keras, the input layer itself is not a layer, but a tensor. It’s the starting tensor you send to the first hidden layer. This tensor must have the same shape as your training data . Example: if you have 30 images of 50x50 pixels in RGB (3 channels), the shape of your input data is (30,50,50,3)
neural network - Keras input explanation: input_shape, units, batch_size, dim, etc - Stack Overflow)%20

The above contradicts the input shape of the model in the lab, right? Or can you do either?
Or, am i missing something?


to input the dimenstion of the data

Hi @pablowilks,

I have answer a similar question here. I hope it helps.