Matlab Help Needed Please
4 views (last 30 days)
Show older comments
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
Answers (0)
See Also
Categories
Find more on Image Data Workflows in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!