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
이전 댓글 표시
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
Matt J
2025년 7월 8일
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
2025년 7월 18일
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.
답변 (1개)
Matt J
2025년 7월 8일
Try resetting your GPU.
gpu = gpuDevice;
reset(gpu);
close all force
댓글 수: 2
Gad Licht
2025년 7월 9일
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.
카테고리
도움말 센터 및 File Exchange에서 Shifting and Sorting Matrices에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!