CHARACTER RECOGNITION TECHNIQUE USING ARTIFICIAL INTELLIGENCE

madbrainedmudlickΤεχνίτη Νοημοσύνη και Ρομποτική

20 Οκτ 2013 (πριν από 3 χρόνια και 7 μήνες)

59 εμφανίσεις


28

|
P a g e



International Journal of Emerging Trends in Computer Science


Vol 1(1), 2013

www.ijetcs.org


CHARACTER RECOGNITION TE
CHNIQUE
USING ARTIFICIAL INTELLI
GENCE


Neha
K
aushik

1
, Monika

2
,
Mr.
Tarachand Verma
3

1

Department of Computer Science and Engineering

Raj

K
umar Goel Institute of Technology for Women

Ghaziabad
-
201003, Uttar Pradesh(India)

nehakaushik0591@gmail.com


2

Department of Computer Science and Engineering

Raj Kumar Goel Institute of Technology for Women

Ghaziabad
-
201003, Uttar Pradesh(India)

sat.brill@gmail.com


3

Assistant. Professor, Department of Computer Scien
ce and Engineering

Raj Kumar Goel Institute of Technology for Women

Ghaziabad
-
201003, Uttar Pradesh(India)

tarachandverma
@
rkgitw
.
edu
.
in






Abstract

This paper

represents a method for recognizing the

mouse dragged

cha
racter on the computer screen
using artificial
intelligence.

This research is a simple
approach to implement the initial step to convert the
input text into compu
ter readable form.

Here we use
K
ohenen self organizing map for classifying the
patterns which is an unsupervised learning
algorithm.the resu
lt is quite satisfying in terms of
recognizing the characters

successfully. This
technique is tolerable

as per to the changing
conditions of the given inputs.

Selecting

a re
levant
method for feature extraction is the most important
factor for
achieving
high recogni
tion performance
with

accuracy in character recognition systems
.

The
system learns efficiently through the training process.

Moreover the ratio

of recognition

is ex
cellent in the
proposed
system.


Keywords

Artificial Neural networks, Kohonen
network, paper,
hand written character recognition, mouse dragging
etc
.


1
.
Introduction

Character

recognitio
n has been a research topic

for
several
decades. There are

three main steps

in
pattern recognition:
observation, pattern
segmentat
ion, and pattern
classification
.

Character
recognition is the process to classify the input
character
according to the

character class

which is
already been defined. With

the

increasing

interest of
computer applica
tions,
society needs the
system to
input text into computer

readable form.
In this paper
we’ll be using Kohonen neural network which is
having self organizing properties. It is able to infer
relationships and learn more and more inputs are
presented to it.

The Kohonen Self
-
Organizing Map (SOM) was
designed by T
uevoKohonen ,it is a third generation
neural network The SOM consists of a collection of
neurons which are connected to each other and also
have some input weight(w) associated with them.
If
t
he network is presented as the input vector (x
i
), then
it comput
es the response vector S
j

by using the
formula
:

S
j
=w
j

* x
i



(1)

The w
j
and x
i

are normalized before computing the
dot product that produces the node k with the largest
value of s.

The dot product of the normalized x
i

and w
k

is the
cosine of the angle between them,
we can conclude
that the winning node is the one with the weight
vec
tor closest to the input vector in its spatial

29

|
P a g e


orientation.
The nodes learn by applying a Δw to
their weights using the formula:

Δw
k
=α(x
i
-
w
k
)

(2)

Here α is a constant in the range [0,1] called the
lear
ning constant.

The training process can be described by the
following algorithm:

1. A cycle: for every input vector x
i

[a] Apply input vector

to the network and evaluate
the d
ot
products of the normal
ized weights on each
node and a
normalized input vecto
r.
T
hese dot
products

will be called as (s)

[b]

Then
Find the node k with the maximal response
s
k
.

[c]

After this t
rain no
de k, and all the nodes in
neighborhood of k,
according to the learning equation

above.

