【问题标题】:The Input Shape for ConvLSTM model for image prediction用于图像预测的 ConvLSTM 模型的输入形状
【发布时间】:2019-09-30 19:59:07
【问题描述】:

我正在尝试使用 ConvLSTM 模型进行图像预测。但我无法理解应该输入神经网络的数据集。

我在互联网上搜索并找到了诸如“使用 ConvLSTM 进行降水预测”之类的示例以及其他一些使用 ConvLSTM 模型进行预测的模型。在第一次试验中,我选择了降水问题中提供的模型,以了解该模型将如何对我的数据集做出反应。

def fn_get_model_convLSTM_tframe_5():

model = Sequential()
model.add(ConvLSTM2D(filters=64, kernel_size=(7, 7),
                     input_shape=(None, 101, 101, 1), padding='same',  return_sequences=True, 
                     activation='tanh', recurrent_activation='hard_sigmoid',
                     kernel_initializer='glorot_uniform', unit_forget_bias=True, 
                     dropout=0.3, recurrent_dropout=0.3, go_backwards=True ))
model.add(BatchNormalization())

model.add(ConvLSTM2D(filters=32, kernel_size=(7, 7), padding='same', return_sequences=True, 
                     activation='tanh', recurrent_activation='hard_sigmoid', 
                     kernel_initializer='glorot_uniform', unit_forget_bias=True, 
                     dropout=0.4, recurrent_dropout=0.3, go_backwards=True ))
model.add(BatchNormalization())

model.add(ConvLSTM2D(filters=32, kernel_size=(7, 7), padding='same', return_sequences=True, 
                     activation='tanh', recurrent_activation='hard_sigmoid', 
                     kernel_initializer='glorot_uniform', unit_forget_bias=True, 
                     dropout=0.4, recurrent_dropout=0.3, go_backwards=True ))
model.add(BatchNormalization())


model.add(ConvLSTM2D(filters=32, kernel_size=(7, 7), padding='same', return_sequences=False, 
                     activation='tanh', recurrent_activation='hard_sigmoid', 
                     kernel_initializer='glorot_uniform', unit_forget_bias=True, 
                     dropout=0.4, recurrent_dropout=0.3, go_backwards=True ))
model.add(BatchNormalization())

model.add(Conv2D(filters=1, kernel_size=(1, 1),
               activation='sigmoid',
               padding='same', data_format='channels_last')) 

print(model.summary())
return model

完整的代码可以在这里找到: https://github.com/TeaPearce/precipitation-prediction-convLSTM-keras/blob/master/precip_v09.py

  As I understood the image fed into the model had the shape of 101x101 with 4 color channels. The same is the case for my dataset (I am not giving all the details regarding my dataset as I am quite sure ConvLSTM model is suitable for my dataset and for running out of redundant discussion). 

  I have the images of size 35x45 with four color channels. In total, I have 35 sequences and each sequence contains 140 sequential images. Additionally I have 1 more sequence on which I should do prediction as it contains 120 images (I need to fulfill it till the 140) I have tried to reshape my dataset and fit it into array of size (35, 140, 35, 45, 4). So know I have array so called trainx for training dataset. But the thing is that I am confused about the labels that I should provide (Even I am not sure whether I should provide or not as we are talking about sequential images).

 Can anyone please help me on preparing this dataset for neural network and explain the datashape that I should provide clearly

【问题讨论】:

  • 抱歉输入错误。如果有人纠正他们,我将不胜感激。

标签: python machine-learning neural-network deep-learning lstm


【解决方案1】:

input_shape=(无, 101, 101, 1)

输入形状为 101x101,具有 1 个通道

如果您有 4 通道的图像,则输入形状为 (None, 101, 101, 4)

【讨论】:

    猜你喜欢
    • 2019-10-20
    • 2021-03-05
    • 1970-01-01
    • 2023-03-09
    • 2019-05-28
    • 2023-01-24
    • 2021-06-03
    • 2019-04-08
    • 2021-05-26
    相关资源
    最近更新 更多