2012-03-17 81 views
2

我正在做一個肝腫瘤分類的項目。實際上,我最初使用區域生長方法進行肝臟分割,並使用FCM分割腫瘤。然後,我用Gray Level Co-occurence Matrix得到紋理特徵。我該輸出是如何使用SVM分類器進行分類?

統計=

autoc: [1.857855266614132e+000 1.857955341199538e+000] 
contr: [5.103143332457753e-002 5.030548650257343e-002] 
corrm: [9.512661919561399e-001 9.519459060378332e-001] 
corrp: [9.512661919561385e-001 9.519459060378338e-001] 
cprom: [7.885631654779597e+001 7.905268525471267e+001] 

現在我應該怎麼給這個作爲輸入到SVM程序。

function [itr] = multisvm(T,C,tst) 
%MULTISVM(2.0) classifies the class of given training vector according to the 
% given group and gives us result that which class it belongs. 
% We have also to input the testing matrix 

%Inputs: T=Training Matrix, C=Group, tst=Testing matrix 
%Outputs: itr=Resultant class(Group,USE ROW VECTOR MATRIX) to which tst set belongs 

%----------------------------------------------------------------------% 
% IMPORTANT: DON'T USE THIS PROGRAM FOR CLASS LESS THAN 3,    % 
%   OTHERWISE USE svmtrain,svmclassify DIRECTLY or   % 
%   add an else condition also for that case in this program. % 
%   Modify required data to use Kernel Functions and Plot also% 
%----------------------------------------------------------------------% 
%      Date:11-08-2011(DD-MM-YYYY)     % 
% This function for multiclass Support Vector Machine is written by 
% ANAND MISHRA (Machine Vision Lab. CEERI, Pilani, India) 
% and this is free to use. email: [email protected] 

% Updated version 2.0 Date:14-10-2011(DD-MM-YYYY) 

u=unique(C); 
N=length(u); 
c4=[]; 
c3=[]; 
j=1; 
k=1; 
if(N>2) 
    itr=1; 
    classes=0; 
    cond=max(C)-min(C); 
    while((classes~=1)&&(itr<=length(u))&& size(C,2)>1 && cond>0) 
%This while loop is the multiclass SVM Trick 
     c1=(C==u(itr)); 
     newClass=c1; 
     svmStruct = svmtrain(T,newClass); 
     classes = svmclassify(svmStruct,tst); 

% This is the loop for Reduction of Training Set 
     for i=1:size(newClass,2) 
      if newClass(1,i)==0; 
       c3(k,:)=T(i,:); 
       k=k+1; 
      end 
     end 
     T=c3; 
     c3=[]; 
     k=1; 

% This is the loop for reduction of group 
     for i=1:size(newClass,2) 
      if newClass(1,i)==0; 
       c4(1,j)=C(1,i); 
       j=j+1; 
      end 
     end 
     C=c4; 
     c4=[]; 
     j=1; 

     cond=max(C)-min(C); % Condition for avoiding group 
          %to contain similar type of values 
          %and the reduce them to process 

% This condition can select the particular value of iteration 
% base on classes 
     if classes~=1 
      itr=itr+1; 
     end  
    end 
end 

end 

請親引導我。

圖片: tumor1 tumor2 tumor3

回答

0

你必須採取所有的特徵值,你和它們連接成一個特徵向量。然後,對於SVM,要對特徵進行歸一化處理,以便每個維度的值在-1和1之間變化,如果我沒有記錯的話。我認爲libsvm具有進行規範化的功能。因此,假設你的特徵向量具有N個維度,並且你有M個訓練實例,那麼你的訓練集應該是一個M×N矩陣。那麼如果你有P個測試實例,你的測試集應該是一個P×N矩陣。

+0

謝謝。但是如何將所有的特徵值連接成一個特徵向量? – Gomathi 2012-03-22 14:54:47

+0

@Gomathi:v = [stats.autoc,stats.contr,...]; – Dima 2012-03-22 15:04:20

+0

非常感謝。我會試試看。 – Gomathi 2012-03-22 15:05:57

0

我還可以建議你一個非常流行的SVM實現,稱爲SVMLight http://svmlight.joachims.org/

你可以在網站上找到如何使用它的例子。 Mex-matlav包裝它也是可用的。

正如Dima指出的那樣,您需要連接功能?

btw你能告訴我哪個數據集用於肝腫瘤分類嗎? 是否公開可供下載?