MATLAB神经网络图像识别高识别率代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
I0=pretreatment(imread( 'Z:\data\PictureData\TestCode\SplitDataTest\0 (1).png' ));
I1=pretreatment(imread( 'Z:\data\PictureData\TestCode\SplitDataTest\1 (1).png' ));
I2=pretreatment(imread( 'Z:\data\PictureData\TestCode\SplitDataTest\2 (1).png' ));
I3=pretreatment(imread( 'Z:\data\PictureData\TestCode\SplitDataTest\3 (1).png' ));
I4=pretreatment(imread( 'Z:\data\PictureData\TestCode\SplitDataTest\4 (1).png' ));
I5=pretreatment(imread( 'Z:\data\PictureData\TestCode\SplitDataTest\5 (1).png' ));
I6=pretreatment(imread( 'Z:\data\PictureData\TestCode\SplitDataTest\6 (1).png' ));
I7=pretreatment(imread( 'Z:\data\PictureData\TestCode\SplitDataTest\7 (1).png' ));
I8=pretreatment(imread( 'Z:\data\PictureData\TestCode\SplitDataTest\8 (1).png' ));
I9=pretreatment(imread( 'Z:\data\PictureData\TestCode\SplitDataTest\9 (1).png' ));
%以上数据都是归一化好的数据。
P=[I0 ',I1' ,I2 ',I3' ,I4 ',I5' ,I6 ',I7' ,I8 ',I9' ];
T=eye(10,10);
%%bp神经网络参数设置
net=newff(minmax(P),[144,200,10],{ 'logsig' , 'logsig' , 'logsig' }, 'trainrp' );
net.inputWeights{1,1}.initFcn = 'randnr' ;
net.layerWeights{2,1}.initFcn = 'randnr' ;
net.trainparam.epochs=5000;
net.trainparam.show=50;
net.trainparam.lr=0.001;
net.trainparam.goal=0.0000000000001;
net=init(net);
%%%训练样本%%%%
[net,tr]=train(net,P,T);
PIN0=pretreatment(imread( 'Z:\data\PictureData\TestCode\SplitDataTest\4 (2).png' ));
PIN1=pretreatment(imread( 'Z:\data\PictureData\TestCode\SplitDataTest\3 (2).png' ));
P0=[PIN0 ',PIN1' ];
T0= sim(net ,PIN1')
T1 = compet (T0)
d =find(T1 == 1) - 1
fprintf ( '预测数字是:%d\n' ,d);
%有较高的识别率
|
识别率还是挺高的。但是最大的难点问题是图像的预处理,分割,我觉得智能算法的识别已经做得很好了。最重要的是图像预处理分割。
总结
以上就是这篇文章的全部内容了,希望本文的内容对大家的学习或者工作具有一定的参考学习价值,谢谢大家对服务器之家的支持。如果你想了解更多相关内容请查看下面相关链接
原文链接:https://blog.csdn.net/u013355826/article/details/80579901