📄 classificationbp.m
字号:
function classificationBP(w1,b1,w2,b2,w3,b3)
%利用BP网络实现对绍兴图像的分类
%disp('Please inut the net vertifying data file [path][filename]:');
%file1=input('The data file name:','s');
%file2=input('The output file name','s');
file1='g:\lfx\newtask\exportedata\txtsx-total.txt';
file2='g:\lfx\newtask\exportedata\sx-BP.grd';
fp1=fopen(file1,'rt');
fp2=fopen(file2,'wt');
%load train_var.mat %装入训练过的权值和偏差
x_max=150;
x_min=10;
k=x_max-x_min;
while(~feof(fp1))
[class,count]=fscanf(fp1,'%f',[3,1]);
class=(class-x_min)/k;
p=class;
a=simuff(p,w1,b1,'logsig',w2,b2,'logsig',w3,b3,'purelin');
aa=compet(a);
b=full(aa);
for j=1:5
if(b(j)==1)break
end
end
fprintf(fp2,'%2d',i);
end
addheadstr('g:\lfx\newtask\solution\sx-BP.grd','g:\lfx\newtask\solution\sx-BP2img.grd');
fclose('all');
disp('The programe end');
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -