svm training and classification

2 ビュー (過去 30 日間)
vidhya v
vidhya v 2020 年 3 月 19 日
コメント済み: vidhya v 2020 年 12 月 10 日
Greetings,
I have to classify the input image of my dataset. Based on the below example code (Brain MRI detection), I am doing my project. for classification i have to use fitcsvm(). As i am new to matlab, I dont know how to implement it, because i have to pass features into ClassificationSVM. svmtrain() and svmclassify() are not supporting. please suggest on how can i replace the functions to get my result
example code:
g = graycomatrix(G);
stats = graycoprops(g,'Contrast Correlation Energy Homogeneity');
Contrast = stats.Contrast;
Correlation = stats.Correlation;
Energy = stats.Energy;
Homogeneity = stats.Homogeneity;
Mean = mean2(G);
Standard_Deviation = std2(G);
Entropy = entropy(G);
RMS = mean2(rms(G));
%Skewness = skewness(img)
Variance = mean2(var(double(G)));
a = sum(double(G(:)));
Smoothness = 1-(1/(1+a));
Kurtosis = kurtosis(double(G(:)));
Skewness = skewness(double(G(:)));
% Inverse Difference Movement
m = size(G,1);
n = size(G,2);
in_diff = 0;
for i = 1:m
for j = 1:n
temp = G(i,j)./(1+(i-j).^2);
in_diff = in_diff+temp;
end
end
IDM = double(in_diff);
feat = [Contrast,Correlation,Energy,Homogeneity, Mean, Standard_Deviation, Entropy, RMS, Variance, Smoothness, Kurtosis, Skewness, IDM];
load Trainset.mat
xdata = meas;
group = label;
svmStruct1 = svmtrain(xdata,group,'KernelFunction', 'linear');
species = svmclassify(svmStruct1,feat,'showplot',false);
if strcmpi(species,'MALIGNANT')
helpdlg(' Malignant Tumor ');
disp(' Malignant Tumor ');
else
helpdlg(' Benign Tumor ');
disp(' Benign Tumor ');
end

採用された回答

Furkan DEMIR
Furkan DEMIR 2020 年 12 月 10 日
Hello.
load Trainset.mat has two file. one of these meas and label.
When I see meas files. I saw 20*13 matrix. what is the meaning. Why the file is 20*13 matrix
  1 件のコメント
vidhya v
vidhya v 2020 年 12 月 10 日
Hello,
Thank you for your reply.
I was trying to use SVM for image processing in my project. I'm completely new to this stuff and I too don't know abt this code. Actually I took this code from github as my reference. I don't get the result and I dropped the idea of using SVM and went for BPNN. Sorry, I too don't know.

サインインしてコメントする。

その他の回答 (1 件)

Mahesh Taparia
Mahesh Taparia 2020 年 3 月 23 日
Hi
You can use the function fitcsvm as follows:
SVMModel = fitcsvm(xdata,group,'KernelFunction', 'linear');
[label,score] = predict(SVMModel,feat);
label will give the labels of feat. For more information , you can visit the documentation page.
  1 件のコメント
vidhya v
vidhya v 2020 年 3 月 24 日
Thank you sir. I will try it

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by