本文介绍了使用VLFEAT实现词袋对象识别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在matlab中实现一个BOW对象识别代码。该过程稍微复杂,我有很多麻烦找到适当的文档的程序。所以,有人可以仔细检查我的计划是否有意义?
我在这里广泛使用



训练:
1.用VLSIFT提取SIFT图像描述符
2.用k-means(vl_hikmeans)定量描述符
3.获取量化描述符并创建直方图(VL_HIKMEANSHIST)
4.从直方图创建SVM(VL_PEGASOS?)


$ b b

我理解步骤1-3,但我不太确定SVM的函数是否正确。
VL_PEGASOS需要以下内容:

  W = VL_PEGASOS(X,Y,LAMBDA)

我如何使用这个函数和我创建的直方图?



最后在识别阶段,如何将图像与SVM定义的类匹配?

解决方案

他们的,即完全实施BoW方法。



这里是他们用pegasos分类并评估结果的部分:

  -------------------------------------------------- ------------------ 
%火车SVM
%-------------------- ------------------------------------------------

lambda = 1 /(conf.svm.C * length(selTrain));
w = [];
for ci = 1:length(classes)
perm = randperm(length(selTrain));
fprintf('%s\\\
类的训练模型,类{ci});
y = 2 *(imageClass(s​​elTrain)== ci) - 1;
data = vl_maketrainingset(psix(:,selTrain(perm)),int8(y(perm)));
[w(:,ci)b(ci)] = vl_svmpegasos(data,lambda,...
'MaxIterations',50 / lambda,...
'BiasMultiplier' .svm.biasMultiplier);

model.b = conf.svm.biasMultiplier * b;
models.w = w;

%----------------------------------------- ---------------------------
%测试SVM并评估
%--------- -------------------------------------------------- ---------

%估计测试图像的类别
scores = model.w'* psix + model.b'* ones(1,size(psix ,2));
[drop,imageEstClass] = max(scores,[],1);

%计算混淆矩阵
idx = sub2ind([length(classes),length(classes)],...
imageClass(s​​elTest),imageEstClass(s​​elTest)) ;
confus = zeros(length(classes));
confus = vl_binsum(confus,ones(size(idx)),idx);


I am trying to implement a BOW object recognition code in matlab. The process is slightly complicated and I've had a lot of trouble finding proper documentation on the procedure. So could someone double check if my plan below makes sense?I'm using the VLSIFT library extensively here

Training:
1. Extract SIFT image descriptor with VLSIFT
2. Quantize the descriptors with k-means(vl_hikmeans)
3. Take quantized descriptors and create histogram(VL_HIKMEANSHIST)
4. Create SVM from histograms(VL_PEGASOS?)

I understand step 1-3, but I'm not quite sure if the function for SVM is correct.VL_PEGASOS takes the following:

W = VL_PEGASOS(X, Y, LAMBDA)

How exactly do I use this function with the histogram that I create?

Finally during the recognition stage, how do I match the image with a class defined by the SVM?

解决方案

Did you look at their Caltech 101 example code, that is full implementation of an BoW approach.

Here is the part where they classify with pegasos and evaluate the results:

% --------------------------------------------------------------------
%                                                            Train SVM
% --------------------------------------------------------------------

lambda = 1 / (conf.svm.C *  length(selTrain)) ;
w = [] ;
for ci = 1:length(classes)
  perm = randperm(length(selTrain)) ;
  fprintf('Training model for class %s\n', classes{ci}) ;
  y = 2 * (imageClass(selTrain) == ci) - 1 ;
  data = vl_maketrainingset(psix(:,selTrain(perm)), int8(y(perm))) ;
  [w(:,ci) b(ci)] = vl_svmpegasos(data, lambda, ...
                                  'MaxIterations', 50/lambda, ...
                                  'BiasMultiplier', conf.svm.biasMultiplier) ;

  model.b = conf.svm.biasMultiplier * b ;
  model.w = w ;

% --------------------------------------------------------------------
%                                                Test SVM and evaluate
% --------------------------------------------------------------------

% Estimate the class of the test images
scores = model.w' * psix + model.b' * ones(1,size(psix,2)) ;
[drop, imageEstClass] = max(scores, [], 1) ;

% Compute the confusion matrix
idx = sub2ind([length(classes), length(classes)], ...
              imageClass(selTest), imageEstClass(selTest)) ;
confus = zeros(length(classes)) ;
confus = vl_binsum(confus, ones(size(idx)), idx) ;

这篇关于使用VLFEAT实现词袋对象识别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 22:52