应用词频率逆文档频率(TF-IDF)袋在MATLAB视觉单词

9的观点(30天)
你好,
我希望火车一袋视觉单词分类模型。我想实现一个词频率逆文档频率(TF-IDF)称重方案权衡下来不太重要的功能,可能出现在所有类(如背景特性)。然而,似乎不允许使用tfidf MATLAB函数包的特性,只有单词的袋子。有人有一个想法我如何可以实现使用袋TF-IDF当训练模型的特性。
谢谢你的帮助。

接受的答案

焉耆刘
焉耆刘 2021年9月26日
先生,可以检查 retrieveImages图片搜索功能
1评论
NonoDee
NonoDee 2021年9月27日
谢谢你的回答。我透过retrieveImages文档,我相信这将有助于我。不过我确实有一个跟进的问题:如果我实现词频TF-IDF称重方案invertedImageIndex对象中的一部分,会是一个精确的方法来实现我的理想的方案吗?

登录置评。

答案(1)

焉耆刘
焉耆刘 2021年9月29日
先生,请检查下代码来得到一些信息
clc;清晰的所有;关闭所有;
imageFiles =
{“elephant.jpg”,“cameraman.tif”,
“peppers.png”,“saturn.png”,
“pears.png”,“stapleRemover.jpg”,
“football.jpg”,“mandi.tif”,
“kids.tif”,“liftingbody.png”,
“office_5.jpg”,“gantrycrane.png”,
“moon.tif”,“circuit.tif”,
“tape.png”,“coins.png”};
imgSet = imageSet (imageFiles);
%的视觉词包
袋= bagOfFeatures (imgSet,“PointSelection”,“探测器”,
“VocabularySize”,1000);
创建Bag-Of-Features。- - - - - - - - - - - - - - - - - - - - - - - - - *图像类别1:<定义> *使用检测器方法选择特征点位置。*从所选特征点提取冲浪功能位置。* * detectSURFFeatures是特征提取的用于检测要点。*从16图像在图像中提取特征集1…。提取3680特性。*保持最强的功能从每个类别的80%。*平衡特性的数量在所有图像分类来提高聚类。* *图像类别1最少的最强的特点:2944。* *使用最强的2944特性从每个其他的图像类别。 * Creating a 1000 word visual vocabulary. * Number of levels: 1 * Branching factor: 1000 * Number of clustering steps: 1 * [Step 1/1] Clustering vocabulary level 1. * Number of features : 2944 * Number of clusters : 1000 * Initializing cluster centers...100.00%. * Clustering...completed 13/100 iterations (~0.05 seconds/iteration)...converged in 13 iterations. * Finished creating Bag-Of-Features
%创指数处理程序
imageIndex = invertedImageIndex(袋);
%操作imageset
addImages (imageIndex imgSet);
使用Bag-Of-Features编码图像。- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - *图像类别1:<定义> 16 *编码图像从图像组1…。*完成编码图像。
%显示图象指数
imageIndex
imageIndex =
invertedImageIndex属性:ImageLocation:{16×1细胞}ImageWords: [16×1 vision.internal.visualWords] WordFrequency:[1×1000双]BagOfFeatures: [1×1 BagOfFeatures] ImageID: (1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16] MatchThreshold: 0.0100 WordFrequencyRange: [0.0100 - 0.9000]
imageIndex.ImageWords
ans =
16×1visualWords数组的属性:WordIndex位置VocabularySize计数
%让图片搜索
queryImage = imread (“clutteredDesk.jpg”);
queryROI = (130 175 330 365);
%得到搜索结果
[imageid,分数,imageWords] = retrieveImages (queryImage imageIndex,“投资回报”queryROI)
imageid = 15×1
1 11 2 6 3 8 13 12 10 9
成绩= 15×1
0.5169 0.1953 0.1521 0.1015 0.0842 0.0731 0.0491 0.0438 0.0421 0.0383
imageWords =
visualWords属性:WordIndex (312×1: uint32)地点:[312×2单]VocabularySize: 1000数量:312
1评论
NonoDee
NonoDee 2021年9月29日
谢谢你的帮助。我很熟悉retrieveImages函数。然而,我想做的就是找到一种方法来衡量视觉单词对他们出现在不同的类。我意识到我可以排除一些视觉单词通过设置WordFrequencyRange,然而,而不是完全排除,我想缩减规模的重要性和高档其他视觉单词的重要性按照TF-IDF意识形态。
再次感谢你的帮助。

登录置评。

下载188bet金宝搏


释放

R2021a

社区寻宝

找到宝藏在MATLAB中央,发现社区如何帮助你!

开始狩猎!