why this Warning message occur: Support for GPU devices with Compute Capability 5.0 will be removed in a future MATLAB release? how can fix it?

9 vues (au cours des 30 derniers jours)
I have a matlab code to classify x-ray dataset. I used the Googlenet model with augmentation for classiying. But each time I try to run the code a warning message occur.
the matlab code is:
clear
clc
datapath='dataset';
imds=imageDatastore(datapath,'includeSubfolders',true,'LabelSource','foldernames');
total_split=countEachLabel(imds);
num_images=length(imds.Labels);
perm=randperm(num_images,4);
figure;
for idx=1:length(perm)
subplot(2,2,idx);
imshow(imread(imds.Files{perm(idx)}));
title(sprintf('%s',imds.Labels(perm(idx))))
end
num_folds=5;
for fold_idx=1:num_folds
fprintf('processing %d among %d folds \n',fold_idx,num_folds);
test_idx=fold_idx:num_folds:num_images;
imdsTest = subset(imds,test_idx);
train_idx=setdiff(1:length(imds.Files),test_idx);
imdsTrain = subset(imds,train_idx);
net=googlenet;
lgraph=layerGraph(net);
clear net;
numClasses = numel(categories(imdsTrain.Labels));
newLearnableLayer=fullyConnectedLayer(numClasses,...
'name','new_fc',...
'weightLearnRateFactor',2,...
'BiasLearnRateFactor',2);
lgraph=replaceLayer(lgraph,'loss3-classifier',newLearnableLayer);
newsoftmaxLayer = softmaxLayer('Name','new_softmax');
lgraph = replaceLayer(lgraph,'prob',newsoftmaxLayer);
newClassLayer=classificationLayer('Name','new_classoutput');
lgraph = replaceLayer(lgraph,'output',newClassLayer);
imdsTrain.ReadFcn=@(filename)preprocess_xray(filename);
imdsTest.ReadFcn=@(filename)preprocess_xray(filename);
options=trainingOptions('adam',...
'MaxEpochs',10,'miniBatchSize',8,...
'Shuffle','every-epoch',...
'InitialLearnRate',1e-4,...
'Verbose',false,...
'Plots','training-progress');
augmenter = imageDataAugmenter( ...
'RandRotation',[-5 5],'RandXReflection',1,...
'RandYReflection',1,'RandXShear',[-0.05 0.05],'RandYShear',[-0.05 0.05]);
auimds = augmentedImageDatastore([224 224],imdsTrain,'DataAugmentation',augmenter);
netTransfer=trainNetwork(auimds,lgraph,options);
augtestimds=augmentedImageDatastore([224 224],imdsTest);
[predicted_labels(test_idx),posterior(test_idx,:)] = classify(netTransfer,augtestimds);
save(sprintf('ResNet50_%d_among_%d_folds',fold_idx,num_folds),'netTransfer','test_idx','train_idx');
clearvars -except fold_idx num_folds num_images predicted_labels posterior imds netTransfer;
end
when run code, these messages occur:
processing 1 among 5 folds
Warning: Support for GPU devices with Compute Capability 5.0 will be removed in a future MATLAB release. For more information on GPU
support, see GPU Support by Release.
> In parallel.internal.gpu.selectDevice
In parallel.gpu/GPUDevice/current (line 44)
In gpuDevice (line 23)
In nnet.internal.cnn.util.isGPUCompatible (line 10)
In nnet.internal.cnn.util.GPUShouldBeUsed>iCheckLocalGPU (line 51)
In nnet.internal.cnn.util.GPUShouldBeUsed>iValidateGPU (line 85)
In nnet.internal.cnn.util.GPUShouldBeUsed (line 34)
In nnet.internal.cnn.assembler.setupExecutionEnvironment (line 27)
In nnet.internal.cnn.trainNetwork.doTrainNetwork (line 22)
In trainNetwork (line 182)
In try45 (line 46)
processing 2 among 5 folds
processing 3 among 5 folds
processing 4 among 5 folds
What shall I do to fix the problem?

Réponses (2)

Joss Knight
Joss Knight le 17 Juin 2022
warning("off","parallel:gpu:device:DeviceDeprecated");

Walter Roberson
Walter Roberson le 18 Juin 2022
You have several options:
  • you can upgrade your gpu hardware to Pascal architecture or later
  • you can wait a couple of releases until Maxwell and earlier are not supported at all, in which case the code will stop working with a different error message, solving the problem of receiving this error message
  • you could ignore the warning message and deal with the situation when eventually your code fails in a new release
  • you could turn off the warning and deal with the situation eventually when your code fails in a new release

Catégories

En savoir plus sur Image Data Workflows dans Help Center et File Exchange

Produits


Version

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by