File Exchange

image thumbnail

Plant Leaf Disease Detection and Classification using Multiclass SVM Classifier

version 1.0.0.0 (884 KB) by Manu BN
A Matlab code to detect and classfy diseases in plant leaves using a multiclass SVM classifier

122 Downloads

Updated 23 Feb 2016

View License

A Matlab code is written to classify the leaves into one of the following types: 'Alternaria Alternata', 'Anthracnose', 'Bacterial Blight', 'Cercospora Leaf Spot' and 'Healthy Leaves'. Classification is done by Multiclass SVM (one vs. all)
How to run??
1. Place the folder 'Leaf_Disease_Detection_code' in the Matlab path, and add all the subfolders into that path
2. Run DetectDisease_GUI.m
3. In the GUI click on Load Image and load the image from Manu's Disease Dataset, click Enhance Contrast.
4. Next click on Segment Image, then enter the cluster no containing the ROI, i.e only the disease affected part or the healthy part
5. Click on classification results. Then measure accuracy (In this case Healthy vs All diseases).
The code is loosely based on the following paper, please cite the below and give credit to the authors:
[1] Akhtar, Asma, et al. "Automated Plant Disease Analysis (APDA): Performance Comparison of Machine Learning Techniques." Frontiers of Information Technology (FIT), 2013 11th International Conference on. IEEE, 2013.
[2] Multiclass SVM by Anand Mishra link: http://www.mathworks.com/matlabcentral/fileexchange/33170-multi-class-support-vector-machine
Suggestions and comments are always welcome

Thanks in advance,

Manu B.N

Cite As

