Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
Drexel University or The Math Forum.
|
|
|
|
character recognition,nntool
Posted:
Jan 3, 2013 2:37 AM
|
|
Hi All, I want to do character recognition. I have the following code. But, after i run this program at Matlab. I am still unable to recognition any number. What is the step taken to make the below coding works? please help me?
clc; close all; clear all; letter1 = [1 0 0 0 1 ... 1 0 0 0 1 ... 1 0 0 0 1 ... 1 0 0 0 1 ... 1 0 0 0 1 ... 1 0 0 0 1 ... 1 0 0 0 1]'; letter2 = [1 0 0 0 1 ... 0 1 1 1 0 ... 1 1 1 1 0 ... 1 1 1 0 1 ... 1 1 0 1 1 ... 1 0 1 1 1 ... 0 0 0 0 0]'; letter3 = [1 0 0 0 1 ... 0 1 1 1 0 ... 1 1 1 1 0 ... 1 1 0 0 1 ... 1 1 1 1 0 ... 0 1 1 1 0 ... 1 0 0 0 1]'; letter4 = [1 1 1 0 1 ... 1 1 0 0 1 ... 1 0 1 0 1 ... 0 1 1 0 1 ... 0 0 0 0 0 ... 1 1 1 0 1 ... 1 1 1 0 1]'; letter5 = [0 0 0 0 0 ... 0 1 1 1 1 ... 0 1 1 1 1 ... 0 0 0 0 1 ... 1 1 1 1 0 ... 0 1 1 1 0 ... 1 0 0 0 1]'; letter6 = [1 0 0 0 1 ... 0 1 1 1 1 ... 0 1 1 1 1 ... 0 0 0 0 1 ... 0 1 1 1 0 ... 0 1 1 1 0 ... 1 0 0 0 1]'; letter7 = [0 0 0 0 0 ... 1 1 1 1 0 ... 1 1 1 1 0 ... 1 1 1 0 1 ... 1 1 0 1 1 ... 1 0 1 1 1 ... 0 1 1 1 1]'; letter8 = [1 0 0 0 1 ... 0 1 1 1 0 ... 0 1 1 1 0 ... 1 0 0 0 1 ... 0 1 1 1 0 ... 0 1 1 1 0 ... 1 0 0 0 1]'; letter9 = [1 0 0 0 1 ... 0 1 1 1 0 ... 0 1 1 1 0 ... 0 1 1 1 0 ... 0 1 1 1 0 ... 0 1 1 1 0 ... 1 0 0 0 1]'; letter0 = [1 0 0 0 1 ... 0 0 0 0 0 ... 0 1 1 1 0 ... 0 1 1 1 0 ... 0 1 1 1 0 ... 0 0 0 0 0 ... 1 0 0 0 1]';
P = [letter1,letter2,letter3,letter4,letter5,letter6,letter7,letter8,letter9,letter0]; T = eye(10); S1 = 10; [R,Q] = size(P); [S2,Q] = size(T);
net = newff(minmax(P),[S1 S2],{'logsig' 'logsig'},'traingdx'); net.performFcn = 'sse'; net.trainParam.goal = 0.1; net.trainParam.show = 20; net.trainParam.epochs = 5000; net.trainParam.mc = 0.95; [net,tr] = train(net,P,T); noisyJ = P(:,10)+randn(35,1)*0.2; plotchar(noisyJ); A2 = sim(net,noisyJ); A2 = compet(A2); answer = find(compet(A2) == 1); plotchar(P(:,answer));
|
|
|
|