Keras CNN 2D + LSTM

927 views
Skip to first unread message

afsaneh...@gmail.com

unread,
Dec 16, 2015, 7:24:12 PM12/16/15
to Keras-users

Hi,
I am going to train a 2D CNN + LSTM, however, I was unable to exactly determine input of LSTM.
I would be appreciated if you could help.
I have sequence of frames and I am going to map them to a sequence of predefined labels.(Seq 2 Seq mapping)
My input of network is 100 sequences of 16 consecutive frames, and each frame is 28* 28.
My problem is how to define permute and reshape to connect the output layer of convolution layer to LSTM.

n_hidden = 256
n_samples = 100
n_timesteps = 16

model = Sequential()
model.add(Convolution2D(32, 5, 5, border_mode='same', input_shape=(1, 28, 28)))
model.add(MaxPooling2D(pool_size=(nb_pool, nb_pool)))
model.add(Activation('relu'))
model.add(Permute((0, 3, 2, 1)))
model.add(Reshape(?))
model.add(LSTM(256))
model.add(Dense(nb_classes))
model.add(Activation('softmax'))
rmsprop = RMSprop(lr=learning_rate)
model.compile(loss='categorical_crossentropy', optimizer=rmsprop)

gy1599...@gmail.com

unread,
Sep 17, 2016, 9:31:32 AM9/17/16
to Keras-users, afsaneh...@gmail.com
have you solved it at last? i am new to keras and can't deal with it ,can you help me .thanks a lot

在 2015年12月17日星期四 UTC+8上午8:24:12,afsaneh...@gmail.com写道:

f.pego...@gmail.com

unread,
Nov 4, 2018, 7:25:25 PM11/4/18
to Keras-users
Any solutions?
Reply all
Reply to author
Forward
0 new messages