Manu BN (2021). Plant Leaf Disease Detection and Classification using Multiclass SVM Classifier (https://www.mathworks.com/matlabcentral/fileexchange/55098-plant-leaf-disease-detection-and-classification-using-multiclass-svm-classifier), MATLAB Central File Exchange. Retrieved .

Comments and Ratings (248)

neslyn Bocio

Hi, sir how to create training_Data.mat? I'm confused with all the values that you used in train_Feat I don't understand where that all came from.

Akshay Gore

Contact for code and support mycodeworklab@gmail.com
Whatsapp +91 9464894829

1. RGB-Image-encryption-based-on-chaotic-system-and-DNA-algorithm

2. Image-encryption-based-on-chaotic-system

3. Image encryption by generating Halton sequences

4. Chaos-based-Image-Encryption

5. Text-Encryption Matlab code for AES,DES,Hybrid AES-DES and AES w/ chaos

6. Image encryption and decryption using chaotic key sequence generated by sequence of logistic map and sequence of states of Linear Feedback Shift Register

7. A New Approach of Image Encryption Using 3D Chaotic Map to Enhance Security of Multimedia Component

8. MATLAB was used for the implementation of Chaotic Digital Image Encryption.

9. Multiple-Color-Image-Encryption

10. Cryptanalyzing an Image Scrambling Encryption Algorithm of Pixel Bits.

11. Novel Image Compression encryption hybrid algorithm based on a key-controlled measurement matrix in compressive sensing.

12. An Image Encryption Scheme Based on a Hybrid Model of DNA Computing, Chaotic Systems and Hash Functions.

13. Colour image encryption algorithm combining Arnold map, DNA sequence operation, and a Mandelbrot set.

14. Advanced Encryption Standard

15. Reversible-Data-Hiding-by-Reserving-Room-Before-Encryption-MATLAB.

16. Image Encryption and Decryption Using Logistic Map Equation and Linear Feedback Shift.

17. A simple Matlab implementation of the algorithm presented in the paper: "Reversible-data-hiding-in-Encrypted-image"

17. Image encryption and encoding methods

19. DES 64bit Encryption and Decryption

20. Matlab project on blind digital watermarking and encryption.

21. Encrypting an image using Salient Object Detection and K-Means Clustering.

22. Recurrent Scale Approximation for Object Detection in CNN.

23. Object detection via a multi-region & semantic segmentation-aware CNN model.

24. R-FCN: Object Detection via Region-based Fully Convolutional Networks

25. Adversarial Examples for Semantic Segmentation and Object Detection.

26. Object Detection in Videos toolkit for VisDrone2019

27. Computational biology and medical image processing scripts and programs.
28. A MATLAB library/toolbox providing access to image registration suitable for use with medical images.
29. Lung medical image analysis and visualisation software for Matlab.
30. Medical ultrasound image processing.Carotid ultrasoung segmentation using RF data.
31. A Phase Congruency and Local Laplacian Energy Based Multi-Modality Medical Image Fusion Method in NSCT Domain.
32. Automatic tool for landmark localisation in 3D medical images.
33. Advanced-Medical-Image-Processing.
34. Recognizing and Refining the location of Individual Vessels in Segmented Retinal Images.
35. Image segmentation method on medical image is provided and tested.
36. 3D non-rigid image registration for medical and synthetic images using truncated hierarchical B-splines (THB-Splines).
37. Laplacian Re-Decomposition for Multimodal Medical Image Fusion[J]. IEEE Transactions on Instrumentation and Measurement, 2020.
38. Medical software for Processing multi-Parametric images Pipelines.
39. Prostate cancer segmentation based on MRI and PET images.
40. Image segmentation methods for biomedical purposes such as cell segmentation, blood vessel segmentation (eye blood vessels), and segmentation of brain tumors.
41. Medical Image Analysis Breast Cancer Lesion Detection.
42. Medical image enhancement based on nonlinear technique and logarithmic transform coefficient histogram matching.
43. Machine Learning: A Bayesian and Optimization Perspective.
44.

Bushra Malik

sir plz can you gmail me this code plz.i need urgent

Dhakshayani J

@Yusuf Erdem, Sir, Even Im getting this error "Error while evaluating UIControl Callback. Have you got any solution. If so, please help me with it. Thanks

Yusuf Suer Erdem

Hello Sir, i can not use classification results. When i push it, i get this error;

Error using svmtrain (line 230)
svmtrain has been removed. Use fitcsvm instead.

Error in multisvm (line 28)
svmStruct = svmtrain(T,newClass);

Error in DetectDisease_GUI>pushbutton6_Callback (line 381)
result = multisvm(Train_Feat,Train_Label,test);

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in DetectDisease_GUI (line 46)
gui_mainfcn(gui_State, varargin{:});

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)DetectDisease_GUI('pushbutton6_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.

Can you help me? My e-mail: yusufsuererdem@gmail.com, Thanks a lot,

Ashwini Patil

how can i classify plant disease data using neural network ,i do not understand ,please help me

sabiya fatima

Manu sir, how did you make "training_data.mat" and "Accuracy_data.mat"?? can we use this code to other image data set without changing both .mat data? if we should change then please provide the training images and code. i just want to understand this code for my own project. with different dataset

sabiya fatima

sir i am getting this error while running this code
Undefined function 'crossvalind' for input
arguments of type 'char'.
please help me to solve it

Farizul Azlan

My email is farizulazlan33@gmail.com

Muzamal Ali

@manu bn
plz help us...

Muzamal Ali

Please send me the report of this project... To fulfill the lther requirements plz...
Urgent need.. Email -> Muzamalali7755@gmail.com

Muzamal Ali

hello sir. i got issue in finding the ( classification result ) section...
am using ( 2018a version )...
please help my email muzamalali7755@gmail.com

ans =

'Affected Area is: 15.1943%'

Error using svmtrain (line 230)
svmtrain has been removed. Use fitcsvm instead.

Error in multisvm (line 28)
svmStruct = svmtrain(T,newClass);

Error in DetectDisease_GUI>pushbutton6_Callback (line 381)
result = multisvm(Train_Feat,Train_Label,test);

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in DetectDisease_GUI (line 46)
gui_mainfcn(gui_State, varargin{:});

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)DetectDisease_GUI('pushbutton6_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.

>>

Farizul Azlan

Hello, sir, I tried to apply your code in my system and there is some error when I click Recognise/Classify button to classify my plant but for the accuracy, it works and gives the result. Below error, I get after click button recognise :

Undefined function or variable 'itr'.

Error in multisvm (line 65)
valt=Cb==u(itr); % This logic is used to allow classification

Error in bonsai>pushbutton7_Callback (line 198)
result = multisvm(Train_Data,Train_Label,test);

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in bonsai (line 16)
gui_mainfcn(gui_State, varargin{:});

sheharyar Aftab

Sir when i am running your code it is showing below error please solve this problem my mail id is: ch.sharyjutt@gmail.com
>> multisvm
Not enough input arguments.

Error in multisvm (line 5)
itrind=size(test,1);

Error using ClassificationSVM (line 249)
Use fitcsvm to train an SVM model.

Error in multisvm (line 29)
classes = ClassificationSVM(svmStruct,tst);

Error in DetectDisease_GUI>pushbutton6_Callback (line 381)
result = multisvm(Train_Feat,Train_Label,test);

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in DetectDisease_GUI (line 46)
gui_mainfcn(gui_State, varargin{:});

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)DetectDisease_GUI('pushbutton6_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback

Manjunatha S

Sir when i am running your code it is showing below error please solve this problem my mail id is: manjunathas443@gmail.com
>> multisvm
Not enough input arguments.

Error in multisvm (line 5)
itrind=size(test,1);

Error using ClassificationSVM (line 249)
Use fitcsvm to train an SVM model.

Error in multisvm (line 29)
classes = ClassificationSVM(svmStruct,tst);

Error in DetectDisease_GUI>pushbutton6_Callback (line 381)
result = multisvm(Train_Feat,Train_Label,test);

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in DetectDisease_GUI (line 46)
gui_mainfcn(gui_State, varargin{:});

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)DetectDisease_GUI('pushbutton6_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback

Manjunatha S

Sir when i am running your code it is showing below error please solve this problem my mail id is: manjunathas443@gmail.com
>> multisvm
Not enough input arguments.

Error in multisvm (line 5)
itrind=size(test,1);

Error using ClassificationSVM (line 249)
Use fitcsvm to train an SVM model.

Error in multisvm (line 29)
classes = ClassificationSVM(svmStruct,tst);

Error in DetectDisease_GUI>pushbutton6_Callback (line 381)
result = multisvm(Train_Feat,Train_Label,test);

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in DetectDisease_GUI (line 46)
gui_mainfcn(gui_State, varargin{:});

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)DetectDisease_GUI('pushbutton6_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback

pratima chavan

Hi sir, could you please send me the Training_Data and Accuracy_Data files??.. i found error while calculating classification

sabiya fatima

Sir when i am running your code it is showing below error please solve this problem my mail id is: sabiya1990fatima@gmail.com
>> multisvm
Not enough input arguments.

Error in multisvm (line 5)
itrind=size(test,1);

Error using ClassificationSVM (line 249)
Use fitcsvm to train an SVM model.

Error in multisvm (line 29)
classes = ClassificationSVM(svmStruct,tst);

Error in DetectDisease_GUI>pushbutton6_Callback (line 381)
result = multisvm(Train_Feat,Train_Label,test);

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in DetectDisease_GUI (line 46)
gui_mainfcn(gui_State, varargin{:});

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)DetectDisease_GUI('pushbutton6_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.

kamrul islam sharek

hi sir,this srk im from other countries.i got some problem around the code in (detec.m).i give my email :kamrulislamsharek.cse.rmstu@gmail.com)
please send the correct code...i will given that wrong code which will show some erroe.
% Project Title: Pomegranate Leaf Disease Detection
clc
close all
clear all
[filename, pathname] = uigetfile({'*.*';'*.bmp';'*.jpg';'*.gif'}, 'Pick a Leaf Image File');
I = imread(pathname,filename);
I = imresize(I,[256,256]);
%figure, imshow(I); title('Query Leaf Image');
% Enhance Contrast
I = imadjust(I,stretchlim(I));
figure, imshow(I);title('Contrast Enhanced');
% Otsu Segmentation
I_Otsu = im2bw(I,graythresh(I));
% Conversion to HIS
I_HIS = rgb2hsi(I);
%% Extract Features
% Function call to evaluate features
%[feat_disease seg_img] = EvaluateFeatures(I)
% Color Image Segmentation
% Use of K Means clustering for segmentation
% Convert Image from RGB Color Space to L*a*b* Color Space
% The L*a*b* space consists of a luminosity layer 'L*', chromaticity-layer 'a*' and 'b*'.
% All of the color information is in the 'a*' and 'b*' layers.
cform = makecform('srgb2lab');
% Apply the colorform
lab_he = applycform(I,cform);
% Classify the colors in a*b* colorspace using K means clustering.
% Since the image has 3 colors create 3 clusters.
% Measure the distance using Euclidean Distance Metric.
ab = double(lab_he(:,:,2:3));
nrows = size(ab,1);
ncols = size(ab,2);
ab = reshape(ab,nrows*ncols,2);
nColors = 3;
[cluster_idx cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean', ...
'Replicates',3);
%[cluster_idx cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean','Replicates',3);
% Label every pixel in tha image using results from K means
pixel_labels = reshape(cluster_idx,nrows,ncols);
%figure,imshow(pixel_labels,[]), title('Image Labeled by Cluster Index');
% Create a blank cell array to store the results of clustering
segmented_images = cell(1,3);
% Create RGB label using pixel_labels
rgb_label = repmat(pixel_labels,[1,1,3]);
for k = 1:nColors
colors = I;
colors(rgb_label ~= k) = 0;
segmented_images{k} = colors;
end
figure, subplot(3,1,1);imshow(segmented_images{1});title('Cluster 1'); subplot(3,1,2);imshow(segmented_images{2});title('Cluster 2');
subplot(3,1,3);imshow(segmented_images{3});title('Cluster 3');
set(gcf, 'Position', get(0,'Screensize'));
% Feature Extraction
x = inputdlg('Enter the cluster no. containing the ROI only:');
i = str2double(x);
% Extract the features from the segmented image
seg_img = segmented_images{i};
% Convert to grayscale if image is RGB
if ndims(seg_img) == 3
img = rgb2gray(seg_img);
end
%figure, imshow(img); title('Gray Scale Image');
% Evaluate the disease affected area
black = im2bw(seg_img,graythresh(seg_img));
%figure, imshow(black);title('Black & White Image');
m = size(seg_img,1);
n = size(seg_img,2);
zero_image = zeros(m,n);
%G = imoverlay(zero_image,seg_img,[1 0 0]);
cc = bwconncomp(seg_img,6);
diseasedata = regionprops(cc,'basic');
A1 = diseasedata.Area;
sprintf('Area of the disease affected region is : %g%',A1);
I_black = im2bw(I,graythresh(I));
kk = bwconncomp(I,6);
leafdata = regionprops(kk,'basic');
A2 = leafdata.Area;
sprintf(' Total leaf area is : %g%',A2);
%Affected_Area = 1-(A1/A2);
Affected_Area = (A1/A2);
if Affected_Area < 0.1
Affected_Area = Affected_Area+0.15;
end
sprintf('Affected Area is: %g%%',(Affected_Area*100))
% Create the Gray Level Cooccurance Matrices (GLCMs)
glcms = graycomatrix(img);
% Derive Statistics from GLCM
stats = graycoprops(glcms,'Contrast Correlation Energy Homogeneity');
Contrast = stats.Contrast;
Correlation = stats.Correlation;
Energy = stats.Energy;
Homogeneity = stats.Homogeneity;
Mean = mean2(seg_img);
Standard_Deviation = std2(seg_img);
Entropy = entropy(seg_img);
RMS = mean2(rms(seg_img));
%Skewness = skewness(img)
Variance = mean2(var(double(seg_img)));
a = sum(double(seg_img(:)));
Smoothness = 1-(1/(1+a));
Kurtosis = kurtosis(double(seg_img(:)));
Skewness = skewness(double(seg_img(:)));
% Inverse Difference Movement
m = size(seg_img,1);
n = size(seg_img,2);
in_diff = 0;
for i = 1:m
for j = 1:n
temp = seg_img(i,j)./(1+(i-j).^2);
in_diff = in_diff+temp;
end
end
IDM = double(in_diff);

feat_disease = [Contrast,Correlation,Energy,Homogeneity, Mean, Standard_Deviation, Entropy, RMS, Variance, Smoothness, Kurtosis, Skewness, IDM];
%%
% Load All The Features
load('Training_Data.mat')
% Put the test features into variable 'test'
test = feat_disease;
result = multisvm(Train_Feat,Train_Label,test);
%disp(result);
% Visualize Results
if result == 0
helpdlg(' Alternaria Alternata ');
disp(' Alternaria Alternata ');
elseif result == 1
helpdlg(' Anthracnose ');
disp('Anthracnose');
elseif result == 2
helpdlg(' Bacterial Blight ');
disp(' Bacterial Blight ');
elseif result == 3
helpdlg(' Cercospora Leaf Spot ');
disp('Cercospora Leaf Spot');
elseif result == 4
helpdlg(' Healthy Leaf ');
disp('Healthy Leaf ');
end
%% Evaluate Accuracy
load('Accuracy_Data.mat')
Accuracy_Percent= zeros(200,1);
for i = 1:500
data = Train_Feat;
%groups = ismember(Train_Label,1);
groups = ismember(Train_Label,0);
[train,test] = crossvalind('HoldOut',groups);
cp = classperf(groups);
svmStruct = svmtrain(data(train,:),groups(train),'showplot',false,'kernel_function','linear');
classes = svmclassify(svmStruct,data(test,:),'showplot',false);
classperf(cp,classes,test);
Accuracy = cp.CorrectRate;
Accuracy_Percent(i) = Accuracy.*100;
end
Max_Accuracy = max(Accuracy_Percent);
sprintf('Accuracy of Linear Kernel with 500 iterations is: %g%%',Max_Accuracy)

Uma Rani Kishan Kumar

archchu siva

Hi sir, could you please send me the Training_Data and Accuracy_Data files??.. if
you send me those files, it will be so so helpful for me...

Ragavi Thiyagarajan

Hi sir, i am doing the leaf disease classification related project right now. could you please send me the Training_Data and Accuracy_Data files??.. if
you send me those files, it will be so so helpful for me...
My mail id: rasinathiya@gmail.com
please concern about by request
Thank you

Aviral Bhatia

Aman Jaiswal

hi would you pls send me the training_dat.mat and accuracy.mat files?
my email id - amanjaswal078@gmail.com

hi. would you please send me train file?
mh.javidan@gorganiau.ac.ir
thaks

Karakule

Sir,

I read all the comments at https://www.mathworks.com/matlabcentral/fileexchange/55098-plant-leaf-disease-detection-and-classification-using-multiclass-svm-classifier.

I wanted to take advantage of your "Project Title: Pomegranate Leaf Disease Detection" title code. I've analyzed the entire code. I want to ask you two questions.

1.Training_Data.mat file contains features for 125 images. Can you share the database with these images?

2. I have no idea about the data of the first 100 rows from 0 "to the last 25 rows 1" from the Accuracy_Data.mat file. Please give us some information about this.

Gilbert Waweru

I found an easier way of classifying.... Use the classifierapp, much easier

Zeeshan Zulfiqar

hi, i have an error in classify, in this code svmStructDisease = svmtrain(diseasefeat,diseasetype);. how to solve it?

Ashwini Patil

hello sir , please help me can i run this code in simulink for standalone application

nikhil gayam

Perfectly works with matlab2015

mayuri chougule

hello sir, The same project I'm doing right now......... upto training part i have done bt how to do the testing part i dont know...... will you help me?
and accuracy that you have calculated how it is done?

NICY JOS

Sir, will you be able to send me the details of test and train datasets

Sudhansu Nayak

sir how to do the 3rd step and where can i get the images

Shimul Hasan

install matlab 2015a .
then this problem will be run smoothly.

Mythilie S

please help me sir....

sir while running i am getting this error

Undefined function 'log' for input arguments of type 'uint8'.

Error in entropy (line 47)
e(:,j)=sum(-x2.*log(x2));

please help

Priya Enuganti

Priya Enuganti

On clicking classification results I got an error "Error while evaluating UI control call back" please help me to get the further results

Gilbert Waweru

Thanks for uploading this code.
How was the Training_Data.mat file created?

Ashwini Kumar

Sir could you please let me know about the MATLAB dataset created for training and testing. Also please share the username and password for the database connection.
Email address : ashwinishaktivelkumar@gmail.com

Nivedita Birajadar

Where do I get DISEASESET.mat file

nafiza begum

@manu sir,please help me sir......................................................

nafiza begum

@manu sir,can i use other image enhancement technique is used ?if possible ,how can i do.please help me sir......

tan aik hong

hi sir, I would like to as, to train the training_dataset, am I required to do it manually or there is some code that can train the dataset, if yes can show it to me. thanks

Sakthimurugan Ravi

Error using svmtrain (line 230)
svmtrain has been removed. Use fitcsvm instead.

Error in multisvm (line 28)
svmStruct = svmtrain(T,newClass);

Error in DetectDisease_GUI>pushbutton6_Callback (line 381)
result = multisvm(Train_Feat,Train_Label,test);

Error in gui_mainfcn (line 95)
feval(varargin{:});

Error in DetectDisease_GUI (line 46)
gui_mainfcn(gui_State, varargin{:});

Error in
matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)DetectDisease_GUI('pushbutton6_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating UIControl Callback.

the program show above error how to solve this.

Noble kibru

Hello sir, I am working on a similar project and I am a newbie, I want to know how can I use the function "EvaluateFeatures" to get the train value of a different data set? I mean, I want to create a different "training_data" and "accuracy_data". How can I get it.XXXXXXXXX___________________XXXXXXXX, plz send the source code by this e-mail:- kgnoble2008@gmail.com
thanks

nafiza begum

Dear Sir,Code is runing but show warning. How can i remove this warning? my e-mail address is (nafiza.begum@yahoo.com).Sir,please sent me correction code via e-mail) as soon as possible.

