【问题标题】:How to visualize the visual words from a bag of features classifier in MATLAB?如何在 MATLAB 中可视化来自特征分类器的视觉词?
【发布时间】:2016-05-07 02:44:35
【问题描述】:

我在 MATLAB 中使用特征包对组织学图像进行分类。

这是我使用的代码。它取自`imageCategoryClassificationExample

压缩数据集的位置

url=http://www.vision.caltech.edu/Image_Datasets/Caltech101/101_ObjectCategories.tar.gz';

将输出存储在临时文件夹中

outputFolder = fullfile(tempdir, 'caltech101');

rootFolder = fullfile(outputFolder, '101_ObjectCategories');
imgSets = [ imageSet(fullfile(rootFolder, 'airplanes')), ...
            imageSet(fullfile(rootFolder, 'ferry')), ...
            imageSet(fullfile(rootFolder, 'laptop')) ];

确定一个类别中的最小图像数量

minSetCount = min([imgSets.Count]);

使用partition 方法修剪集合。

imgSets = partition(imgSets, minSetCount, 'randomize');

将集合分成训练和验证数据。

[trainingSets, validationSets] = partition(imgSets, 0.3, 'randomize');

创建特征分类器包

bag = bagOfFeatures(trainingSets);

此外,bagOfFeatures 对象提供了一个encode 方法 计算图像中视觉单词的出现次数。它产生了一个直方图 这将成为图像的一种新的简化表示。

img = read(imgSets(1), 1);
[featureVector,words] = encode(bag, img);

绘制视觉单词出现的直方图

figure
bar(featureVector)
title('Visual word occurrences')
xlabel('Visual word index')
ylabel('Frequency of occurrence')

在创建特征包对象后,我如何可视化最终的码本以及每个图像由哪些视觉词组成?我可以从这些单词中重建图像吗?我认为这与使用encode 创建visualWords 对象有关。但是之后我该怎么做呢?

【问题讨论】:

    标签: matlab computer-vision matlab-cvst object-recognition


    【解决方案1】:

    MATLAB 中没有内置函数可以为您做到这一点。不过有papers这个话题。

    【讨论】:

    • 你能给我一个这些论文的例子吗?
    • 抱歉,链接错误。顺便说一句,您所要做的就是谷歌“可视化功能包”。
    猜你喜欢
    • 2022-07-06
    • 2013-12-28
    • 1970-01-01
    • 1970-01-01
    • 2016-09-25
    • 2015-10-20
    • 2016-03-29
    • 1970-01-01
    • 2017-07-27
    相关资源
    最近更新 更多