2014-12-08 29 views
1

前幾天我在簡歷上發佈了這個question,但論壇基本上沒有發現它。我試圖在MATLAB中實現NBNN來對CIFAR-10圖像數據集進行圖像分類。算法非常簡單,我相信這是正確的,但是,我以22-28%的速度收到了很差的準確率。我不確定爲什麼,我希望有經驗的圖像分類或算法的人可以指出我正確的方向。該算法從SIFT圖像描述符中學習,這可能是其表現不佳的原因之一。 Matlab只有一個SURF特徵檢測器。從我讀過的內容來看,SURF/SIFT基本上是相同的。我一直在使用features,(nDescriptros x 64)從下面的函數獲得來訓練我的模型。在MATLAB中實現樸素貝葉斯最近鄰(NBNN)

points = detectSURFFeatures(rgb2gray(image)); 
[features,valid_points] = extractFeatures(image,points); 

CIFAR數據集和此方法的另一個可能的問題是圖像的小尺寸。每幅圖像都是32×32的圖像,我相信它會使特徵檢測變得非常困難。我已經玩過detectSURFFeatures()中的不同八度設置,但沒有任何數據將我的準確度提高到28%以上。

該方法的註釋代碼如下。這很難理解,但仍然可能有所幫助。

希望有人能幫助我。

for i = 3001:4000 %Train on the first 3000 instances and test on the remaining 1000. 
    closeness = []; 
    for j = 1:10 %loop over the 10 catergories 
     class = train(trainLabel==j,:); % Pull out all descriptors that belong to class j 
     descriptor = test(test_id==i,:); % Pull out all descriptors for image i 
     [idx,dist] = knnsearch(class,descriptor,'K',1); % Find the distance between the descriptors and the closest labeled descriptor in class j. 
     total = sum(dist); % sum up distances 
     closeness = [closeness,sum(total)]; % append a vector of the image-to-class distances. 
    end 
    [val,cat] = min(closeness); % Find choose the class that resulted in the lowest, summed distance. 
    predLabel = [predLabel;cat]; % Append to a vector of labels. 
    i 
end 
+1

您使用灰度圖像檢測SURF特徵,但從原始RGB圖像中提取特徵。這是否按預期工作?如果在灰度圖像上使用'extractFeatures',結果如何? – hbaderts 2014-12-08 09:59:39

+1

因此,檢測功能一直是我不確定的一個領域。我嘗試在32x32圖像上檢測衝浪功能,但收到了非常稀疏的輸出。只會檢測到一個或兩個功能,某些情況下未檢測到功能。玩過大小調整後,我意識到我收到的圖像越大,功能越多,所以我最終將圖像大小調整爲256x256,然後再運行特徵檢測。以下是我用來提取功能的兩行代碼。 'points = detectSURFFeatures(I);'then'[features,valid_points] = extractFeatures(I,points)'。 – 2014-12-09 00:35:14

回答

0

如果您的圖像是32x32像素,然後嘗試檢測興趣點不是一個好主意。正如你所觀察到的,如果有的話,你會得到很少的功能。上採樣圖像是一種選擇。另一種選擇是使用像HOG這樣的全局描述符(extractHOGFeatures)。

+0

迪馬,看起來你進入圖像處理 - 你能幫助我們打開這個專門的組:http://area51.stackexchange.com/proposals/66531/computer-vision/72084只需投票選舉少於10票的問題。謝謝。 – Royi 2015-03-01 17:52:54