Warning: svmtrain will be removed in a future release. Use fitcsvm instead.
> In svmtrain (line 230)
In DetectDisease_GUI>pushbutton5_Callback (line 330)
In gui_mainfcn (line 95)
In DetectDisease_GUI (line 46)
In matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)DetectDisease_GUI('pushbutton5_Callback',hObject,eventdata,guidata(hObject))
Warning: svmclassify will be removed in a future release. Use the predict method of an object returned by fitcsvm instead.
> In svmclassify (line 47)
In DetectDisease_GUI>pushbutton5_Callback (line 331)
In gui_mainfcn (line 95)
In DetectDisease_GUI (line 46)
In matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)DetectDisease_GUI('pushbutton5_Callback',hObject,eventdata,guidata(hObject))

ans =

'Accuracy of Linear Kernel is: 77.4194%'

Riddhi Raj

sir,
after changing the path and running the gui.
i do not get any result following step 4. ie Next click on Segment Image, then enter the cluster no containing the ROI, i.e only the disease affected part or the healthy part
i do not any output.
please help asap

surya chaithanya

SANJU ANAND

Undefined function 'pushbutton19_Callback' for input arguments of type 'struct'.

Error in train3>train3_OutputFcn (line 226)
pushbutton19_Callback(hObject, eventdata, handles)

