フィルターのクリア

index is out of range for deletion - error while training semantic segmentation network

1 回表示 (過去 30 日間)
YA
YA 2020 年 5 月 19 日
コメント済み: Mario Malic 2021 年 3 月 7 日
Hi,
I'm having an issue while training a UNET network for semantic segmentation on 3D nifti images.
I'm getting the following error:
>> network = trainNetwork(ds,lgraph,options);
Error using trainNetwork (line 165)
Matrix index is out of range for deletion.
Caused by:
Matrix index is out of range for deletion.
I'm not sure whether I built wrongly the network or that I didn't created the datastore for training as needed (I'm trying to load 3D nifti images in order to train a 2D semantic segmentation of each "slice" of the 3D image).
Could you please assist me with this issue?
below is my code:
%% Create U-Net Network with Custom Encoder-Decoder Depth
imageSize = [512 512 1];
numClasses = 2;
encoderDepth = 5;
lgraph = unetLayers(imageSize,numClasses,'EncoderDepth',encoderDepth);
dataSetDir = fullfile('c:\','Users','ya','Desktop','images_for_matlab_training');
imageDir = fullfile(dataSetDir,'images');
labelDir = fullfile(dataSetDir,'gTruth');
% Create an imageDatastore object to store the training images
imds = imageDatastore(imageDir,'FileExtensions','.gz','ReadFcn',@ReadNifti);
% Create an pixelDatastore object to store the training images
classNames = ["liver","background"];
labelIDs = [255 0];
pxds = pixelLabelDatastore(labelDir,classNames,labelIDs,'FileExtensions','.gz','ReadFcn',@ReadNifti);
% Create a datastore for training the network
ds = pixelLabelImageDatastore(imds,pxds);
% Set training options
options = trainingOptions('sgdm', ...
'InitialLearnRate',1e-3, ...
'MaxEpochs',3, ...
'MiniBatchSize',10, ...
'Plots','training-progress',...
'Verbose',1,...
'Shuffle','once');
% Train the network
network = trainNetwork(ds,lgraph,options);
Thanks!!
  5 件のコメント
GABRIELZHU ZHU
GABRIELZHU ZHU 2021 年 3 月 7 日
Thank you Mario. But I don't know where the step is.
Mario Malic
Mario Malic 2021 年 3 月 7 日
It looks like it's inside your last line. The full error message should show where is the actual error. If error is somewhere within trainNetwork, then maybe your setup is wrong? I do not know anything about Deep Learning, so I can't help you. Verify that your inputs are correct, use debugging to find out where is the error.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by