필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
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
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 CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by