How can I plot the amount of time it takes for a neural network to process images every epoch?
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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 comentarios
Respuestas (1)
Sandeep
el 28 de Mzo. de 2023
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 comentarios
Ver también
Categorías
Más información sobre Deep Learning Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!