PDA

查看完整版本 : [求助]BP网络在图象压缩中的应用


knight438
2008-05-13, 08:07
构建的BP网络
function Y=S(I)
P=I;
T=P;
%规范化数据
[pn,minp,maxp,tn,mint,maxt] = premnmx(P,T);
[ptrans,transMat] = prepca(pn,0.001);
[R,Q] = size(ptrans);
%建立网络
net=newff(minmax(P),[16,64],{'tansig','purelin'},'traingdx');
net.LW{2,1} = net.LW{2,1}*0.01;
net.b{2} = net.b{2}*0.01;
[W1,B1]=nwtan(8,64);
%网络训练
net.trainParam.show=2000;
%设置训练显示间隔次数
net.trainParam.epochs=10000;
%设置最大训练循环次数
net.trainParam.goal=0.001;
%设置性能目标值
net.trainParam.lr=0.01;
%设置学习系数
net.trainParam.mc=0.95;
%设置动量因子
net.trainParam.lr_inc=1.05;
%设置递增乘因子
net.trainParam.lr_dec=0.7;
%设置递减乘因子
net.trainParam.max_perf_inc=1.04;
%设置误差速率
[net,tr]=train(net,P,T);
for i=1:16;
w1=net.IW{1,1};
b1=net.b{1};
w2=net.LW{2,1};
b2=net.b{2};
a=simuff(P,w1,b1,'tansig');
yasuo_doc1(1,i).yincengshuchu=a;
yasuo_doc1(1,i).layerweight=w2;
yasuo_doc1(1,i).bias=b2;
save;
end
Y=sim(net,P);
主程序
load rice
I1=rice
I=double(I1)+1;
I=I/255;
Y=@S;
I2=blkproc(I,[64 64],Y);
subplot(1,2,1);imshow(I1);
title('压缩前的图像');
axis square;
disp('压缩前图像大小');
whos('I1');
subplot(1,2,2);imshow(I2);
title('压缩后的图像');
axis square;
disp('压缩后图像大小');
whos('I2')
弱弱的问一下
如果改变压缩比该怎么改
图象的信噪比该如何显示
谢谢高手指教