How to implement a CNN-LSTM model using Keras?

217 views
Skip to first unread message

Sara Jones

unread,
Mar 9, 2021, 7:05:14 AM3/9/21
to Keras-users

I am attempting to implement a CNN-LSTM that classifies mel-spectrogram images representing the speech of people with Parkinson's Disease/Healthy Controls. I am trying to implement a pre-existing model (DenseNet-169) with an LSTM model, however I am running into the following error: 

ValueError: Input 0 of layer zero_padding2d is incompatible with the layer: expected ndim=4, found ndim=3. Full shape received: [None, 216, 1]. 

Can anyone advise where I'm going wrong? (Please see following link for the code: https://github.com/saraajones05/ParkinsonsCNNLSTM). 

Lance Norskog

unread,
Mar 9, 2021, 1:23:36 PM3/9/21
to Sara Jones, Keras-users
The man page for TimeDistributed shows a different input spec for the wrapper layer than the applied layer.
You need two input_spec values, the 4d spec for the TD layer and the 3d spec for the DenseNet.


Cheers,

Lance Norskog

--
You received this message because you are subscribed to the Google Groups "Keras-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keras-users...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/keras-users/232328d4-2fcb-441d-aa32-02c4d574e41dn%40googlegroups.com.


--
Lance Norskog
lance....@gmail.com
Redwood City, CA
Reply all
Reply to author
Forward
0 new messages