Hello
I am training a LSTM for sequence to sequence labeling
I have it currently set up where XTrain is a 5000 x 1 cell array where each of the 5000 rows is a 10 x n double.
YTrain is a 5000 x 1 cell array where each of the 5000 rows is a 1 x n categorical array with 4 catagories
XTrain =
5000×1 cell array
{10×2371 double}
{10×2792 double}
{10×3044 double}
{10×2878 double}
{10×2790 double}
...
YTrain =
5000×1 cell array
{1×2371 categorical}
{1×2792 categorical}
{1×3044 categorical}
{1×2878 categorical}
{1×2790 categorical}
...
I have layers defined as follows with 10 inputs and 4 outputs
layers = [ ...
sequenceInputLayer(10)
lstmLayer(150,'OutputMode','sequence')
fullyConnectedLayer(4)
softmaxLayer
classificationLayer];
In the interest of space I have omitted the options as I do not think this has anything to do with the error, but I can provide if needed.
If I train the NNet as follows, it works fine.
net = trainNetwork(XTrain, YTrain,layers,options)
However, I want to perform some transformations on the signals so I wanted to get it setup to run with a transformed datastore rather than from inputting XTrain and YTrain separately. Before getting the transform datastore working, I wanted to test that I could train the nnet using syntax that accepted the datastore intsead of XTrain and YTrain separately
I set up a datastore as follows:
dsXTrain = arrayDatastore(XTrain,'OutputType','same');
dsYTrain = arrayDatastore(YTrain,'OutputType','same');
dsTrain = combine(dsXTrain,dsYTrain);
Now, if I try to train the NN as follows, I get an error:
net = trainNetwork(dsTrain,layers,options)
Error using trainNetwork (line 183)
Unexpected input size: The input layer expects sequences with the same sequence length and feature dimension 10.
Error in train_nn (line 82)
net = trainNetwork(dsTrain,layers,options);
If I try to look at the data in the datastore it looks fine...
readall(dsTrain)
ans =
5000×2 cell array
{10×2371 double} {1×2371 categorical}
{10×2792 double} {1×2792 categorical}
{10×3044 double} {1×3044 categorical}
{10×2878 double} {1×2878 categorical}
{10×2790 double} {1×2790 categorical}
...
which looks like XTrain and Ytrain
I cannot figure out what the exact problem is - I assume its not passing in the data from dsTrain into trainNetwork properly, but Im at a loss to figure out what specifically the error is...
Any thoughts on how to fix it?
thanks!
hpw