Implementing an CLSTM but facing Dimension Error Problem

不羁岁月 提交于 2020-02-06 07:24:05

问题


i am implementing a CLSTM based on This problem but facing error of dimensionality.

Data set: I am currently working on one video, which has 4500 images of size (28,28). The data set is in vectorized form so i get (4500,780). I split the images using Timeseriessplit and reshape the images with

x_train=x_train.reshape(-1, 28, 28, 1)
x_test=x_test.reshape(-1, 28, 28, 1)

My model is as follows

model = models.Sequential()
model.add(layers.ConvLSTM2D(
        filters=40,
        kernel_size=(3, 3),
        input_shape=(None, 28, 28, 1),
        padding='same',
        return_sequences=True))
model.add(layers.BatchNormalization())

model.add(layers.ConvLSTM2D(
        filters=40,
        kernel_size=(3, 3),
        padding='same',
        return_sequences=True))
model.add(layers.BatchNormalization())

model.add(layers.ConvLSTM2D(
        filters=40,
        kernel_size=(3, 3),
        padding='same',
        return_sequences=True))
model.add(layers.BatchNormalization())

model.add(layers.AveragePooling3D((1, 28, 28)))
model.add(layers.Reshape((-1, 40)))
model.add(layers.Dense(
        units=1,
        activation='sigmoid'))

For every image i have one value correspondent value. (Regression Problem). The error i am getting is:

ValueError: Error when checking input: expected conv_lst_m2d_input to have 5 dimensions, but got array with shape (3407, 28, 28, 1)

来源:https://stackoverflow.com/questions/60041693/implementing-an-clstm-but-facing-dimension-error-problem

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!