【问题标题】:implementing Bags of Words object recognition using VLFEAT使用 VLFEAT 实现词袋对象识别
【发布时间】:2012-06-20 23:04:25
【问题描述】:

我正在尝试在 matlab 中实现一个 BOW 对象识别代码。这个过程有点复杂,我在找到有关该过程的适当文档时遇到了很多麻烦。那么有人可以仔细检查我下面的计划是否有意义吗? 我在这里广泛使用VLSIFT library

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?)

我了解步骤 1-3,但我不太确定 SVM 的功能是否正确。 VL_PEGASOS 采用以下内容:

W = VL_PEGASOS(X, Y, LAMBDA)

我如何将这个函数与我创建的直方图一起使用?

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

【问题讨论】:

    标签: computer-vision svm sift


    【解决方案1】:

    你看过他们的Caltech 101 example code,那是BoW方法的完整实现。

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

    % --------------------------------------------------------------------
    %                                                            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) ;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多