LSTM error with number of X and Y observations

1 次查看(过去 30 天)
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!

采纳的回答

jibrahim
jibrahim 2020-4-14
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)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by