[d]
Now c
alculate a running average
of the angular
distance between
the values of w
k

and

also

their
associated input vectors.

[e] Decrease the learning rate α.


2. After every M cycles, decrease the size of the
neighborhood N.

3. Repeat steps 1
-
2 for some finite time . One
advantage to thi
s scheme is that the system is tolerant
for changing conditions and inputs. The system
consistently learns. Moreover the recognition ratio is
excellent in the system which we have proposed.



2
.
Stages in Character R
ecognition

The overall method of the sy
stem is illustrated in
fig.1 :




Fig.1: Overall model of s
ystem


2.1

Input Image

The input to the recognition system is given by

simply dragging

the mouse on the text screen.
T
he
black part of the image is considered as the character
and the white part

is considered as the paper

.


2.2

Feature Extraction and Preprocessing

Feature extraction is the process of extracting
essential information from the image segment
containing a character. It plays a important role in
the whole recognition process. This
effectively
reduces the number of computation and it reduces the
learning time in the training session of the neural
network and faster the recognition process.


2.3

Drawing Images

The process by which the user is allowed to draw the
characters on the com
puter screen is by using the
mouse dragging. It is an important as
pect of this
paper. Most of

actual drawing is handled by the
process

which is

called
as

MouseMotionEvent.

If the
mouse is being drug, then a line will be drawn from
the last position of the

mouse to the

current

position
.
By drawing the line, we can

cover any missing

pixels.
This is done with the following lines of code.


*/
The pixel map of what the user
has drawn.


* Used to downsample it.


protected int pixelMap[];


DrawingArea()


{
enableEvents(AW
TEvent.MOUSE_MOTION_EVE
NT_MASK|

AWTEvent.MOUSE_EVENT_MASK|


AWTEvent.COMPONENT_EVENT_MASK);


}


/*


* Setup the internal image that the user


* dr
aws onto.


*/


protected void initImage()


{


image1 = createImage(getWidth(),getHeight());


graphics1 = image1.getGraphics();


graphics1.setColor(Color.white);


graphics1.fillRect(0,0,getWidth(),getHeight());


}


