Matlab 基于gist和SVM训练的图像分类
首先,我想说,我对简历真的很陌生,可能有一些明显的事情我没有想到,所以请不要犹豫,提及这类事情 我正在尝试实现场景分类,为了简单起见,目前在室内和室外图像之间 我的想法是使用一个gist描述符,它创建一个带有场景特定参数的向量 为了获得可靠的分类,我使用了室内和室外图像,每个图像100个样本,使用了gist描述符,用它们创建了一个训练矩阵,并在上面使用了“svmtrain”。下面是一个非常简单的代码,显示了我是如何训练gist向量的:Matlab 基于gist和SVM训练的图像分类,matlab,classification,svm,scene,gist,Matlab,Classification,Svm,Scene,Gist,首先,我想说,我对简历真的很陌生,可能有一些明显的事情我没有想到,所以请不要犹豫,提及这类事情 我正在尝试实现场景分类,为了简单起见,目前在室内和室外图像之间 我的想法是使用一个gist描述符,它创建一个带有场景特定参数的向量 为了获得可靠的分类,我使用了室内和室外图像,每个图像100个样本,使用了gist描述符,用它们创建了一个训练矩阵,并在上面使用了“svmtrain”。下面是一个非常简单的代码,显示了我是如何训练gist向量的: train_label= zeros(size(200,1)
train_label= zeros(size(200,1),1);
train_label(1:100,1) = 0; % 0 = indoor
train_label(101:200,1) = 1; % 1 = outdoor
training_mat(1:100,:) = gist_indoor1;
training_mat(101:200,:) = gist_outdoor1;
test_mat = gist_test;
SVMStruct = svmtrain(training_mat ,train_label, 'kernel_function', 'rbf', 'rbf_sigma', 0.6);
Group = svmclassify(SVMStruct, test_mat);
问题是结果非常糟糕
我读到优化“rbf”kernell的约束和gamma参数可以改进分类,但是:
% GIST Parameters:
clear param
param.imageSize = [256 256]; % set a normalized image size
param.orientationsPerScale = [8 8 8 8]; % number of orientations per scale (from HF to LF)
param.numberBlocks = 4;
param.fc_prefilt = 4;
%Obtain images from folders
sdirectory = 'C:\Documents and Settings\yotam\My Documents\Scene_Recognition\test_set\indoor&outdoor_test';
jpegfiles = dir([sdirectory '/*.jpg']);
% Pre-allocate gist:
Nfeatures = sum(param.orientationsPerScale)*param.numberBlocks^2;
gist = zeros([length(jpegfiles) Nfeatures]);
% Load first image and compute gist:
filename = [sdirectory '/' jpegfiles(1).name];
img = imresize(imread(filename),param.imageSize);
[gist(1, :), param] = LMgist(img, '', param); % first call
% Loop:
for i = 2:length(jpegfiles)
filename = [sdirectory '/' jpegfiles(i).name];
img = imresize(imread(filename),param.imageSize);
gist(i, :) = LMgist(img, '', param); % the next calls will be faster
end