keras conv_lstm модель keras со слоем conv_lstm не может сходиться. потеря около 1600 - PullRequest
0 голосов
/ 20 марта 2019

модель keras со слоем conv_lstm не может сходиться.Потеря составляет около 1600. Я не знаю, как заставить его сходиться?

Потери после нескольких эпох не уменьшаются и нет улучшения точности поезда.

Я пытался играть с другой гипер-парамы 1 、 0,1, а также батчнорм.

Если кто-нибудь может помочь мне в сближении модели, это было бы здорово.

###################################
# Model Define
###################################

inputs = Input(shape=(sequenceLength,80,80,1))

# conved = TimeDistributed(Lambda(MyCNN), input_shape=(sequenceLength,40,40,1)) (inputs)

x = ConvLSTM2D(filters=32, kernel_size=(3, 3), padding='same', return_sequences=True)(inputs)
x = TimeDistributed(MaxPooling2D((2, 2)))(x)
x = ConvLSTM2D(filters=16, kernel_size=(3, 3), padding='same', return_sequences=True)(x)
x = TimeDistributed(MaxPooling2D((2, 2)))(x)
print(K.int_shape(x))

# Normal ConvLSTM
x = ConvLSTM2D(filters=8, kernel_size=(3, 3), padding='same')(x)
x = Flatten()(x)
x = RepeatVector(15)(x)
print(x.shape)
x = Reshape((sequenceLength,20,20,8))(x)
x = ConvLSTM2D(filters=10, kernel_size=(3, 3), padding='same', return_sequences=True)(x)




x = TimeDistributed(UpSampling2D((2, 2)))(x)
x = ConvLSTM2D(filters=16, kernel_size=(3, 3), padding='same', return_sequences=True)(x)

x = TimeDistributed(UpSampling2D((2, 2)))(x)
x = ConvLSTM2D(filters=32, kernel_size=(3, 3), padding='same', return_sequences=True)(x)  


deconved = TimeDistributed(Dense(1, activation='sigmoid'))(x)


#LSTM part
# encoded = LSTM(800)(flat)


print('--- Defining Decoder ---')


autoencoder = Model(output=deconved,input=inputs)
myoptmizer = RMSprop(lr=0.1, decay=1e-4)
autoencoder.compile(loss='mean_squared_error', optimizer=myoptmizer)

print('--- Finish Compile and Plot Model ---')

###################################
# Training
###################################

# Train the network
train_data, val_data = get_data()
# seq.fit(noisy_movies[:1000], shifted_movies[:1000], 
autoencoder.fit(train_data, train_data,
        batch_size=5,
        epochs=5 
        )

###################################
# Predicting
###################################


# Testing the network on one movie
# feed it with the first 7 positions and then
# predict the new positions

preds = autoencoder.predict(train_data, batch_size=5)
print(preds[0,0,:, :,0].shape)
plt.imshow(preds[0,0,:, :,0])
plt.savefig('/home/user/interspeech/sample.jpg')
plt.show()
if __name__ == '__main__':
    main()

введите описание изображения здесь

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...