I have an input data with 2000 samples each having shape of (5, 3, 178, 178) where 5 is time dimension, 3 is a color channel, and the rest are x and y-axis. Now I want to use ConvLSTM layer to predict 3 classes. Below is my sample single data and architecture, can someone suggest me what should I change in architecture to get better prediction.

enter image description here

input  = Input(shape=(5, 3, 178, 178)
                    , name='input')
first = ConvLSTM2D(filters=32, kernel_size=(3, 3)
                       , data_format='channels_first'
                       , recurrent_activation='hard_sigmoid'
                       , activation='tanh'
                       , padding='same', return_sequences=True)(input)

second = BatchNormalization()(first)
third = MaxPooling3D(pool_size=(1, 2, 2), padding='same', data_format='channels_first')(second)
fourth = ConvLSTM2D(filters=64, kernel_size=(3, 3)
                        , data_format='channels_first'
                        , padding='same', return_sequences=True, activation = 'tanh')(third)

fifth = BatchNormalization()(fourth)
sixth= MaxPooling3D(pool_size=(1, 3, 3), padding='same', data_format='channels_first')(fifth)

seventh = Flatten()(sixth)
output = Dense(3, activation='softmax'))

model = Model(inputs=input, outputs=output, name='Model ')

batch_size = 64

opt = tf.keras.optimizers.Adam(learning_rate=0.1)
model.compile(loss='categorical_crossentropy', optimizer = opt, metrics=['accuracy'])
model.fit(x_tr, y_tr, batch_size = batch_size, epochs=50, verbose=1,validation_data=(x_val,y_val))

Can someone tell me what changes should I make to my model to get better result, should I add more layers, or is there any layer that I'm missing. Any suggestion in activation function or optimizers. Mainly I would like to know what layer I should add or delete. Also like I know it’s standard to use tanh as activation in LSTM but as I want to detect pixels changing magnitide or value, can I use relu here instead. Or I shouldn’t change the default activation of LSTM that is tanh


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.