why this error is heppening?
2 views (last 30 days)
Show older comments
my CNN code to train brats images with nifti extension
brainDatasetPath=fullfile('D:','MSCS SUPERIOR','Image Processing','source_code');
imds = imageDatastore(brainDatasetPath, ...
'FileExtensions','.mat','ReadFcn',@(x) matRead(x));
b=load(imds.Files{1});
c=b.Images;
cellArray=cellmat(1,155,240,240,0);
for k=1:155
cellArray{k}=c(:,:,k); % storing each slice in cell array
end
%[trainDigitData,valDigitData] = splitEachLabel(cellArray,75,'randomize');
trainDigitData = cellArray(1:100);
valDigitData = cellArray(101:155);
%% Define Network Architecture
% Define the convolutional neural network architecture.
layers = [
imageInputLayer([240 240 1])
convolution2dLayer(3,16,'Padding',1)
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,32,'Padding',1)
batchNormalizationLayer
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(3,64,'Padding',1)
batchNormalizationLayer
reluLayer
fullyConnectedLayer(10)
softmaxLayer
classificationLayer];
%% specify training options
options = trainingOptions('sgdm',...
'MaxEpochs',3, ...
'ValidationData',cellArray(101:155),...
'ValidationFrequency',30,...
'Verbose',false,...
'Plots','training-progress');
error
Error using trainingOptions (line 187)
The value of 'ValidationData' is invalid. Cell array with validation data must have two
elements: the input data X and a numeric array of responses Y.
Error in test (line 43)
options = trainingOptions('sgdm',...
8 Comments
Walter Roberson
on 6 Aug 2019
If all of this were working properly, then would would the desired outcome be? That you feed in images and it would tell you whether somewhere in the image there was a Grade II pteroblastoma ? Or that in each case you would get out a fully labeled image? If I understand your code correctly (and I probably do not), your code is set up to consider an entire image and classify the image as a whole into one of several different classes.
Answers (0)
See Also
Categories
Find more on Biomedical Imaging in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!