LSTM error with number of X and Y observations

1 vue (au cours des 30 derniers jours)
Daniel Guo
Daniel Guo le 14 Avr 2020
Commenté : Daniel Guo le 14 Avr 2020
I am using lstm regression network to denoise speech. The predictor input consists of 9 consecutive noisy STFT vectors. The target is corresponding clean STFT vector. The length of each vector is 129.
Here 's the network I defined:
layers = [
sequenceInputLayer([129 9 1],"Name","sequence")
flattenLayer("Name","flatten")
lstmLayer(128,"Name","lstm")
fullyConnectedLayer(129,"Name","fc_1")
reluLayer("Name","relu")
fullyConnectedLayer(129,"Name","fc_2")
regressionLayer("Name","regressionoutput")];
I trained the network with X and Y of sizes:
size(X):
129 9 1 254829
size(Y):
129 254829
I got the error "Invalid training data. X and Y must have the same number of observations". I think that maybe the network I defined is wrong. I am new with lstm network to do sequence-to-sequence regression. What should I do with my network or training data?
Thanks for your help!

Réponse acceptée

jibrahim
jibrahim le 14 Avr 2020
Hi Daniel,
Please refer to the help of trainNetwork for info on correct input sizes for sequences.
The inputs must be cell arrays. Here is an example with two observations:
opts = trainingOptions('adam');
trainNetwork({randn(129,9,1) , randn(129,9,1)}, {randn(129,1),randn(129,1)},layers,opts)
  1 commentaire
Daniel Guo
Daniel Guo le 14 Avr 2020
It works! Thank you a lot :)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Sequence and Numeric Feature Data Workflows dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by