Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

how to choose specific GPUs on multi-GPUs server to train my CNN?

2 vues (au cours des 30 derniers jours)
longbin yan
longbin yan le 12 Mar 2018
Clôturé : MATLAB Answer Bot le 20 Août 2021
Our lab has a server with 8 GPUs(0,1,2,...,7),I want to choose No.1 and No.3 GPUs to train my CNN,how to do? The code is shown below.thanks
clear
trainingData = imageDatastore('C:\Users\Administrator\Desktop\matlab code\Training',... 'IncludeSubfolders',true,'LabelSource','foldernames');
testData = imageDatastore('C:\Users\Administrator\Desktop\matlab code\Test',... 'IncludeSubfolders',true,'LabelSource','foldernames');
layers = [ ... imageInputLayer([227 227 3]) convolution2dLayer(5,8) reluLayer() maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(5,48)
reluLayer()
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(5,48)
reluLayer()
dropoutLayer('Name','drop1')
fullyConnectedLayer(2)
softmaxLayer()
classificationLayer()];
options = trainingOptions('sgdm',...
'InitialLearnRate',0.0001,...
'MiniBatchSize',16,...
'MaxEpoch',1,...
'ExecutionEnvironment','multi-gpu')
net = trainNetwork(trainingData,layers,options);
YTest = classify(net,testData);
TTest = testData.Labels;
accuracy = sum(YTest == TTest)/numel(TTest)

Réponses (0)

Cette question est clôturée.

Community Treasure Hunt

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

Start Hunting!