observationDim should be either 2, 3, 4 or 5
10 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hi, sorry about noob question.
I am trying to adapt the TrainNetworkOnImageAndFeatureDataExample.mlx to my use case. I my use case I only have the training image data and the categories, the "X2Train" feature input is absent. Thus my layers now look as follows:
[h,w,numChannels,numObservations] = size(trainData);
numFeatures = 1;
numClasses = numel(categories(trainLabels));
imageInputSize = [h w numChannels];
filterSize = 5;
numFilters = 16;
layers = [
imageInputLayer(imageInputSize,Normalization="none")
convolution2dLayer(filterSize,numFilters)
batchNormalizationLayer
reluLayer
fullyConnectedLayer(50)
flattenLayer
fullyConnectedLayer(numClasses)
softmaxLayer
classificationLayer
];
%concatenationLayer(1,2,Name="cat")
lgraph = layerGraph(layers);
When running the trainNetwork I get an error:
observationDim should be either 2, 3, 4 or 5
But I have no clue whatsoever what I need to change here.
0 Kommentare
Antworten (1)
Sai Kiran
am 6 Mär. 2023
Hi,
The error is due to mismatch in the dimensions of two matrices while multiplying them.
The layers doesn't have any errors when we pass another dataset.
Please check the dimensions of 'trainData' and 'trainLabels' and the command window , it shows where the error has occured at a specific line in the code.
I hope it helps!
0 Kommentare
Siehe auch
Kategorien
Mehr zu Image Data Workflows finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!