필터 지우기
필터 지우기

Matlab Help Needed Please

조회 수: 3 (최근 30일)
Anas Bilal
Anas Bilal 2020년 4월 18일
댓글: Anas Bilal 2020년 4월 18일
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
Walter Roberson
Walter Roberson 2020년 4월 18일
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 2020년 4월 18일
ok .i'll try

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by