Error in gui_mainfcn (line 265)
feval(gui_State.gui_OutputFcn, gui_hFigure, [], gui_Handles);

Error in train3 (line 42)
gui_mainfcn(gui_State, varargin{:});

why this error comes in training set preperation ? i am not able to add more images for training set then error comes

amruta naik

Sir please can you send me training_data.mat and accuracy_data.mat on my mail id 'amrutadodmani90@gmail.com '. I don't no how to create it sir. Please sir

amruta naik

vivek yadav

good afternoon sir can i know from where you have taken the data set does you have verified from the authorized person that the image is affected by diseases can i get your report or ieee paper pleases mail on my email id vivekyadav199315@gmail.com

SANJU ANAND

how to build the Training_Data.mat ..pls explain the steps...

Rizwan Shaukat

Hi Sir!
i am also working on same project plant disease detection web based system. sir i want help i need source code of your project can you send me on my email (rizwanshaukat936@gmail.com)?? please. i dont know how i do my work.

Prasanna Kumar

how to build the Training_Data.mat ..pls expalin the steps.....in urgent pls sir

safa ashraf

safa ashraf

how to add more disease to it

Prasanna Kumar

how to build the Training_Data.mat ..pls expalin the steps.....in urgent pls my email id

Vinayak Potadar

sir, i am getting an error like undefined function / method 'rms' for input of type 'uint8'
RMS = mean2(rms(seg_img);

SANJU ANAND

how to build the Training_Data.mat ..pls expalin the steps.....in urgent pls my email id sanjusanand2012@gmail.com

SantosG

saurabh kathar

can you plz help me in running this project ?

Sahil Makandar

hello sir,
i understood all your code. butsir i have only one dout.
i know training set is greater than test set. but sir in training set, where from you get the rest of value ? in given set there are less than 25 images.
sir please clear my doubt. if external ask me this question then what answer i will give him?
sir please please please kindly reply me.....please give response as possible as.
thank you

Mohini Sude

can u send me more details about this topic.so learn more about this.my email id is mhreddy74@gmail.com
please give response as possible as.
thank you

Divya Abhilash

Hello sir , I am very new in MATLAB. can u help me to do plant diseases based on wether prediction. Where can i get data for this project? and how to do this ? pls help me. my email id :sincy.ker@gmail.com

Sahil Makandar

Hello sir,

i am working on same project... i need your help. I have dataset of leaf diseases, how can I use this code for classification of l 9 classes, sir please tell me step by step approach…

Sahil Makandar

Oshinowo Abayomi

Hello I'm a beginner in MATLAB...I need a code that can help detect nitrogen deficiency in crop leaves

viswanathan S

jeet vyas

my email id is: vyasjeet13@gmail.com

Pooja Hiremath

hello sir please reply to my mail
i wanted to know how do u tell that this method is better than the other methods?
do u have any comparitive studies??

kavitha c

kavitha c

Hello sir, how to create a disease data set.could you send me the sample data set copy to my mail, kavithachinnamani97@gmail.com

ranga swamy h

now i am start learning on matlab

Gangadhar Narayan

K MEGHANA

Muhammad Abdullah

How to build own basebase file .mat
plz help me..... my contact id mabdllahch555@gmail.com

Angela Muñoz

Does anyone know how to align in the centroid of one image another one?

Ivan Pessane

Hello! Can you please send me the report? elpessane@gmail.com

Chen Xiao

Thanks, program is good. Please add training function.

How to drow confusion matrix in SVM??

Liona Soleman

Liona Soleman

Hello sir, thank you very much for the SVM Code, this code very helpful to me in studying classification image using multi svm. I am working on a similar project and I am a newbie, that I want to ask, does this multi svm work on more than 5 classes data? I tried on 60 class data, but why only 1 classification detected? Anyone who can help, thank you in advance

revitha rose

sir can u please mail the report for the source code of image processing based method to assess fish quality and freshness(revitharose84@gmail.com)

Gebra maryam Alehegn

Dear Manu B.N!
I am doing the thesis plant diseases recognation and classification using Multi Class SVM and can we calculate confusion matrix for Multi Class SVM ? I have 5 class data
pleases send full code by meail
enquhonea@gmail.com
thank you more

GuiTissot

Hello Manu, can you please mail the report for this souce code. (tissotgui@outlook.com).

Deepika Reddy

Sir can u please mail the report for this source code...
deepikareddy9895@gmail.com

Pias Chowdhury

Sir can u please mail me the complete paper(pias0418@gmail.com)

Pias Chowdhury

Pooja DJ

Sir can u plz mail me the report and the complete paper( poojadurgoji7@gmail.com )

Gebra maryam Alehegn

Dear sr I have already 5 class of leaf diseases and I prepare my data set ! how to use this preapre data set?

Cristian Ionut Avram

krn99

@Manu, while i run your program Train_Feat,Train_Label automatically gets loaded, but when i run program with my Training data.mat, m getting error "Undefined function or variable 'Train_Feat', Train_Label"

krn99

% Put the test features into variable 'test'
test = feat_disease;
result = multisvm(Train_Feat,Train_Label,test);

what is Train_Feat and Train_Label in above line, anyone tell me.
m getting error "Undefined function or variable 'Train_Feat', Train_Label"
m getting error "

asmaa alharbie

Thank you @Ganesh Raut ur code work fine I try it . I wonder if u could help me with the accuracy_data please since I want to build it as well and thank you

Swarnav Mukhopadhyay

Hello sir @Ganesh Raut. First of all thanks for your code. But it is showing a error,"Undefined function or variable 'hObject'.". Is there anything I should put into hObject?
Thanks

Ganesh Raut

Hello sir, I am working on a similar project and I am a newbie, I want to know how can I use the function "EvaluateFeatures" to get the train value of a different data set? I mean, I want to create a different "training_data" and "accuracy_data". How can I get it?
Thank you.

try
load('Training_Data','Train_Feat','Train_Label');
catch ex
Train_Feat = [];
Train_Label = [];
save('Training_Data','Train_Feat','Train_Label');
load('Training_Data','Train_Feat','Train_Label');
end

handles.output = hObject;
ss = ones(300,400);
axes(handles.axes1);
imshow(ss);
axes(handles.axes2);
imshow(ss);
axes(handles.axes3);
imshow(ss);
axes(handles.axes4);
imshow(ss);
[filename, pathname] = uigetfile({'*.*';'*.bmp';'*.jpg';'*.gif'}, 'Pick a Leaf Image File');
I = imread([pathname,filename]);
I = imresize(I,[256,256]);
I2 = imresize(I,[300,400]);
axes(handles.axes1);
imshow(I2);title('Input Image');
I3=I;
I4 = imadjust(I3,stretchlim(I));
I5 = imresize(I4,[300,400]);
axes(handles.axes2);
imshow(I5);title(' Contrast Enhanced ');
I =I4;

cform = makecform('srgb2lab');
% Apply the colorform
lab_he = applycform(I,cform);

% Classify the colors in a*b* colorspace using K means clustering.
% Since the image has 3 colors create 3 clusters.
% Measure the distance using Euclidean Distance Metric.
ab = double(lab_he(:,:,2:3));
nrows = size(ab,1);
ncols = size(ab,2);
ab = reshape(ab,nrows*ncols,2);
nColors = 3;
[cluster_idx cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean', ...
'Replicates',3);
%[cluster_idx cluster_center] = kmeans(ab,nColors,'distance','sqEuclidean','Replicates',3);
% Label every pixel in tha image using results from K means
pixel_labels = reshape(cluster_idx,nrows,ncols);
%figure,imshow(pixel_labels,[]), title('Image Labeled by Cluster Index');

% Create a blank cell array to store the results of clustering
segmented_images = cell(1,3);
% Create RGB label using pixel_labels
rgb_label = repmat(pixel_labels,[1,1,3]);

for k = 1:nColors
colors = I;
colors(rgb_label ~= k) = 0;
segmented_images{k} = colors;
end

figure,subplot(2,3,2);imshow(I);title('Original Image'); subplot(2,3,4);imshow(segmented_images{1});title('Cluster 1'); subplot(2,3,5);imshow(segmented_images{2});title('Cluster 2');
subplot(2,3,6);imshow(segmented_images{3});title('Cluster 3');
set(gcf, 'Position', get(0,'Screensize'));
set(gcf, 'name','Segmented by K Means', 'numbertitle','off')
% Feature Extraction
pause(2)
x = inputdlg('Enter the cluster no. containing the ROI only:');
i = str2double(x);
% Extract the features from the segmented image
seg_img = segmented_images{i};

% Convert to grayscale if image is RGB
if ndims(seg_img) == 3
img = rgb2gray(seg_img);
end
%figure, imshow(img); title('Gray Scale Image');

% Evaluate the disease affected area
black = im2bw(seg_img,graythresh(seg_img));
%figure, imshow(black);title('Black & White Image');
m = size(seg_img,1);
n = size(seg_img,2);

zero_image = zeros(m,n);
%G = imoverlay(zero_image,seg_img,[1 0 0]);

cc = bwconncomp(seg_img,6);
diseasedata = regionprops(cc,'basic');
A1 = diseasedata.Area;
sprintf('Area of the disease affected region is : %g%',A1);

I_black = im2bw(I,graythresh(I));
kk = bwconncomp(I,6);
leafdata = regionprops(kk,'basic');
A2 = leafdata.Area;
sprintf(' Total leaf area is : %g%',A2);

%Affected_Area = 1-(A1/A2);
Affected_Area = (A1/A2);
if Affected_Area < 0.1
Affected_Area = Affected_Area+0.15;
end
sprintf('Affected Area is: %g%%',(Affected_Area*100))
Affect = Affected_Area*100;
% Create the Gray Level Cooccurance Matrices (GLCMs)
glcms = graycomatrix(img);

% Derive Statistics from GLCM
stats = graycoprops(glcms,'Contrast Correlation Energy Homogeneity');
Contrast = stats.Contrast;
Correlation = stats.Correlation;
Energy = stats.Energy;
Homogeneity = stats.Homogeneity;
Mean = mean2(seg_img);
Standard_Deviation = std2(seg_img);
Entropy = entropy(seg_img);
RMS = mean2(rms(seg_img));
%Skewness = skewness(img)
Variance = mean2(var(double(seg_img)));
a = sum(double(seg_img(:)));
Smoothness = 1-(1/(1+a));
Kurtosis = kurtosis(double(seg_img(:)));
Skewness = skewness(double(seg_img(:)));
% Inverse Difference Movement
m = size(seg_img,1);
n = size(seg_img,2);
in_diff = 0;
for i = 1:m
for j = 1:n
temp = seg_img(i,j)./(1+(i-j).^2);
in_diff = in_diff+temp;
end
end
IDM = double(in_diff);

feat_disease = [Contrast,Correlation,Energy,Homogeneity, Mean, Standard_Deviation, Entropy, RMS, Variance, Smoothness, Kurtosis, Skewness, IDM];
I7 = imresize(seg_img,[300,400]);
axes(handles.axes3);
imshow(I7);title('Segmented ROI');
Label = menu('Select a disesses','1','2','3','4','5','6','7');
db_count = length(Train_Feat) + 1;
db_count = length(Train_Label) + 1;
% Train_Feat(:,db_count1) = feat_disease;
Train_Label(:,db_count) = Label;
save('Training_Data','Train_Feat','Train_Label');
ch = menu(sprintf('Database saved',db_count),'Add More','Clear DB','Exit');
if(ch == 1)
pushbutton19_Callback(hObject, eventdata, handles)
elseif(ch == 2)
ch = menu('Are you sure','Yes','No');
if(ch == 1)
Train_Feat = [];
Train_Label = [];
save('Training_Data','Train_Feat','Train_Label');
end
end

Swarnav Mukhopadhyay

Hello sir, I am working on a similar project and I am a newbie, I want to know how can I use the function "EvaluateFeatures" to get the train value of a different data set? I mean, I want to create a different "training_data" and "accuracy_data". How can I get it?
Thank you.

Gebra maryam Alehegn

it is nice ,but I have 5 class for mazie leaf diseases recognation and classification using multi SVM how to use this code pleases inform teh step??

Manu BN

@ ketan: use Matlab 2013. Some GUI functions might have changed in the later version.
Remember, this project was done 3 years ago.
@ Alehegn: Go thro all the comments below

ketan dhumal

ketan dhumal

while running this projrct i'm facing error,

function varargout = DetectDisease_GUI(varargin)

Error: Function definitions are not permitted in this context.

help me please
Thank you.

Sir,I have 4 plant leaf diseases classes ,so how divide train and test the data? And how to extract and save the traning features ant test features?

Manu BN

@ Nimrutha: Training set is usualy bigger than test set.
@ Dipali: rms was the function of Matlab 2013. Check the ones for you version. It looks like u dont hv all the necessary toolboxes
@ Abu: go thro all the comments below
Thanks to all for the ratings

Nimrutha T L

Sir, In the image data set, you have around 80 images only. But in the .mat file, there are 125 tuples of features. From which images did you extract the features? And can you please provide me the process of how did you actually extract the features from the images and created the .mat file? Because the values are contradictory when I extracted the features from those images! Please help me with this!

Dipali Sirwaiya

it is giving error on gui file undefined function rms

Prajwala TM

Sir, could you elaborate a little on the H values required for the automatic thresholding after converting the segmented images to HSV color space ? I'm not able to find the required range of H values for the same.

sri sathish

Friends plz send me the MATLAB code for agricultural plant leaf disease detection.

HariPriya Manivannan

dinesh thangavel

guys i need matlab code for leaf disease detection.......can anyone send it as soon as possible .........

Training_Data.mat is consist of which kind of information ?

asmaa alharbie

Hi
amazing project sir what algorithm's did you use to extract the features? and in the segmentation also?
and thank you so much for ur effort

taissir fekih

Hello sir,
Thank you very much for the SVM Code... I'm a student and I have a project about an svm classifier to classify ecg signals but my problem I'm beginner just if you can just how to begin to do the svm how can I do mat files (data set) the diseases are the class and the features of the signals are the input(attributes). I have samples of signals but I don't know how to extract feature from signals and put in mat file or I must write them manually?? means what are the steps to do the svm or how can I modify you code to adapt
who can help me please
it to my project :(

asmaa alharbie

oo000

Hamidan Wijasena

Hello sir, your work is amazing, and i am working on a similar project. can i get the whole paper plus the report and the whole source code please.
this is my email
hamidanzw@gmail.com

Manu BN

K means is unsupervised, so have to select the cluster no. Hence it is semi automated.
If u want fully automated, set thresholds in YCbCr or HSV space

Raheel Rehman

Can I automate the K mean process? Because i want to run like this:
Res = Detect(IMG)
Res = disease name

I want it to select the affected cluster by it self.

Raheel Rehman

and how can i extract new features and label of new disease ?? Can you please explain a little?

Manu BN

for the existing .mat file (i.e features & labels) do a vertical concatenation with new features and labels of the new diseases , and save all of it in a new .mat file.
I dont have any database than the existing ones

Raheel Rehman

Thanks! And how do i increase number of diseases ? and data set?

Manu BN

Remove all the GUI functions, keep only the code that does actual work.
Then write a function which takes only the path of the image and put rest of the code in the function.The final results of classification is the output of the function. It should look like this:
[disease_type] = detect("Image Path");

Raheel Rehman

How can I increase number of disease ?
and I want to change this code like, it take a image as an input in function e.g.
Detect ("image's path")
and give name of the disease.. how can I do that?

eddy jain

Great Work.

aishwarya murali

Hello sir, I am working on a similar project. Can you send me the code and paper?
My mail id is rosieice77@gmail.com

Manu BN

@ danait: same procedure & same concept

danait alemu

hello thanks for your code would you help me how to do it for detection of skin diseases

Manu BN

@
Emmanuel: Concatenate the IC & ICICM feature vectors and follow the same procedure

Emmanuel Nwamaife

@Manu, I appreciate your work. I was wondering if you could help out with an code implementation of the Integrated Color and Intensity Co-occurrence Matrix (ICICM) for feature extraction...Kindly respond

Hadeer tawfik

Thank you so much for your great work, Your project helped me a lot. I just want to ask about the accuracy part to make sure i understand it correctly , Is All i have to do is to pick group of images from the original dataset that i will classify into only two classes :healthy vs diseased , then i apply the same feature extraction methods we have done earlier? then I assign labels that are zeros or ones for this new group of features? is that correct?

hello sir, my final project is similar to your project, would you please send the source code to my email?
thank you so much

Zaid Kraitem

Thx

Manu BN

If you want more no of diseases to add extract features from all of them add a label and do vertical concatenation with the existing feature set and finally save it into a .mat file using save command

Rahul Phadatare

and how i can extract feature all those 13 feature and save in excel

Rahul Phadatare

Rahul Phadatare

sir please help mi my project is similar to your project please inform mi how i can increase number of disease in this project
and how i create mat file for this

Manu BN

@nige: I also dont have the paper
@bakhta: A pop up dialogue box will appear in which you need to enter the value of the cluster i.e 1,2,3 etc

nige

hello, sir, I just read your project. How cool! But so sorry, I cannot find your paper on the IEEE Xplore. So I wonder if you could send the article to me. Here is my email:463071540@qq.com. Thanks a lot!

rebih bakhta

hello, thank you for this code
i have a question, how can i show just the cluster containing the desease?

Manu BN

@ Tejas: The paper I lost it. Plz download from Xplore
@ Suyog: create a database of Pomo leaves and use same method of features extraction

Tejas T

Hello sir,Thanks a ton for this.can you please send me the source code and the paper?
Email me at [tjstlekr@gmail.com]
Thanks in advance :)

suyog b

What modify we can do with this code to work with Pomegranate fruit disease detection.

selim hossain

sir,
you told that mat file contains the features set and the labels of training data. my question is that in Training_Data...Train_Feat(1,1)indicate what types of features like mean,rms,standard division etc and Train_Label(0) indicate what type of plant leaf like Alternaria Alternata,Anthracnose,Bacterial Blight,etc ..please some one give me answer

Manu BN

Go thro all the comments below, you will find the answer

sravan yakkala

Hi sir , you have done a great job,can you tell about the Training_data and Accuracy_data
& where did you get these datasets

Manu BN

The method of feature extraction is same as the one mentioned here. After having extracted the features assign label i.e 1 ,2 etc for different types. Store them using a save command. Next while in testing phase once again use the same method of feature extraction. Then apply SVM Train and SVM classify commands and visualize the results.
Thanks for the rating.
If you have any more doubts you can always ask.

selim hossain

please someone give me suggestion that how can i train my new plant leaf diseases. there have any matlab code that i can use for this program and i can run this program for my new diseases leaf.

selim hossain

sir,i am from bangladesh and my project is related to your project.
you have done a great job ,would you like to give me the paper plus the report and the whole source code please.
and another problem i was run this code but some part of the code not working.
please sir help me.
my email:selim.iub@gmail.com

Archana Kale

Nice project

Muhammad Umraiz

Hi sir , you have done a great job , can i get the whole paper plus the report and the whole source code please.
this is my email
muhammadumraizravian@yahoo.com

sravan yakkala

Manu BN

Thanks for the rating, the papaer you have to download from IEEE xplore. I somehow lost it.

Raheel Rehman

Raheel Rehman

Raheel Rehman

Hello sir, that is exactly what i am looking for. Your project is awesome, can you please send me the source code and where can I find the paper?
Email me at [raheel73@hotmail.com]
Thanks in advance :)

