フィルターのクリア

invalid training data in matlab?

1 回表示 (過去 30 日間)
hla hla myint
hla hla myint 2020 年 11 月 2 日
My Code :imageDir=fullfile(tempdir,'PP');
if ~exist(imageDir,'dir')
mkdir(imageDir);
end
sourceDatalaoc=[imageDir filesep 'Brain'];
volc=fullfile (sourceDatalaoc, 'AA')
if~ exist(volc,'dir')
mkdir(volc);
end
loc=fullfile (sourceDatalaoc, 'BB')
if~ exist(loc,'dir')
mkdir(loc);
end
%matReader = @samplePXDSMatReader;
imds = imageDatastore(volc,'FileExtensions','.nii','ReadFcn',@sampleReadeFcn);
%auimds = augmentedImageDatastore([64 64 64 ],imds)
classNames = ["edema","nonEnhancingTumor","enhancingTumour"];
pixelLabelID = [1 2 3];
pxds = pixelLabelDatastore(loc,classNames,pixelLabelID,'FileExtensions','.nii','ReadFcn',@sampleReadeFcn);
V = read(imds);
L = read(pxds);
%h = labelvolshow(L,V(:,:,:,1));
pximds = pixelLabelImageDatastore(imds,pxds);
inputPatchSize = [132 132 132 4];
numClasses = 2;
patchSize = [132 132 132];
patchPerImage = 8;
miniBatchSize = 16;
patchds = randomPatchExtractionDatastore(imds,pxds,patchSize, ...
'PatchesPerImage',patchPerImage);
patchds.MiniBatchSize = miniBatchSize;
layers = [
image3dInputLayer([132 132 132 4])
convolution3dLayer(3,12,'Stride',1,'Padding','Same')
batchNormalizationLayer
reluLayer
transposedConv3dLayer(3,12,'Stride',1,'Cropping',1)
batchNormalizationLayer
reluLayer
transposedConv3dLayer(3,6,'Stride',1,'Cropping',1)
softmaxLayer
pixelClassificationLayer
]
opts = trainingOptions('sgdm', ...
'InitialLearnRate',1e-3, ...
'ExecutionEnvironment','CPU',...
'MaxEpochs',100);
[net2,info] = trainNetwork(patchds,layers,opts);close
function data = sampleReadeFcn(filename)
data = niftiread(filename)
end
Error: The output size[132 132 132 6] of the last layer does not match the reponse size[132 132 132 3 ]

回答 (0 件)

カテゴリ

Help Center および File ExchangePattern Recognition and Classification についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by