How to save training plot in batch mode (deep learning toolbox)

2 views (last 30 days)
Hi,
In regards to the deep learning toolbox, is there a way to save the training plots to a .mat, .jpg, or .fig?
My issue is that I am running my matlab scripts on a server in batch mode and won't actually see this plot (everything is over the terminal, run with batch files). However I can save data to a .mat file so that I can view it later. Is it possible to save the plot to as a file? Or, maybe there is a better way to do this?
Similar question, is there a way to re-generate the training progress plot after I have finished training the network if I have the net or DAGNetwork file?
Thank you so much for helping me out with this :)

Answers (1)

James Latshaw
James Latshaw on 17 Nov 2020
However, this process can cause output errors if you have very large networks (using lots of memory) because you are trying to save a rich in data plot to memory. I found a work around as plotting the last value of training. So, this isn't a nice plot, but at least it give me some metric to evaluate the RMSE value (or accuracy):
function stop=savetrainingplot(info)
stop=false; %prevents this function from ending trainNetwork prematurely
if info.State=='done' %check if all iterations have completed
% if true
%saveas(gcf,'filename.png') % save figure as .png, you can change this
file_name = ['big3_performance_' num2str(floor(now*100000)) '.mat'];
% to_save_fig = findall(groot, 'Type', 'Figure');
% to_save_fig_last = to_save_fig(end);
%saveas(figure(to_save_fig(end)), file_name)
performance = [info.Iteration info.Epoch info.ValidationRMSE];
save(file_name, 'performance', '-v7.3')
end
end
I hope that this helps someone :)
  1 Comment
Théo
Théo on 10 May 2021
Hello,
After struggling for a few hours, I found a workaround :
savefig(currentfig, yourfig.fig, 'compact')
The display is a bit affected but still fine.
I found this parameter scrolling down the savefig help document.
Best,
Théo

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!