How can I plot the amount of time it takes for a neural network to process images every epoch?
8 ビュー (過去 30 日間)
古いコメントを表示
Right now, I'm working with the deep learning example for creating a CNN and training it using the cifar10 data set.
When I run it, I see that the program prints out a summary of how my network is training in the command line. One of these outputs is the Time elapsed. I also know that in trainingOptions, there's a paramater called OutputFcn. I'd like to know how I could use OutputFcn to generate a plot where time elapsed is in the y axis and the current epoch is in the X axis.
0 件のコメント
回答 (1 件)
Sandeep
2023 年 3 月 28 日
Hi Alexander Yuan,
It is possible to use the OutputFcn parameter in trainingOptions to specify a callback function that is executed at the end of each epoch during training. You can define your custom function to plot the time elapsed versus the current epoch.
You can do the same by defining a custom function that takes three input arguments info, state and plots. info contains information about the training progress, state contains the state of the network and training data, and plots contains any existing plots.
An example implementation of the custom function is as follows,
function plots = plotTrainingTime(info, state, plots)
if info.State == "start"
% Initialize plot
plots = plot([],[],'LineWidth',2);
xlabel('Epoch')
ylabel('Time Elapsed (s)')
title('Training Time vs Epoch')
drawnow
else
% Update plot
epoch = info.Epoch;
timeElapsed = info.TrainingElapsedTime;
set(plots,'XData',[plots.XData epoch],'YData',[plots.YData timeElapsed])
drawnow
end
end
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!