Save training progress plots using OutputFcn
6 次查看(过去 30 天)
显示 更早的评论
Hi,
I'm trying to save the training progress plots using the OutputFcn training option as written in a previous question:
I'm using Matlab v.2018b and that solution doesn't work, this is the code that I'm using in a live script:
options = trainingOptions('sgdm',...
'InitialLearnRate',0.003,...
'Plots','training-progress', ...
'ValidationData',garVal,...
'ValidationFrequency',40,...
'MaxEpochs',1,...
'LearnRateSchedule', 'piecewise',...
'LearnRateDropPeriod',3,...
'Shuffle','every-epoch',...
'ValidationPatience',5,...
'OutputFcn',@(info)SaveTrainingPlot(info),...
'Verbose',true);
% ... 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,'prova.png')
end
end
At the end of the training this error appears:
Functionality not supported with figures created with the uifigure function. For more information, see Graphics Support in App Designer.
The problem seems to be the function savefig (and also saveas has the same problem)... and, if I use gcf instead of groot inside savefig, a blanck picture is saved.
How can I solve the problem? Is there an other way to save the training progress plots?
Thanks!
0 个评论
回答(1 个)
Bhargavi Maganuru
2019-8-5
“savefig” accepts ‘.fig’ file extension only. It does not accepts other file extensions. For more information see the “input Arguments” section in the below MATLAB documentation.
Whereas “saveas” function accepts ‘.png’,’.fig’ and many other file extensions. For more information see the “input Arguments” section in the below MATLAB documentation.
Hope this helps.
1 个评论
M J
2020-10-5
Hi, can I use the OutputFcn to add any function I created (in my case : a function that processes the image datastore in a specific way)? Thank you!
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!