【发布时间】:2011-07-30 12:52:02
【问题描述】:
根据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 CAT 时出错 论据维度不是 持续的。 ==> minmax 在 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]
【问题讨论】:
标签: matlab neural-network