ValueError:步幅应为1、1或3,但长度为2

时间:2019-10-02 17:05:13

标签: image-processing keras conv-neural-network lstm keras-layer

火车输入形状:(13974,100,6,5)

火车输出形状:(13974,1,1)

测试输入形状:(3494,100,6,5)

测试输出形状:(3494,1,1)

我正在开发以下模型。二维CNN LSTM。

model = Sequential()
model.add(TimeDistributed(Conv2D(1, (1,1), activation='relu', 
input_shape=(6,5,1))))
model.add(TimeDistributed(MaxPooling2D(pool_size=(6, 5))))
model.add(TimeDistributed(Flatten()))
model.add(LSTM(units=300, return_sequences= False, input_shape=(100,1)))
model.add(Dense(1))

当我尝试适应以下情况时

model.fit(train_input,train_output,epochs=50,batch_size=60)

它给我一个错误。

  

ValueError:步幅的长度应为1、1或3,但应为2

请更正我的模型。我将6,5幅图像转换为一个单位,并从100个时间戳中预测了第101个时间戳。

1 个答案:

答案 0 :(得分:0)

您的问题尚不清楚,但是我相信您拥有100张大小为6 x 5的图像的序列。最好在您的用例中合并Conv3D,也没有必要{{1} }无处不在。这仅是您的用例的说明,您可能必须添加更多的TimeDistributedConv层,并尝试使用其他超参数来获得合适的拟合度。

MaxPool