根据last question,我能够使用已提供的方法保存功能设置。神经网络的进给功能
FeaturesTest.roundness = roundness;
FeaturesTest.nWhite = nWhite;
FeaturesTest.color = color;
FeaturesTest.descriptors = descriptors;
FeaturesTest.outputs = outputs;
FeaturesTest = {roundness,nWhite, color, descriptors, outputs};
现在我的第一个4个特征输入神经网络,第5个特征输入到目标。我是这样写的。
load('features.mat','FeaturesTest');
A = FeaturesTest;
P=A(:,1:4)';
T=A(:,5:5)';
rand('seed', 491218382);
net = newff(minmax(P),T,20);
现在同样的错误出现输入功能...
???错误使用==> horzcat参数尺寸不是 一致。错误在==> minmax at 38 pr {i} = minmax([p {i,:}]);
有没有人有这方面的想法?
@Itamar Katz感谢您向我展示单元阵列和结构的使用。我现在改了它。有这样一个函数返回一个图像的特征。圆度和nWhite只有一个值。描述符是移位描述符。有5种类型的输出。对于第一个图像输出应该是1,第二个,2等等。颜色显示在.mat文件中[196,186,177]。输出类似于[1,0,0,0,0]。
function[FeaturesTest] = features(image)
[siftImage, descriptors, locs] = sift(image);
FeaturesTest = {roundness, nWhite, color, descriptors, outputs};
现在从训练集中逐一获取图像,并为每个图像调用上述函数。
for i=1:size(list, 1);
if (~(list(i).isdir))
[FeatureSet] = features(fullfile('F:\ProjectWork\Coin_Recognition\TrainingSet', list(i).name));
Features = [Features; FeatureSet];
end
end
save('features.mat','Features');
现在我想训练这个功能。我做的是
load('features.mat','Features');
A = Features;
P=A(:,1:4)';
T=A(:,5:5)';
rand('seed', 491218382);
net = newff(minmax(P),T,20);
Error comes here.
请帮帮我。谢谢。 6个图像
features.mat文件是这样的
0.776914651509411 1874 [196,186,177] <14x128 double>
[1,0,0,0,0]
0.839974548665116 1794 [219,213,202] <7x128 double>
[1,0,0,0,0]
0.841707612525928 1796 [192,182,171] <5x128 double>
[1,0,0,0,0]
0.861761793121658 1783 [202,199,192] <13x128 double>
[1,0,0,0,0]
0.411077484660635 3689 [97,88,72] <238x128 double>
[0,1,0,0,0]
0.844865287736163 3372 [166,139,89] <228x128 double>
[0,1,0,0,0]
谢谢。在特征提取功能中,像这样返回特征。 FeaturesTest.nWhite = nWhite; FeaturesTest.descriptors =描述符; FeaturesTest.roundness =圆度; FeaturesTest.color = color; FeaturesTest.outputs =输出;然后FeaturesTest = {圆度,nWhite,颜色,描述符};假设一个图像的圆度为<1x1 double>颜色为<1x3 double> nWhite为<1x1 double>描述符为<14x128 double>,输出为<1x5 double>有18个硬币需要训练。所以FeaturesTest输入和输出是<18x5 cell> – 2011-04-06 08:59:58
请参考我上面的问题。我编辑它以提供您要求的尺寸。谢谢 – 2011-04-06 09:22:46