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

2 views (last 30 days)
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!

Answers (1)

Milan Bansal
Milan Bansal on 10 Sep 2024
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!

Categories

Find more on Get Started with Deep Learning Toolbox in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!