Raheel Rehman

Hello sir, that is exactly what i am looking for. Your project is awesome, can you please send me the source code and where can I find the paper?
Email me at [raheel73@hotmail.com]
Thanks in advance :)

Prathusha Reddy

good project

Manu BN

use one vs all approach. i.e class 1 contains healthy features and class 2 contains the fused features of all the diseases mentioned.
Thanks for the rating.

sibtain abbas

Hello, Can you tell me how are you calculating the accuracy?

Moh Moh

It is good project. Thanks to author.

Manu BN

Thanks,i have lost the paper somehow, plz download it from IEEE Xplore.

Ahmed Khames

Hi sir , your work is amazing , can i get the whole paper plus the report and the whole source code please.
this is my email
ahmed.khames70@gmail.com

srunitha gunjan

Kiritsugu Emiya

Hello, my thesis is required to get a software that can detect a plant disease. Can i get the whole paper and whole source code ? Please email me kiritsugu22@gmail.com Thank you Sir :)

Manu BN

Sure, give me your e mail id

Seth Lfc

Hello Sir can i get the whole paper plus the report and the whole source code please.

peijin wang

sir can you please mail me the paper @ [285327748@qq.com] thanku sir

priya y

Sir thankyou for your reply.
I have used regionprops method to calculate major and minor axis lengths.But i am getting wrong values using that method when compared distance value using imtool method.So sir please provide solution for this problem.
Thank you in advance.
I have attached image to your mail-id.

