Proper way to define inputshape on the first layer

2019-08-20 05:07发布

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?

1条回答
手持菜刀,她持情操
2楼-- · 2019-08-20 05:49

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)
查看更多
登录 后发表回答