如何使用神经网络保存用于分类的Sift特征向量 [英] How to save Sift feature vector for classification using Neural network

查看:204
本文介绍了如何使用神经网络保存用于分类的Sift特征向量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可以从 http://www.cs.ubc找到Matlab实现的SIFT功能. ca/〜lowe/keypoints/.在stackoverflow的帮助下.我想将功能保存到.mat文件.特征是圆度,颜色,二进制图像中没有白像素数和筛分特征.对于筛选功能,我在上面的代码中使用了描述符{[siftImage,descriptors,locs] = sift(filteredImg)}因此,我的特征向量现在是FeaturesTest = [圆度,nWhite,颜色,描述符,输出];当使用save('features.mat','Features')将其保存到.mat文件时;它给出了一个错误.
错误是这样的.

Matlab implementation of SIFT features were found from http://www.cs.ubc.ca/~lowe/keypoints/. with the help of stackoverflow. I want to save features to a .mat file. Features are roundness, color, no of white pixel count in the binary image and sift features. For the sift features I took descriptors in above code { [siftImage, descriptors, locs] = sift(filteredImg) } So my feature vector now is FeaturesTest = [roundness, nWhite, color, descriptors, outputs]; When saving this to .mat file using save('features.mat','Features'); it gives an error.
Error is like this.

???使用==> horzcat CAT时出错 参数尺寸不是 持续的. ==>中的错误 user_interface> extract_features在336 FeaturesTest = [圆度,nWhite, 颜色,描述符,输出];

??? Error using ==> horzcat CAT arguments dimensions are not consistent. Error in ==> user_interface>extract_features at 336 FeaturesTest = [roundness, nWhite, color, descriptors, outputs];

据我了解,我认为问题在于描述符特征向量的大小.它是<14×128 double>.此功能有14行,在其他情况下,.mat文件中只有一行.如何与其他功能一起将此特征向量保存到.mat文件?

As I can understand, I think the issue is descriptor feature vector size. It is <14x128 double>. 14 rows are for this feature, where as for others only one row is in .mat file. How can I save this feature vector to the .mat file with my other features?

等待回复.预先感谢.

推荐答案

据我了解,您似乎正在尝试将变量roundnessnWhitecolordescriptorsoutputs放入一个向量中,所有变量都有唯一的维度.

From what I can understand, it looks like you are trying to put the variables roundness, nWhite, color, descriptors, and outputs into a single vector, and all the variables have unique dimensions.

也许最好使用单元格或结构来存储数据.要将数据存储在单元格中,只需将方括号更改为花括号,如下所示:

Maybe it would be better to use a cell or a structure to store the data. To store the data in a cell, just change square brackets to curly braces, like so:

FeaturesTest = {roundness, nWhite, color, descriptors, outputs};

但是,当您从.mat文件中拉回数据时,这将需要您记住哪个单元格是哪个单元格.一个结构可能对您更有用:

However, that would require you to remember which cells were which when you pulled the data back out of the .mat file. A structure may be more useful for you:

FeaturesTest.roundness = roundness;
FeaturesTest.nWhite = nWhite;
FeaturesTest.color = color;
FeaturesTest.descriptors = descriptors;
FeaturesTest.outputs = outputs;

然后,当您加载.mat文件时,所有数据都将包含在该结构中,您可以轻松地引用该结构.如果只需要查看颜色变量,则键入FeaturesTest.color,按Enter,将显示该变量.或者,您可以通过在工作区窗口中双击该结构来浏览该结构.

Then, when you load the .mat file, all of the data will be contained in that structure, which you can easily reference. If you needed to look at just the color variable, you would type FeaturesTest.color, press enter, and the variable would be displayed. Alternatively, you could browse the structure by double clicking on it in the workspace window.

或者,您也可以像这样使用save命令:

Alternatively, you could just use the save command like so:

save(filename,roundness, nWhite, color, descriptors, outputs)

希望这会有所帮助.

这篇关于如何使用神经网络保存用于分类的Sift特征向量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