2021年1月28日星期四

LSTM for Video Input

I am a newbie trying out LSTM.

I am basically using LSTM to determine action type (5 different actions) like running, dancing etc. My input is 60 frames per action and roughly let's say about 120 such videos

train_x.shape = (120,192,192,60)

where 120 is the number of sample videos for training, 192X192 is the frame size and 60 is the # frames.

train_y.shape = (120*5) [1 0 0 0 0 ..... 0 0 0 0 1] one hot-coded

I am not clear as to how to pass 3d parameters to lstm (timestamp and features)

model.add(LSTM(100, input_shape=(train_x.shape[1],train_x.shape[2])))  model.add(Dropout(0.5))  model.add(Dense(100, activation='relu'))  model.add(Dense(len(uniquesegments), activation='softmax'))  model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])  model.fit(train_x, train_y, epochs=100, batch_size=batch_size, verbose=1)  

i get the following error

Input 0 of layer sequential is incompatible with the layer: expected ndim=3, found ndim=4. Full shape received: (None, 192, 192, 60)

https://stackoverflow.com/questions/65879627/lstm-for-video-input January 25, 2021 at 01:57PM

没有评论:

发表评论