/**


* Paint the drawn

image and cropping box


* (if active).

Down
-
sampling the Image: Every ti
me a letter is
drawn
, it must b
e down
-
sampled. Here

we will
examine the process by which the down
-
sampling
occurs.
When we
draw an image, the first thing the
program does; it draws
a box around the boundary of
the letter.

This allows the
program to eliminate all of
the white space around
the
letter. This process is
done inside of the down
-
sample method of the
Drawing area.java class
.

public void downSample()

{

int w =
image1.getWidth(this);

int h = image1.getHeight(this);


PixelGrabber grabber = new PixelGrabber(


30

|
P a g e


image1, 0, 0, w, h,

true);

t
ry {

grabber.grabPixels();

pixelMap = (int[])grabber.getPixels();

findBounds(w,h);

// now downsample

DisplaySData data =
displayS.getData();


ratioX=
(double)(cRight
-
cLeft)/(double)data.getWidth();

ratioY=(double)(cBottom
cTop)/(double)data.getHeight();

for ( int y=0;y<data.getHeight();y++ ) {

for ( int x=0;x<data.getWidth();x++ ) {

if ( downSampleQuadrant(x,y) )

data.setData
(x,y,true);

else

data.setData(x,y,false);// call to displayS data

}

}


After this code completes, the pixelMap variable,
which is an array of int datatypes, now contains the
bit pattern of the image. The next step is to crop the
image and if there is any
white space then remove it .
Cropping is done by dragging four imaginary lines
from the top, left, bottom and right sides of the
image. These lines will stop as soon it crosses the
actual pixel.

Performing the Down
-
sample: Now that the cropping
has taken

place, the image must be actually down
-
sampled. That involves taking the image from a
larger resolution to a 5X7 resolution. To see how to
reduce an image to 5X7, think of a imaginary grid

being drawn over top of the high
-
resolution image.
This divides t
he image into quadrants, five across and
seven down. If any pixel in a region is filled, then the
corresponding pixel in the 5X7 down
-
sampled image
is also filled and that is performed by the following
code.

protected boolean downSampleQuadrant(int x,int y
)

{

int w = image1.getWidth(this);

int startX = (int)(cLeft+(x*ratioX));

int startY = (int)(cTop+(y*ratioY));

int endX = (int)(startX + ratioX);

int endY = (int)(startY + ratioY);

for ( int yy=startY;yy<=endY;yy++ ) {

for ( int xx=startX;xx<=endX;xx++ ) {

int loc = xx+(yy*w);

if ( pixelMap[ loc ]!=
-
1 )

return true;

}

}

return false;

}

The downSampleRegion method accepts the region
number
that is going to

be calculated. First
ly

the
starting and ending x and y coordinates should be
calculated. To calculat
e the first x coordinate for the
specified region first the
downSampleLeft is used,
this is
the left side of the cropping rectangle. Then x
is multiplied by “ratioX”, which is the ratio of how
many pixels make up each quadrant. This allows us
to determine

where to place startX. The starting y
position, start Y, is calculated by similar means as the
earlier one . Next the program loops through every x
and y covered by the specified quadrant. If even one
pixel is determined to be filled, then the method
retu
rns true, which indicates that this region should
be considered filled. Otherwise it will be return as
false and the region will be considered as unfilled.

The class is a wrapper class that contains a 5X7 array
containing Boolean values. It is the struct
ure that
performs the input to both training and character
recognition method.


3
. Learning and Recognition

technique of the
character

(using Kohonen

Self Organization
Map)

The Kohenen network has two layer
s, an input layer
out
put layer and there is no

hidden layer present

The
input layer is a size determined by the user and

Should be match by the size of each row (pattern) of
the input data file. A kohonen layer is composed of
neurons that compete with each other. In kohonen
nerwork winner takes the
all strategy the input which
is nearer to it is declared as winner.the neuron with
largest output is called as winner the final neuron is
has output as 1. All other neurons have output 0 and
winner will only have output 1.


3.1

How a Kohonen Network Learns

We
have several steps in the learning process. The
overall process of training the Kohonen Neural
Network involves several steps until the the error of
the network is below the acceptance level. In
Kohonen Neural Network the training process is
competitive. W
e have only one “winning” neuron for
each training set. The weight of the winning neuron
is adjusted for more stronger reaction with the input
neuron next time. Learing Rate: the constant used by
the learning algorithm is called learning rate. It is a
posi
tive number which is less than 1. Larger the
value of the learning rate constant faster is the
training process.

Here another technique used is that
first start with a high learning rate and then decrease
the learning rate as the training progresses. Learn
ing
rate is just a variable used in the algogirthms that
adjusts the weights if the neurons.


3.2

Weight Adjustment

In Kohonen Neural Network, the weighted
connections between the input and the output neurons

31

|
P a g e


are the center for entire memory storage. At each
turn(epoc) the weights are adjusted.

Occurring of an
epoc takes place when the training data is presented
to the network and based on the result of this training
data the weights are adjusted. When the next epoc
occurs this adjustment of weights should pr
oduce a
network that yields a more favourable result.

As more
and more data is presented to the network, epocs
continues and the weights are adjusted accordingly.






4
. The Proposed Algorithm


4.1

Network Initialization

The initial weight W
i
(0) is to be
random for each
node I and the initial neighbouring node N
i
(0) is set
to a larger value.


4.2

Present Input

At this stage the input is fed in binary form i.e. 1 for
white pixel and 0 for black pixel. As a result, the
program defines 0.5 for white pixel and
-
0.
5 for black
pixel. In this way an array of 35 elements is created
which is fed to the input neurons. This will return the
winner neuron out of the 35 neurons and this is stored
in the “best” integer.

The winning node c is
calculated based on the activation

of the p neurons
participating in the competition using the formula:
C= maxΣW
ij
X
i

So the winner is decided according to the activation
energy of the neurons. The winning neuron or the
fired neuron has the final output of 1 and all other
neurons of the l
ayer has the output 0.


4.3

Weight Updation

Kohonen proposed a method also called “The
Additive Method” used for calculating the changes in
the weights.

The equation of the method is:



Here, x is the training vector.


w
t

is the weight of the winning neuron.


w
t+1

is the new weight.

The double vertical bars represent the vector length.


4.4

Training for Recognition

The program is trained for specific handwriting. For
training the neural network you can choose to start
from a blank training set and enter all 26 letters for
yourself.
For deleting a letter that has already been
listed you can press the “DELETE” button on the
application. To add a new letter draw the letter on the
drawing area and press “ADD” button and wri
te the
actual letter which you want to write in the prompt
box. This letter will be displayed when the
application recognizes the letter that you have just
drawn. After completing the training set you can save
it by clicking the “SAVE” button on the applic
ation.
This will save the training set to the file “sample.dat”.
To launch the application again you can click
the”LOAD” button to retrieve your previous

data
from the file sample.dat.


Fig. 2: Training and Recognition Process


5
.


Result

As the variabil
ity of the handwriting and the noise in
the data increases
, the complexity of the algorithm
also increases. A letter can be written in many ways
and the complexity increases especially when the
letter is to be written on the computer screen.


Fig. 3
: Diff
erent ways of writing a letter


Following table depicts the percentage and rate of
success of recognition of different characters shown
above:

Table 1



32

|
P a g e




6
. Conclusion

Character Recognition is a topic of great interest for
researchers working in this field. As the variability of
the handwriting and the noise in the data increases,
the complexity of the algorithm also increases. This
system has a significant rate of succe
ss of 75% to
80%. The variability of the hand written characters
depends upon the following factors: emotion, pen
pressure and environment; thus it is difficult to get
accuracy efficiently. Hence, it is more easy to
recognize the handwritten characters mor
e precisely
if a man uses standard writing rules, as the filtering
and feature extraction is done more accurately.



References

[1] O, Trier, A.K. Jain, T. Taxt. "Feature extraction
methods for

character recognition", pattern recognition, 29(4):
641
-
662,1996


[2] Vallu Rao, Hayagriva Rao, "C++ Neural
Networks and Fuzzy logic". International Edition,
1996

[3] Vuokko Vuori, Erkki Oja, "Analysis of different
writingsstyles with the self organizing
map". In
Proceedings of the 7
th

International Confere
nce on

neural information processing.
Vol. 2., 2000, pp
1243
-
1247. November 2000


[4] Davis, R.H., Lyall, "Recognition of hand written
character


A
review", Image and vision computing
4,4, (1986) 208
-
218


[
5
] U.Pal and B B Choudhuri, "Indian script charac
ter
recognition: A survey" Pattern Recognition, Vol 37, pp
1887
-
1899, 2004.


[6
] R.M.K.Sinha,“A journey from Indian scripts
processing to Indian language processing ", IEEE Ann.
Hist. Computer, vol 31, no 1, pp 831, 2009.


[
7
] N. Sharma, U. Pal, F. Kimur
a, and S. Pal,
"Recognition of offline hand
-
written Devanagari
characters using quadratic classifier," in Proc. Indian
Conference on Computer, Visionand Graphics , Image
Processing 2006, pp. 805
-
816.


[8
] P.S.Deshpande, L.Malik, S.Arora, "Fine
classificat
ion & recognition of hand written Devanagari
characters with regular expressions & minimum edit
distance method," J.

Comput., vol. 3, no. 5, pp.


11
-
17,2008.


[
9
] S.Arora, D.Bhatcharjee, M.Nasipuri, and L.Malik,
"A two stage classification approach for handwritten
Devanagari characters," in Proceedings of International
Conference on Computer Intelligence & Multimedia
Applications, 2007, pp. 399
-
403.