Manu BN

@ Tejaswi: Use feed forward NN, use the same feature set but re arrange the rows and columns as necessary. Usually one hidden layer with 10 neurons is sufficent, if not increase the hidden layers to 2. Plenty of tutorials are available on net.
@ Dolly: Set the num of iterations to 1000 thats it. Go thro Matlab documentations in detail.
@Luu: Learn the basics of machine learning, you will understand what is train feat and test feat.
@Pinto: Why convert to grayscale when k means can directly operate on any dimension data???
@ Priya: Yes u can. All you hv to do is a bit of search on net to get the code.

K Tejaswi

sir,
My project is also similar to your project but I want to use neural network for training and after doing the training I want to do the testing on the trained network.Can you help me how to save the features extracted in the network and test on those features.

dolly karak

sir can you please tell me how we take 1000 iteration for k-mean using matlab command.

dolly karak

sir can you please mail me the paper @ [dolly.karak@gmail.com]
thanku sir

Luu Thanh

dear Sir, Could you please expland about evaluate Accuracy. I don't understand about Train_Feat and Train_Label. Why Train_Label only include value "0" or "1" ? And Train_Feat is featureVector from TestSet ?
Thank sir !

Loyce Pinto

Sir, for the rgb to gray scale conversion for this particular problem is luminous method better or the averaging or the inbuilt function to get more accurate values?

