how to display and store all the data that has been processed in the form of a matrix in neural network?

2 ビュー (過去 30 日間)
Hi,
I have a problem in my program below. there is an error in the matrix appearance. What should I do to keep all the data in a matrix form below so that the neural network can be processed?
??? Error using ==> minus
Matrix dimensions must agree.
Error in ==> prestd at 90
tn = (t-meant0*oneQ)./(stdt0*oneQ);
Error in ==> cobaaja at 71
[pn,meanp,stdp,tn,meant,stdt] = prestd(P,T);
my program:
clc;
clear all;
% You can customize and fix initial directory paths
DatabasePath = uigetdir('Pilih Database' );
prompt = {'Pilih image yang akan diproses ( 1 to 20):'};
dlg_title = 'cobacoba';
num_lines= 1;
def = {'1'};
cobacoba = inputdlg(prompt,dlg_title,num_lines,def);
cobacoba = strcat(DatabasePath,'\',char(cobacoba),'.jpg');
I = imread(cobacoba);
imshow (I);
%untuk mengubah gambar ke dalam bentuk nilai biner
gray=rgb2gray(I);
thresh=graythresh(gray);
imbw=im2bw(gray,thresh);
%histogram
red=I(:,:,1); %memanggil matriks gambar yang hanya berisi piksel warna merah
green= I(:,:,2);% memanggil matriks gambar yang hanya berisi piksel warna hijau
blue=I(:,:,3); %memanggil matriks gambar yang hanya berisi piksel warna biru
merahgray2=0.3*red+0.5*green+0.2*blue ;
imhist(red);
imhist(green);
imhist(blue);
imhist(gray);
%menampilkan nilai RGB
R = I(:,:,1);
G = I(:,:,2);
B = I(:,:,3);
%menampilkan sum dari RGB
sumR = sum(sum(R));
sumG = sum(sum(G));
sumB = sum(sum(B));
n= (sumR+sumG+sumB);
% Normalisasi warna pada citra
NormalizedRed = sumR * sqrt ( sumR^2+ sumG^2 + sumB^2);
NormalizedGreen = sumG * sqrt ( sumR^2+ sumG^2 + sumB^2);
NormalizedBlue = sumB * sqrt ( sumR^2+ sumG^2 + sumB^2);
% Mencari mean
MeanR = 1/n*sumR*1.0e+005
MeanG = 1/n*sumG*1.0e+005
MeanB = 1/n*sumB*1.0e+005
% Mencari standar deviasi
sR=(1/n*(sumR-MeanR))^1/2*1.0e+005
sG=(1/n*(sumG-MeanG))^1/2*1.0e+005
sB=(1/n*(sumB-MeanB))^1/2*1.0e+005
%Mencari kurtosis
kR=( 1/n*((sumR-MeanR)^4))/(1/n*((sumR-MeanR)^2))^2
kG=( 1/n*((sumG-MeanG)^4))/(1/n*((sumG-MeanG)^2))^2
kB=( 1/n*((sumB-MeanB)^4))/(1/n*((sumB-MeanB)^2))^2
% Mencari Skewness
SkR = ( 1/n*((sumR-MeanR)^3))/sqrt(1/n*((sumR-MeanR)^2))^3
SkG = ( 1/n*((sumG-MeanG)^3))/sqrt(1/n*((sumG-MeanG)^2))^3
SkB = ( 1/n*((sumB-MeanB)^3))/sqrt(1/n*((sumB-MeanB)^2))^3
% Data Input & Target
P=[MeanR MeanG MeanB sR sG sB kR kG kB SkR SkG SkB]
T=[-1 0 1]
% Preprocessing
[pn,meanp,stdp,tn,meant,stdt] = prestd(P,T);
% Membangun jaringan dengan propagasi umpan balik berbasis jaringan syaraf tiruan
net = newff(minmax(pn),[10 5 1],{'tansig' 'logsig' 'purelin'},'traingdm')
% melihat bobot awal jaringan
BobotAwal_Input = net.IW{1,1};
BobotAwal_Bias_Input = net.b{1,1};
BobotAwal_Lapisan1 = net.LW {2,1};
BobotAwal_Bias_Lapisan = net.b {2,1};
% Set parameter pelatihan
net.trainParam.epochs = 1000;
net.trainParam.goal = 1e-04;
net.trainParam.lr = 0.6;
net.trainParam.showCommandLine = true;
net.trainParam.show = 100;
net.trainParam.mc = 0.7;
% pelatihan
net = train(net,pn,tn);pause
% melihat bobot akhir jaringan
BobotAkhir_Input = net.IW{1,1};
BobotAkhir_Bias_Input = net.b{1,1};
BobotAkhir_Lapisan1 = net.LW {2,1};
BobotAkhir_Bias_Lapisan = net.b {2,1};
%simulasi terhadap data pelatihan
an = sim(net,pn);
a = poststd (an,meant,stdt);
H = [(1:size(P,2))' T' a' (T'-a')];
sprintf('%2d %9.2f %7.2f %5.2f\n',H')
%Evaluasi output jaringan (data pelatihan dengan target)
[m1,a1,r1] = postreg (a,T);
pause
plot (1:size(P,2),T,'bo',1:size(P,2),a','r*');
title('Hasil pengujian dengan data pelatihan Target (o), Output (*)');
xlabel('Data ke-');
ylabel('Target/Output');
pause
In addition, please guide me, sincerely Yours Een Qurota Aini
  10 件のコメント
Greg Heath
Greg Heath 2013 年 10 月 2 日
編集済み: Greg Heath 2013 年 10 月 2 日
What is
size(P)
size(T)
oneQ
Een Qurota Aini
Een Qurota Aini 2013 年 10 月 7 日
編集済み: Een Qurota Aini 2013 年 10 月 7 日
P=[MeanR MeanG MeanB sR sG sB kR kG kB SkR SkG SkB];
T=[-1 0 1];
sR=Deviation Standart from RGB Value R
sG=Deviation Standart from RGB Value G
sB=Deviation Standart from RGB Value B
kR=Kurtosis from RGB value R
kG=Kurtosis from RGB value G
kB=Kurtosis from RGB value B
SkR=Skewness from RGB value R
SkG=Skewness from RGB value G
SkB-Skewness from RGB value B
What is the mean oneQ??

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeCustom Training Loops についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by