I have build the UNET model in MATLAB, the training was interrupted, Now I am trying to resume/continue the training from the last checkpoint (saved during the training) , but I got the Error

" Unable to use a value of type DAGNetwork as an index.

Error in (line 27) training = trainNetwork(pximds,lgraph(net),options); "

Here is my code, can someone tell me why I got this error.

  • 1- clear all
  • 2- close all
  • 3- load('net_checkpoint__226644__2021_07_08__16_18_25.mat','net')
  • 4- matlabpath = 'E:\My project';
  • 5- data = fullfile(matlabpath,'ImageDatasetforPixelLabelDataSeries6- 21');
  • 6- data1 = fullfile(matlabpath,'PixelLabelDataSeries6-21');
  • 7- imds = imageDatastore(data,'IncludeSubfolders',true, 'LabelSource','foldernames');
  • 8- classes = ["CatheterMarkerVessel" "Background"];
  • 9- pixelLabelIDs = [0 1];
  • 10- pxds = pixelLabelDatastore(data1, classes ,pixelLabelIDs);
  • 11- trainingdata = pixelLabelImageSource(imds,pxds);
  • 12- tbl = countEachLabel(trainingdata);
  • 13- imageSize = [1024 1024 1];
  • 14- numClasses = numel(classes);
  • 15- lgraph = unetLayers(imageSize,numClasses,'EncoderDepth',5);
  • 16- %% Data Augmentation
  • 17- augmenter = imageDataAugmenter('RandXReflection',true, 'RandYReflection',true);
  • 18- pximds = pixelLabelImageDatastore(imds,pxds,'DataAugmentation', augmenter);
  • 19- %% Training
  • 20- options = trainingOptions('sgdm', ...
  • 21- 'InitialLearnRate',0.0001, ...
  • 22- 'Momentum',0.99, ...
  • 23- 'MiniBatchSize',1, ...
  • 24- 'MaxEpochs',300, ...
  • 25- 'Plots','training-progress', ...
  • 26- 'CheckpointPath','E:\My Project');
  • 27- training = trainNetwork(pximds,lgraph(net),options);
More Adnan Iltaf's questions See All
Similar questions and discussions