Effacer les filtres
Effacer les filtres

Matlab Help Needed Please

2 vues (au cours des 30 derniers jours)
Anas Bilal
Anas Bilal le 18 Avr 2020
Commenté : Anas Bilal le 18 Avr 2020
hello everyne i'm runing this code for testing and training but receiving errors can any please help me to correct this code i shall be very thank full to you for this kindness.
clc
clear all
close all
image=uigetfile(['*.jpg'],'D:\Diabetic retnopathery\DR code');
copyfile('D:\Diabetic retnopathery\DR code','D:\Diabetic retnopathery\DR code\New Folder');
%inp=input('ENTER IMAGE :');
imgg=imread(image);
aa=imgg;
[m n c]=size(aa);
if c==3
b=rgb2gray(aa);
else
b=aa;
end
im =b;
figure,
imshow(aa)
title('input ')
matlabroot='D:\Diabetic retnopathery\DR code'
DatasetPath = fullfile(matlabroot,'fundusdeeplearning','Dataset1');
Data = imageDatastore(DatasetPath, ...
'IncludeSubfolders',true,'LabelSource','foldernames');
CountLabel = Data.countEachLabel;
trainData=Data;
%% Define the Network Layers
% Define the convolutional neural network architecture.
layers = [imageInputLayer([336 448 3])
convolution2dLayer(5,20)
reluLayer
maxPooling2dLayer(2,'Stride',2)
convolution2dLayer(5,20)
reluLayer
maxPooling2dLayer(2,'Stride',2)
fullyConnectedLayer(2)
softmaxLayer
classificationLayer()];
options = trainingOptions('sgdm','MaxEpochs',15, ...
'InitialLearnRate',0.0001);
convnet = trainNetwork(trainData,layers,options);
%% Classify the Images in the Test Data and Compute Accuracy
% Run the trained network on the test set that was not used to train the
% network and predict the image labels (digits).
img =imgg;
img=imresize(img,[336 448]);
size(img)
outt = classify(convnet,img);
tf1=[]
for ii=1:2
st=int2str(ii)
tf = ismember(outt,st);
tf1=[tf1 tf];
end
out=find(tf1==1);
ss=sprintf('THE CLASS IS : %2f ',round((out)));
if out==1
msgbox('NORMAL')
elseif out==2
msgbox('AB NORMAL')
end
  9 commentaires
Walter Roberson
Walter Roberson le 18 Avr 2020
If I am correct about the cause of the problem, then the only way to fix your code would be to put in some tests to detect the situation and give a appropriate message without trying to do the training.
That is, if I am right about the error, then then problem is your data and not the code.
Anas Bilal
Anas Bilal le 18 Avr 2020
ok .i'll try

Connectez-vous pour commenter.

Réponses (0)

Catégories

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

Community Treasure Hunt

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

Start Hunting!

Translated by