Keras getting wrong output shape

后端 未结 1 454
傲寒
傲寒 2020-12-21 16:15

For the following CNN

model = Sequential()
model.add(Convolution2D(64, 3, 3, border_mode=\'same\', input_shape=(3, 256, 256)))
# now model.output_shape == (         


        
相关标签:
1条回答
  • 2020-12-21 17:04

    It is a problem caused by the setting of input_shape. In your current setting, you want to input 256x256 with 3 channels. However, Keras thinks you are giving 3x256 image with 256 channels. There several ways to correct it.

    • Option 1: Change the order in input_shape

    • Option 2: Specify image_dim_ordering in your layers

    • Option 3: Modify the keras configuration file by changing 'tf' to 'th' in your ~/.keras/keras.json

    0 讨论(0)
提交回复
热议问题