我使用的是Keras版本2.3.1和TensorFlow 2.0.0。
我在我的网络中的第一个卷积层的实例化中引入了标题错误:
model = Sequential([
Conv2D(16, 3, input_shape=(1, 10000, 80)),
LeakyReLU(alpha=0.01),
MaxPooling2D(pool_size=3),
Conv2D(16, 3),
LeakyReLU(alpha=0.01),
MaxPooling2D(pool_size=3),
Conv2D(16, 3),
LeakyReLU(alpha=0.01),
MaxPooling2D(pool_size=3),
Conv2D(16, 3),
LeakyReLU(alpha=0.01),
MaxPooling2D(pool_size=3),
Dense(256),
LeakyReLU(alpha=0.01),
Dense(32),
LeakyReLU(alpha=0.01),
Dense(1, activation='sigmoid')])
据我所知,TF维度排序应该设置为(samples,行,列)。我的输入是一个形状为1000,80的数组。
我已经尝试了我在网上找到的所有修复程序,包括:
K.common.set_image_dim_ordering('tf')
K.set_image_data_format('channels_last')
K.tensorflow_backend.set_image_dim_ordering('tf')
K.set_image_dim_ordering('tf')
但是,所有这些都不会改变任何东西(就像前两行一样),或者在这两行上失败(后两行)。
发布于 2019-12-28 21:14:30
如果input_shape
错误,这些修复都不会起作用。Conv2D
层的input_shape
应为(width, height, channels)
,示例维度不包含为Keras隐式插入的维度。
您给出的input_shape
将被解释为宽度为1,这是一个问题。您需要正确地设置input_shape
的格式,并添加channels维度。
https://stackoverflow.com/questions/59514903
复制相似问题