Help me for this CUDA Error
조회 수: 1(최근 30일)
표시 이전 댓글
This is regarding my Project Work doing on Matlab for detection of Diabetic Retinopathy stages using MATLAB.
trainingData=imageDatastore('datastorage',...
'IncludeSubFolders',true,'LabelSource','foldername');
[imdsTrain,imdsValidation]=splitEachLabel(trainingData,0.75,'randomized');
countEachLabel(trainingData);
categories={'Mild NPDR','Moderate NPDR','No DR','Proliferative DR','Severe NPDR'};
layer='fc1';
netLayers = [imageInputLayer([227 227 3],'Name','inp')...
,convolution2dLayer(12,25,'Name','conv1')...
,reluLayer('Name','rel_1')...,
maxPooling2dLayer(3,'Stride',2,'Name','pool_1')...
,convolution2dLayer(12,25,'Name','conv_2')...
,reluLayer('Name','relu_2')...,
maxPooling2dLayer(3,'Stride',2,'Name','pool_2')...
,batchNormalizationLayer('Name','bn1')...
,convolution2dLayer(12,25,'Name','conv_3')...
,batchNormalizationLayer('Name','bn2')...
,reluLayer('Name','relu_3')...,
maxPooling2dLayer(3,'Stride',2,'Name','pool_3')...
,fullyConnectedLayer(5,'Name','fc1')...
,softmaxLayer('Name','sm1')...
,classificationLayer('Name','cl_out')];
lgraph=layerGraph(netLayers);
analyzeNetwork(lgraph);
inputSize=[227 227 3];
augmidsTest=augmentedImageDatastore(inputSize(1:2),imdsValidation);
netOptions = trainingOptions("sgdm",'MiniBatchSize',64, ...
'InitialLearnRate',0.001, ...
'MaxEpochs',20, ...
'Plots','training-progress',...
'ValidationData',augmidsTest,...
'ExecutionEnvironment','cpu');%'cpu' for single cpu, 'gpu' for single gpu,'parallel' for multi-cpu/gpu
ASNet= trainNetwork(trainingData, netLayers, netOptions);
featuresTrain=activations(ASNet,imdsTrain,layer,'OutputAs','rows');
featuresTest=activations(ASNet,imdsValidation,layer,'OutputAs','rows');
svmtrain=fitcecoc(featuresTrain,imdsTrain.Labels);
YPred=predict(svmtrain,featuresTest);
plotconfusion(imdsValidation.Labels,YPred);
featuresTrain=double(featuresTrain);
trainingLabels=imdsTrain.Labels;
trainingLabels=cellstr(trainingLabels);
t=templateSVM('standardize',1);
mdl=fitcecoc(double(featuresTrain),cellstr(trainingLabels),'Learners',t,'FitPosterior',1,'ClassNames',{'Mild NPDR','Moderate NPDR','No DR','Proliferative DR','Severe NPDR'});
[cm,order] = confusionmat(imdsValidation.Labels,YPred);
tp=cm(1,1)+cm(2,2)+cm(3,3)+cm(4,4);
tn=cm(5,5);
fp=cm(1,2)+cm(1,3)+cm(1,4)+cm(1,5)+cm(2,1)+cm(2,3)+cm(2,4)+cm(2,5)+cm(3,1)+cm(3,2)+cm(3,4)+cm(3,5)+cm(4,1)+cm(4,2)+cm(4,3)+cm(4,5);
fn=cm(5,1)+cm(5,2)+cm(5,3)+cm(5,4);
precision = tp / (tp + fp);
recall = tp / (tp + fn);
accuracy=(tp+tn)/(tp+fp+fn+tn);
F1 = (2 * precision * recall) / (precision + recall);
predictedLabels=predict(mdl,featuresTest);
[predictedLabels,~,~,Posterior]=predict(mdl,featuresTest);
testLabels=imdsValidation.Labels;
testLabels=cellstr(testLabels);
[X,Y]=perfcurve(testLabels,Posterior(:,4),'No DR');
[A,B]=perfcurve(testLabels,Posterior(:,1),'Mild NPDR');
[C,D]=perfcurve(testLabels,Posterior(:,2),'Moderate NPDR');
[E,F]=perfcurve(testLabels,Posterior(:,5),'Severe NPDR');
[G,H]=perfcurve(testLabels,Posterior(:,3),'Proliferative DR');
p=linspace(0,1);
q=linspace(0,1);
figure
plot(p,q);
hold on;
plot(X,Y,'r-*');
hold on;
plot(A,B,'g-*');
hold on;
plot(C,D,'b-*');
hold on;
plot(E,F,'y-*');
hold on;
plot(G,H,'c-*');
xlabel('FPR');
ylabel('TPR');
legend(categories);
%ASNet=deerNet;
save ASNet;
The code runs perfectly on My Laptop, which has AMD Radeon 530
But, when I try to run the same code in college computer, it shows unexpected launch failure, which uses NVIDIA GT710, error is CUDA_ERROR_LAUNCHED_FAILURE
Please do help me
댓글 수: 0
채택된 답변
Joss Knight
2022년 4월 12일
I see two calls to predict which don't specify ExecutionEnvironment and therefore will be trying to use your college computer's NVIDIA card. Add " ExecutionEnvironment='cpu' " to those calls.
추가 답변(0개)
참고 항목
범주
Find more on Get Started with GPU Coder in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!