• 大小: 3.42MB
    文件类型: .zip
    金币: 2
    下载: 0 次
    发布日期: 2024-02-13
  • 语言: 其他
  • 标签: SIFT+BOW+SVM  

资源简介

图像的特征Dense Sift提取,通过Bag of Words词袋模型进行描述,用BoW描述完图像之后,指的是将训练集以及测试集的图像都用BoW模型描述了,就可以用SVM训练分类模型进行分类了。在这里除了用SVM的RBF核,还自己定义了一种核: histogram intersection kernel,直方图正交核。很多论文说这个核好,并且实验结果很显然。能从理论上证明一下么?通过自定义核也可以了解怎么使用自定义核来用SVM进行分类

资源截图

代码片段和文件信息

% ========================================================================
% Image Classification using Bag of Words and Spatial Pyramid BoW
% Created by Piji Li (peegeelee@gmail.com)  
% Blog: http://www.zhizhihu.com
% QQ: 379115886
% IRLab. : http://ir.sdu.edu.cn     
% Shandong UniversityJinanChina
% 10/24/2011

clear pg_opts
rootpath=‘E:\workspace\matlab\work\PG_BOW_DEMO\‘;

%%
addpath libsvm;
addpath BOW;

%% change these paths to point to the image data and label location
images_set=strcat(rootpath‘images‘);
data=strcat(rootpath‘data‘);
labels=strcat(rootpath‘labels‘);

%%
pg_opts.imgpath=images_set; % image path
pg_opts.datapath=data;
pg_opts.labelspath=labels;

%%
% local and global data paths
pg_opts.localdatapath=sprintf(‘%s/local‘pg_opts.datapath);
pg_opts.globaldatapath=sprintf(‘%s/global‘pg_opts.datapath);

% initialize the training set
pg_opts.trainset=sprintf(‘%s/trainset.mat‘pg_opts.labelspath);
% initialize the test set
pg_opts.testset=sprintf(‘%s/testset.mat‘pg_opts.labelspath);
% initialize the labels
pg_opts.labels=sprintf(‘%s/labels.mat‘pg_opts.labelspath);
% initialize the image names
pg_opts.image_names=sprintf(‘%s/image_names.mat‘pg_opts.labelspath);

% Classes
pg_opts.classes={...
    ‘Phoning‘
    ‘PlayingGuitar‘
    ‘RidingBike‘
    ‘RidingHorse‘
    ‘Running‘
    ‘Shooting‘
    };

pg_opts.nclasses=length(pg_opts.classes);

load(sprintf(‘%s‘pg_opts.labels));
pg_opts.nimages=size(labels1);

load(pg_opts.trainset);
load(pg_opts.testset);
pg_opts.ntraning =  length(find(trainset==1));
pg_opts.ntesting =  length(find(testset==1));

%% creat the directory to save data 
MakeDataDirectory(pg_opts);

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-10-24 12:28  PG_BOW_DEMO\
     目录           0  2011-10-24 12:24  PG_BOW_DEMO\BOW\
     文件        3821  2011-10-24 11:43  PG_BOW_DEMO\BOW\CalculateDictionary.m
     文件        3354  2011-10-24 11:44  PG_BOW_DEMO\BOW\CompilePyramid.m
     文件        2384  2011-10-24 11:44  PG_BOW_DEMO\BOW\do_assignment.m
     文件        2198  2011-10-24 12:58  PG_BOW_DEMO\BOW\do_classification_inter_svm.m
     文件        1731  2011-10-24 12:58  PG_BOW_DEMO\BOW\do_classification_rbf_svm.m
     文件         875  2010-12-21 21:34  PG_BOW_DEMO\BOW\do_normalize.m
     文件        2243  2011-10-24 12:58  PG_BOW_DEMO\BOW\do_p_classification__inter_svm.m
     文件        1382  2011-10-24 12:58  PG_BOW_DEMO\BOW\do_p_classification__rbf_svm.m
     文件        1132  2011-10-24 12:57  PG_BOW_DEMO\BOW\draw_cm.m
     文件        1303  2010-12-21 21:32  PG_BOW_DEMO\BOW\EuclideanDistance.m
     文件         446  2011-10-24 11:41  PG_BOW_DEMO\BOW\find_grid.m
     文件        4292  2010-09-08 21:48  PG_BOW_DEMO\BOW\find_sift_grid.m
     文件        2765  2011-10-24 11:45  PG_BOW_DEMO\BOW\GenerateSiftDescriptors.m
     文件         759  2009-01-17 20:48  PG_BOW_DEMO\BOW\hist_isect.m
     文件        3305  2010-10-31 22:25  PG_BOW_DEMO\BOW\hist_isect_c.c
     文件        8192  2010-10-31 22:26  PG_BOW_DEMO\BOW\hist_isect_c.mexw32
     文件         154  2010-06-01 14:35  PG_BOW_DEMO\BOW\load_image.m
     文件         601  2011-10-24 11:41  PG_BOW_DEMO\BOW\MakeDataDirectory.m
     文件         223  2008-12-10 16:46  PG_BOW_DEMO\BOW\make_dir.m
     文件         650  2008-12-10 16:46  PG_BOW_DEMO\BOW\normalize_sift.m
     文件         324  2010-06-01 15:44  PG_BOW_DEMO\BOW\num2string.m
     文件         264  2010-06-01 15:44  PG_BOW_DEMO\BOW\read_image_db.m
     文件       14315  2010-10-16 08:01  PG_BOW_DEMO\BOW\rotateXLabels.m
     文件         551  2011-10-24 12:26  PG_BOW_DEMO\BOW\show_results_script.m
     文件         258  2010-09-27 10:04  PG_BOW_DEMO\BOW\sumnormalize.m
     目录           0  2011-10-21 22:43  PG_BOW_DEMO\images\
     目录           0  2011-10-24 09:16  PG_BOW_DEMO\images\testing\
     目录           0  2011-10-24 09:16  PG_BOW_DEMO\images\testing\Phoning\
     文件        7711  2010-12-01 14:34  PG_BOW_DEMO\images\testing\Phoning\Phoning_0041.jpg
............此处省略401个文件信息

评论

共有 条评论

相关资源