trainNetwork - training data format
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi,
I'm trying to build a concolutional neural network, but I don't get how to prepare training data.
I've got 24 mfcc features as an input and 20 output classes, so as far as I understand I need featureInputLayer and convolution1dLayer.
But when I'm using featureInputLayer I'm getting
"Error using trainNetwork - Invalid network.
(...)
Caused by:
Layer 2: Input data must have one spatial dimension only, one temporal dimension only, or one of each.
Instead, it has 0 spatial dimensions and 0 temporal dimensions."
How to fix this?
my simplified layers:
layers = [ ...
featureInputLayer(numFeatures)
convolution1dLayer(filterSize, numFilters, 'Padding', 'same')
reluLayer
averagePooling1dLayer(2, 'Stride', 2)
fullyConnectedLayer(300)
reluLayer
fullyConnectedLayer(numOutputs)
softmaxLayer
classificationLayer];
My data structure:
trained_net = trainNetwork(XTrain, YTrain, layers, options);
XTrain -> Nx24 double
Ytrain -> Nx1 categorical
To be honest I've tested all combinations of XTrain and YTrain transpositions, but still the same issue .
I've also tried using imageInputLayer as below, but then I've received another error
"Error using trainNetwork - Number of observations in X and Y disagree"
layers = [ ...
imageInputLayer([numFeatures 1])
convolution2dLayer([filterSize 1], numFilters, 'Padding', 'same')
reluLayer
averagePooling2dLayer([2 1], 'Stride', 2)
fullyConnectedLayer(300)
reluLayer
fullyConnectedLayer(numOutputs)
softmaxLayer
classificationLayer];
Please help me finding the right data structure, because the description provided in help is unclear to me.
Thanks,
Zbigniew
PS. versions of Matlab, I'm working on: R2021b, R2023a
1 commentaire
Voir également
Catégories
En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!