FCN not being able to resume

2 visualizaciones (últimos 30 días)
filipendo125
filipendo125 el 27 de En. de 2018
Respondida: Suvidha Tripathi el 23 de Ag. de 2018
So I have performed some training on my data, and wanted to test my solution half-way through running training of FCN network for semantic segmentation. However, I got this error:
Error using trainNetwork (line 140)
The last layer must be an output layer.
Error in neural2 (line 93)
[sp, info] = trainNetwork(datasource,war.Layers,options);
Caused by:
Error using nnet.internal.cnn.layer.util.inferParameters (line 7)
The last layer must be an output layer.
What I have done is just loaded that checkpoint and tried to run training on it again, but that failed. Below is a short piece of my code with else statement not working:
imageSize = [227 227];
numClasses = numel(classes);
lgraph = fcnLayers(imageSize,numClasses,'type','16s');
st = fullfile('imade','checkPoint');
datasource = pixelLabelImageSource(imdsTrain,pxdsTrain);
doTraining = true;
if doTraining
options = trainingOptions('sgdm',...
'Plots','training-progress',...
'MiniBatchSize',1,...
'CheckpointPath', st,...
'Momentum',0.99,...
'InitialLearnRate', 1e-12,...
'L2Regularization',0.0005);
[net, info] = trainNetwork(datasource,lgraph,options);
else
options = trainingOptions('sgdm',...
'Plots','training-progress',...
'MaxEpochs',19, ...
'MiniBatchSize',1,...
'CheckpointPath', st,...
'Momentum',0.99,...
'InitialLearnRate', 1e-12,...
'L2Regularization',0.0005);
data = load (strcat(st,filesep,'convnet_checkpoint__4607__2018_01_27__21_25_03.mat'));
war = data.net;
[sp, info] = trainNetwork(datasource,war.Layers,options);
end

Respuestas (1)

Suvidha Tripathi
Suvidha Tripathi el 23 de Ag. de 2018
When you are resuming training from a checkpoint in case of layer graph object, then just do this modification
newlgraph=layerGraph(net);
new_net = trainNetwork(pximds,newlgraph,options)
where net is your last checkpoint network.

Categorías

Más información sobre Image Data Workflows en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by