Gorgorutos
Gorgorutos

Reputation: 35

Proper way to define inputshape on the first layer on keras

I have an array of 35000 images of 256x256 grayscale images

print(len(data))
>>>35000
print(data[0].shape)
>>>(256, 256)

My first layer is

model.add(Conv2D(64, (3, 3), input_shape=(35000,), activation='relu'))

and it gives me the error

>>>ValueError: Input 0 is incompatible with layer conv2d_1: expected ndim=4, found ndim=2

what I'm doing wrong? what is the proper way to define the input shape?

Upvotes: 0

Views: 269

Answers (1)

Daniel Möller
Daniel Möller

Reputation: 86600

Convolutional layers input shape: (images, height, width, channels)

So:

  • input_shape=(256,256,1)
  • batch_shape=(batch_size,256,256,1)
  • batch_input_shape=(batch_size,256,256,1)

Upvotes: 1

Related Questions