Hi,
i currently using the OutputFcn to save the finalised training progress as a figure, however i noticed that the saved figure are not the finalised result of the training progress instead it is the figure before reaching the finalised training with the validation accauracy. The result that i obtained is as followed.
Obtained figure:
Desired Figure (with validation accuracy):
Attached is also the code that i'm using in the live editor.
options = trainingOptions('sgdm', ... 'MiniBatchSize',miniBatchSize, ... 'MaxEpochs',2, ... 'InitialLearnRate',1e-4, ... 'Shuffle','every-epoch', ... 'ValidationData',augimdsValidation, ... 'ValidationFrequency',valFrequency, ... 'Verbose',false, ... 'Plots','training-progress', ... 'OutputFcn',@(info)SaveTrainingPlot(info));% ... Training code ...
% At the end of the script
function stop = SaveTrainingPlot(info)stop = false;if info.State == "done" currentfig = findall(groot,'Type','Figure'); savefig(currentfig,'test.fig')endend
The problem seem to be related to info.State == "Done", but is there any workaround to save the desired output as figure/image?
Best Answer