根據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