FCN not being able to resume
2 ビュー (過去 30 日間)
古いコメントを表示
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
0 件のコメント
回答 (1 件)
Suvidha Tripathi
2018 年 8 月 23 日
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Image Data Workflows についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!