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!