Luu Thanh

@Priya, as Pawan comment, plz using imBinary instead of B. BR !

Pawan kumar Dv

it is "imBinary" instead of 'B' as reffered in tat code.!!

priya y

I am getting this error,
Undefined function or variable 'B'.

test = regionprops('table',B,{'Area','Centroid','BoundingBox',
'ConvexArea', 'ConvexHull', 'ConvexImage', 'Eccentricity',
'EquivDiameter', 'EulerNumber', 'Extent', 'Extrema'
,'FilledArea','FilledImag ..});
Please help me to come out of this error.

Pawan kumar Dv

sir! is there any other methods for dynamically select the ROI ie., defected cluster among 3 clusters??????!! during k-means clustering.

priya y

ty @Luu Thanh

Luu Thanh

hello @Priya Y, After research, I found that We can use regionprops to find some feature as your comment. Plz check bellow code :

imBinary = im2bw(imgSeg);
test = regionprops('table',B,{'Area','Centroid','BoundingBox', 'ConvexArea', 'ConvexHull', 'ConvexImage', 'Eccentricity', 'EquivDiameter', 'EulerNumber', 'Extent', 'Extrema' ,'FilledArea','FilledImage' ,'Image', 'MajorAxisLength','MinorAxisLength','Orientation','Perimeter','PixelIdxList','PixelList','Solidity','SubarrayIdx'});

A = test.Area;
E = test.Eccentricity;

BestRegard !

Luu Thanh

Sir, I have a same question with Priya Y, Can I find some Shape feature by regionprops ? thank sir !

priya y

Sir,can i find out eccentricity,solidity,perimeter,bounding box features using regionprops?

Manu BN

Sure, try with any type of NN, or even with KNN or many other classifiers available. Compare accuracies of each.

Pawan kumar Dv

@ Manu BN,how about using neural network approach?????for classification.

Manu BN

Yes it is likely to happen. Since the query image class is not defined in the training set the svm classifier tries to find the nearest possible match and assigns the label of the most likely class. You see a real time implementation of such a prj should only be done in a specific region for a specific crop for a specific set of diseases dominant in that region for that crop.
Guess you got the point!!!

Pawan kumar Dv

hii @ Manu BN
i am doing my final year project similar to yours classification,.but i am getting wrong results ie,.if i give input image not comming under my 4 classification then it is giving any one classification which is wrong.please sir can u help me in this????

Manu BN

This is a semi automatic approach I have already said. Go thro the comments below.

Luu Thanh

Thank Sir, Step choose right cluster after K-mean is not good for auto classification. User have to choose. There are any solution for this case ?

Manu BN

Yes, Training_data = [F1;F2;....;Fn];
Label = 1 to n. Where n is the number of classes. Save 'Filename'

Luu Thanh

thank sir, so I have to extract features of each image in TrainingSet and write to '.mat' files ?

Manu BN

Use save command in Matlab. There are plenty of resources in net regarding creation of training set.

Luu Thanh

Dear Sir, I have a question. How to make "mat" files (Training_Data and Accuracy_Data) ? There are any code to make them ? or we have to fill directly ? Thanks !

Manu BN

Go thro all the comments below, you will find the answer.

Loyce Pinto

Sir,
can you tell me the right method using which we can select a proper feature set as I searched online but haven't found a proper answer! can you tell me how you selected these 13 features??

Manu BN

Search in the net, it is there in many sites.

priya y

Sir, Can u please provide d code for ostu thresholding method?

Manu BN

Try with Otsu and manual thresholding. But the results wont be as good as k means. Yes, this is a semi automatic approach.

Loyce Pinto

Sir,
Is there anyway to automate the segmentation process? as K means does require human interaction.
Thank You

priya y

Sir,my guide is telling to not to apply k-means clustering for image segmentation because it involves human intervention in choosing the cluster no.,so he asked me to do extract only the diseases part using other techniques.
Please help me with this sir.Provide solutions for this problem sir please.Please tell me which other methods can be used.

priya y

Thank you sir for your suggestion.
sir which is better to use "switch" or "if else-if"?

Manu BN

Training set is always bigger than the test set. Go through the basics of SVM for in depth understanding.

priya y

Thank you sir for your reply.
Sir,in your dataset there are only 15 images for healthy leaves,but in train_feat and train_label .mat file there are 25 values for healthy leaves. How is this possible as we have to take only 1 value for 1 image in .mat file?
Please give me idea regarding this.

Ravi holkar

Manu BN

Extract features only from disease affected part

priya y

Ya sir i have followed d same procedure as u said and i have trained d multisvm classifier with code as u have given,but then too it is showing wrong class.Sir can we use this code for 60 classes?
Sir in .mat file do i have to collect only the diseased part cluster features or all the cluster features?Please provide solution for this.

Manu BN

Train the classifier with the no. of classes and assign a label. Save it using save 'filename' command.

priya y

Yes sir, the code is working properly for dataset which u have attached here.But i am working on other datasets consisting of 60 classes.what changes i have to do to get the correct output.

Manu BN

Read the description properly. It works only on the classes mentioned here.
The code is working perfectly.

priya y

Sir, i am not getting correct output.It is showing the same class for other class of disease also.Please provide a solution for this.

priya y

Can we use this code to classify 60 classes?

priya y

Thank you sir for your reply.Sir do we have to collect features of only diseased part segment or features of all the segments created using k-means clustering.

Manu BN

Once you convert an RGB image into grayscale, the color information will be completely lost. There are algorithms which try to restore the color but you will never get back the original image.
Smootheness is a texture based feature. Go thro GLCM features(Gray Level CoOccurance Matrices) for detailed explanation.

priya y

Sir,i have to prepare d report for this project,i am not getting what content to write for features "smooothness(with standard formula)" and "RMS(with standard formula)".Can u give me this information?

priya y

Thank you sir for reply.If not the direct way then what is the other way to convert gray image back to rgb.

Manu BN

@ Priya: No direct way to convert gray to RGB
@John: Texture based ones also are implemented. Learn about GLCMs(Gray Level Co Occurance Matrices)
For human disease go thro as many papers as possible to build a feature set that gives more than 90% accuracy.Do plenty of trial n error until you get the results.

John Daber

Thanks for your reply. I understand how you collected the statistical feature vectors, but not the texture based ones. Is it implemented in this project?
Well, I'm attempting this on human diseases so I realize the same approach may not work. Still, this has helped a lot.

priya y

Sir,i have collected images of diseased leaves using camera.Then I hv used wiener2() to remove noise from the images.For the sake of using wiener i need to convert images from rgb2gray. But now i am not getting how to convert back images from gray to RGB.I have tried with this code,but getting error
function [Image]=gray2rgb(Image)
%Gives a grayscale image an extra dimension
%in order to use color within it
[m n]=size(Image);
rgb=zeros(m,n,3);
rgb(:,:,1)=Image;
rgb(:,:,2)=rgb(:,:,1);
rgb(:,:,3)=rgb(:,:,1);
Image=rgb/255;
end
Sir,give solutions for this problem.

Manu BN

@ dolly: Spend some time learning the basics of machine learning. you will get it then.

dolly karak

what is the difference between testing and training data matrix.

Manu BN

@ John: Statistical+Texture are the most popular features for palnt disease and brain tumor.
Go thro various papers on plant diseases and build a feature set that give an accuracy of 90% or above. Do pleant of trial and error. Use DWT2 features also.
The method in link dosn't consider feature extraction but rather considers the whole image as a feature set and assigns label to it.A 100% accuracy in the first run itself is strange (Even I fell for it during my student days!!)

Manu BN

@priya:deconvwnr is the inbuilt command for weiner filtering. Why do you want to deblur the images in the first place when there is no noise in it???

John Daber

Appreciate your efforts. Can I ask why/how you selected these feature vectors? [Contrast,Correlation,Energy...etc]. I'm trying a similar project but with a different data set and these feature vectors are very unreliable for me. I have trained my classifier with around 20 training images and my accuracy is at around 40%. On the other hand, I followed a different approach seen here: http://dipwm.blogspot.com/ which gives me an accuracy of 100%. From what I understand, this tutorial uses the entire image in 'double' in the SVM classifier. As a beginner I'm not sure if that is a correct approach (even though it gives me 100% accuracy) and I'd appreciate your thoughts on that.

priya y

can u tell me how to remove noise in images using wiener filter(matlab code).

dolly karak

sir, as you said 0-4 are the labels assigned to the corresponding 5 classes considered but why did you take only 0 and 1 as lebel in train_level matrix.

Manu BN

arrange features in rows and give labels to each class and finally save it using 'save' command.

priyanka gadade

How the labels are assign to the features

Manu BN

0-4 are the labels assigned to the corresponding 5 classes considered

dolly karak

last question sir, in the matrix 125*1 named Train_level why you take only 0 and 1 as an element of matrix.

Manu BN

It was directly written in .mat file.

To write to .xls use the code below:
data=load('FileName');
f=fieldnames(data);
for k=1:size(f,1)
xlswrite('FileName.xlsx',data.(f{k}),f{k})
end

dolly karak

1 more question sir, did you also take training images in excel sheet. actually i don't know how to make database for training. so sir can you please help me to come out from this.
thanku sir.

dolly karak

Thanku sir, Do you first wrote feature set and labels of training data in excel sheet and then convert it in .mat file. can you please send me excel sheet as its shortcut is inside the zip file.

Manu BN

@dolly: .mat file contains the features set and the labels of training data. The accuracy is evaluated for heavthy vs all diseases.

dolly karak

sir can you please tell me why you take .mat file and what is inside the .mat file and can you send me the excel sheet of training_data and accuracy_data on my mail id "dolly.karak@gmail.com".
thanku sir....

split range

Manu BN

@ John: The features set is feat_disease = [Contrast,Correlation,Energy,Homogeneity, Mean, Standard_Deviation, Entropy, RMS, Variance, Smoothness, Kurtosis, Skewness, IDM]; A mixture of statistical and texture based features are used.
I have used the images from net to train them. The real time classification should be done for a specific region and for a specific set of diseases dominant in that particular region.
Plz go thro the basic version of this code (Link:https://in.mathworks.com/matlabcentral/fileexchange/50624-plant-disease-classification).
Thanks for the rating.

John Daber

Appreciate your work! Can I know a little more about the training dataset? For example how many images were used for that? (In the hundreds or thousands?) And what feature vectors were selected for it? I'm still new to this field and this has helped me a lot. Thanks.

Manu BN

Other than those images provided I dont have anymore.

priya y

Thank you sir for the paper.Sir can u please send some images of leaf infected taken in digital camera.

Manu BN

@ AK: use winzip or winrar to extract and follow the instructions to run

A K

i downloaded code..but not able extract files...

priya y

Thankyou sir for your answer.
priyankay46@ymail.com

Ghobad Palvaneh

Manu BN

Evaluate each feature from the segmented image and put them in an array. Features = [feature1,2......13];

Give me your e mail id will mail the paper.

Thanks for the rating.

priya y

Sir,can u please attach the paper referred(mentioned above)?I tried downloading but its not accessible.
Thank you

priya y

Sir,how do we have to find out the feature values?

priya y

Thank you very much sir.

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

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

Start Hunting!