How to plot training progress for CNN architecture in App Designer axes?

2 次查看(过去 30 天)
Currently I'm doing a project to analyse CNN architecture and monitor the accuracy by using training progress plot. When I run the code below the training progress window will appear. In the same time, I made an apps for this simulation by using app designer. So that when user run the simulation the training progress will be shown on the axes in App Designer. When I insert the code into the callback of pushbutton, the training progress appear on another window. But I want to make that Training Progress plot on the axes. Below is the code for callback function
miniBatchSize = 30;
valFrequency = floor(numel(imdsTrain.Files)/miniBatchSize);
options = trainingOptions('sgdm', ...
'MiniBatchSize',miniBatchSize, ...
'MaxEpochs',20, ...
'InitialLearnRate',0.0001, ...
'Shuffle','every-epoch', ...
'ValidationData',imdsValidation, ...
'ValidationFrequency',valFrequency, ...
'Verbose',false, ...
'Plots','training-progress');
net = trainNetwork(imdsTrain,lgraph,options);
Tq for the assistance!

回答(1 个)

Milan Bansal
Milan Bansal 2024-9-10
Hi Nurul Atikah Mazlan
I understand that you wish to plot the training-progress of a neural network in the your app window but are unable to do so.
To display the training progress within a specific UIAxes in MATLAB App Designer, you can’t directly control the training-progress plot as it defaults to a separate figure window. However, you can modify your code to manually plot the accuracy and loss data on the app's UIAxes as the training progresses by using a custom training loop and callbacks.
Here's a general approach using a custom training loop and updating the plot in UIAxes during the training:
  1. Remove the 'Plots', 'training-progress' option.
  2. Use a custom training loop where you can access the current training accuracy and loss, and update the plot manually within your app's axes. You can refer to the the following documentation link for example : https://www.mathworks.com/help/deeplearning/deep-learning-custom-training-loops.html
Please refer to the following documentation link to learn more about training-progress options:
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Get Started with Deep Learning Toolbox 的更多信息

标签

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by