For the trainNetwork function, progress plots for training are not closing, except if done manually. How do I close it? I have tried close all, close force, close(fig), & more

6 visualizzazioni (ultimi 30 giorni)
Please only answer if you have tried to use trainNetwork with the same plot below, and the answer works for that in Matlab 2023a and Matlab2023b as this seems to be a special case where the close function does not work as normal, and more. I have tried many things and other things. Below is the code.
options = trainingOptions('adam', ...
'InitialLearnRate',0.002, ...
'LearnRateSchedule','piecewise',...
'LearnRateDropPeriod',1000, ...
'LearnRateDropFactor',0.75,...
'MiniBatchSize',40,...
'Shuffle','every-epoch', ...
'MaxEpochs',7000, ...
'Verbose',false, ...
'Plots','training-progress', ...
'ExecutionEnvironment','gpu');
%MaxEpochs was 7000,
[net, info] = trainNetwork(trainEps,trainH,layers,options);
currentfig = findall(groot,'Tag','NNET_CNN_TRAININGPLOT_UIFIGURE');
save([namedd2],...
"net","cmlSz","test","lblTrain","ulTrain",...
"cmlPref","cmlMed","cmlSuf","info")
close all
clear trainEps
  2 Commenti
Matt J
Matt J il 8 Lug 2025
Please only answer if you have tried to use trainNetwork with the same plot below,
How would we? The training data has not been provided. Anyway, I doubt you'll find a solution here if close force is only failing for one particular example. Tech Support will have to be involved.
Joss Knight
Joss Knight il 18 Lug 2025

The training plot is an app, not a figure, so can't be closed or managed using figure commands. I'll find a workaround for you.

Accedi per commentare.

Risposte (1)

Matt J
Matt J il 8 Lug 2025
Try resetting your GPU.
gpu = gpuDevice;
reset(gpu);
close all force
  2 Commenti
Peter Man
Peter Man il 18 Lug 2025
Modificato: Peter Man il 18 Lug 2025
This is surprising. "close all force" and "close all hidden" works for me (in 23b)
The training plot is a uifigure with HandleVisibility = "off". During training, it has a custom CloseRequestFcn to stop users from closing the window during training, but once training has finished, we set the CloseRequestFcn back to "closereq", which is the default closing callback for all uifigures. So after training, the uifigure has the following:
  • HandleVisibility = "off"
  • CloseRequestFcn = "closereq"
This combination means that either of the two calls should programmatically close the training plot:
  • "close all hidden"
  • "close all force" % This should work even if the CloseRequestFcn were something different to "closereq".
I recommend trying the following code, and posting the result:
f = uifigure();
f.HandleVisibility % I would like to know what this shows for you
f.CloseRequestFcn % I would like to know what this shows for you
close all hidden % Does this work for you?
close all force % Try this if the previous line doesn't work for you.

Accedi per commentare.

Categorie

Scopri di più su Graphics Object Programming in Help Center e File Exchange

Prodotti


Release

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by