Reputation: 311
I am trying to classify a bunch of spectrograms into C classes using keras' LSTM (with a Dense Layer at the end). To clarify, each spectrogram belongs to a single class from those C classes. Each spectrogram is basically a matrix. It is constructed by taking (lets say, K) measurements at every second for about 1000 seconds. So the matrix has K rows and 1000 columns.
Considering this, how may I specify the shape of this input for the LSTM layer ?
Thank you!
Upvotes: 1
Views: 1534
Reputation: 900
It doesn't seem to be in the current documentation for LSTM layers, but input_shape
can be provided as (timesteps, input_dim)
.
If each spectrogram to be classified has 1000 time steps and K
measurements at each time step, an LSTM layer can be constructed like this:
LSTM(num_units, input_shape=(1000, K))
Then the shape of the input array for all of the spectrograms should have the shape (num_spectrograms, 1000, K)
.
Upvotes: 3