You are on page 1of 6

INTERNATIONAL JOURNAL OF ELECTRICAL, ELECTRONICS AND COMPUTER SYSTEMS, VOLUME X, ISSUE X, MONTH 20XX

Devanagari Handwritten Numerals


Recognition through foreground sub-sampling
Mahesh Jangid, Renu Dhir and Rajneesh Rani

Abstract— Recognition of Indian languages scripts is challenging problems. In Optical Character Recognition [OCR], a
character or symbol to be recognized can be machine printed or handwritten characters/numerals. There are several
approaches that deal with problem of recognition of numerals/character depending on the type of feature extracted and different
way of extracting them. In this paper an automatic recognition system for isolated Handwritten Devanagari Numerals is
proposed. We presented a feature extraction technique based on recursive subdivision of the character image so that the
resulting sub- images at each iteration have balanced numbers of foreground pixels as possible. Support Vector Machine (SVM)
is used for classification. Accuracy of 98.98% has been obtained by using standard dataset provided by ISI (Indian Statistical
Institute) Kolkata

Index Terms— Devanagari Numeral, pattern Recognition, foreground sub-sampling, SVM.

1 INTRODUCTION

O PTICAL character recognition is a field of


automatic recognition of different charac-
ters from a document image. This field is
In the literature survey we found that
numbers of authors have attempted to recognize
the Handwritten Devanagari Numerals with
divided into two parts one is recognition of ma- different-2 techniques. G S Lehal and Nivedan
chine printed characters and second is recogni- Bhatt [5] have proposed a contour extraction
tion of handwritten characters. Now a day‟s, technique and obtained 89% accuracy. Reena
recognition of handwritten characters is very Bajaj et al. [6] have employed three different
challenging task because different people have kinds of feature namely, density features, mo-
different handwriting styles. So, handwritten ment features and descriptive features for classi-
OCR is still a subject of active research. fication of Devanagari Numerals and obtained
Devanagari script is the most widely 89.68% accuracy. R J Ramteke et al [7] have pro-
used Indian script and round 500 million people posed a method based on invariant moments
use it. Recognizing Handwritten Numerals have and the divisions of image for the recognition of
numerous applications including those in postal numerals and achieved 92% accuracy. U.
sorting, bank cheque processing, job application Bhattacharya et al. [8] have used a combination
form sorting and automatic scoring of tests con- of ANN (Artificial Neural Network) and HMM
taining multiple choice questions. (Hidden Markov Model) classifier on 16273
Techniques used in OCR system follow samples of Handwritten Devanagari Numerals
mainly two steps (a) a feature vector is form and obtained 95.64% accuracy. N Sharma et al.
from character image (b) classify the feature vec- [9] have proposed a quadratic qualifier based
tor into classes. The feature extraction method technique and used 22546 samples for his exper-
plays very important role to achieve high accu- iment and achieved 98.86% accuracy.
racy. So the feature extraction algorithm must be The technique proposed in this
capable to generate similar feature sets for a va- paper is first time applied on the Devanagari
riety of instance of the same symbol. Ivind and Numerals. Feature extraction method based on
jain [1] present a survey of various feature ex- structure of the character image and the topolog-
traction methods used in character recognition. ical and geometrical properties of the character.
On the other hand, choice of classifier, to dis- In this work, the idea of recursive subdivision of
criminate given features, is not an easy task be- the handwritten character image as in [10, 13,
cause of classifier depends on training set, num- and 14] is used as a way of extracting the fea-
ber of free parameters, etc. tures which are based on different levels of
granularity. At each level, features are extracted
———————————————— based on the point, at the intersection of the hor-
 Mahesh Jangid is with the Department of CSE, Dr. B R Ambedkar NIT, izontal and vertical lines, which divides the
Jalandhar (India) 144011. E-mail: mahesh_seelak@yahoo.co.in. handwritten character image into four sub-
 Renu Dhir is with the Department of CSE, Dr. B R Ambedkar NIT, Jalan-
dhar (India) 144011. E-mail: dhirr@nitj.ac.in. images that consist of about the same amount of
 Rajneesh Rani is with the Department of CSE, Dr. B R Ambedkar NIT, foreground pixels. The process of division of the
Jalandhar (India) 144011. E-mail: ranir@nitj.ac.in. image gives 4, 16… sub-images. Initially at each

© 2011 IJEECS
http://www.ijeecs.org
level, the feature is calculated and then recogni- Table 1: Distribution of numerals in Devanagari
tion rate is calculated at each level, choose the Database
level at which the highest recognition rate is Digits Training Set Test Set Total
achieved. 0 1844 369 2213
1 1891 378 2269
2 DATABASE 2 1891 378 2269
3 1882 377 2259
The database is provided by the ISI (Indian 4 1876 376 2252
Statistical Institute, Kolkata) [15]. Initially Deva-
5 1889 378 2267
nagari script was developed to write Sanskrit
6 1869 374 2243
but was later adapted to write many other lan-
7 1869 378 2247
guages such as Hindi Marathi and Nepali. The
8 1887 377 2264
printed Devanagari Numerals are shown in fig-
ure 1 and it is seen that there are variations in 9 1886 378 2264
the shapes of numerals 5, 8 and 9 in their printed 18784 3763 22547
forms. In figure 2, there are shown the samples 3.1 Preprocessing
of the Handwritten Devanagari Numerals data-
i) Adjust image intensity values of the image
base. The distributions of training data and test-
using imadjust () function of Matlab.
ing data are shown in table 1.
ii) Convert the image into binary image by
choosing threshold value 0.8.
iii) Remove from a binary image all connected
components (objects) that have fewer than 30
pixels
iv) Apply median filtering, is a nonlinear opera-
tion often used in image processing to reduce
Figure 1: Devanagari Numerals
"salt and pepper" noise
v) Normalized the image into 90*90

3.2 Feature Extraction Algorithm


Suppose that im(x, y) is a handwritten character
image in which the foreground pixels are denot-
ed by 1‟s and background pixels are denoted by
0‟s. Feature extraction algorithm sub-divided
the character image recursively. At granularity
level 0 the image divided into four parts and
gives a division point (DP) (x0, y0). The following
algorithm shows that how x0 calculated and
likewise y0.
Algorithm:
Step 1: input im (xmax, ymax) character image.
Step 2: Let v0 [ymax] be the vertical projection of
image (fig 3.b)
Step 3: Create v1 [2*ymax] array by inserting a „0‟
Figure 2: Handwritten Devanagari Numerals before each element of v0 (fig 3.c)
Samples Step 4: Find xq in v1 that minimizes the differ-
ence between the sum of the left parti-
tion [1, xq] and the right partition
3 FEATURE EXTRACTION [xq,2*xmax] or left partition should be
greater than right if not able to equally
The entire database is gray scale image that con-
divided.
tains noise and is not normalized form. All ex-
Step 5: x0=xq/2;
periments have done on Matlab 7.10.0.

2
at particular level and drawn a graph (figure-6)
Step 6: if xq mod 2 = 0 that shows the level of granularity and the
2 sub-images are recognition rate. By the help of graph examine
[(1, 1), (x0, ymax) and (x0, 1), (xmax, ymax)] the highest recognition rate at corresponding
Else level (L best).
2 sub-images are [(1, 1), (x0, ymax) and
(x0+1, 1), (xmax,ymax)]

Figure 4 : Example where the xq mod 2 = 1

Figure 3(a) Vertical division of an image array


(xmax=8, ymax=8) (b) vertical projection of image
(c) v1 created from v0 to calculate xq

Figure 3 shows the vertical division of


handwritten character image where the xq=10
and x0=5 and mod of 10 is 1 than the co-ordinates Figure 5: Devanagari Handwritten Numeral 4
of two sub-images are [(1,1),(5,8)] and segmentation at Level 0, 1, 2 shown in corrpond-
[(5,1),(8,8)]. Another example of an image have ing (A) (B) and (C)
the xq mod 2 = 1 is demonstrated in figure 4.
The number of sub-images, at the speci- (ii) Recognition phase
fied granularity level (L) is 4(L+1). Let L=0 the After the examining the best level of granularity,
number of sub-images are four and when the Test dataset feature, extracted at L best, is fed to
L=1 it is 16. The number of DP (division point) the classifier. The classifier recognizes the test
equals to 4L. All the DP (xi, yi) are stored. 2*4L dataset by the help of training dataset.
dimensional feature vector is extracted at a level
L.
All feature vectors are scaled to (0, 1).
By the help of normalized dimension value in
our case it is 90. All the co-ordinates of feature
vector are divided by 90.

f”= f/90 (1)

3.3 Classification
Classification step is divided into two phases.
(i) Training phase
In this phase, gradually increase the higher lev-
els of granularity starting with level 1, features
are extracted. The recognition rate is calculated Figure 6: Example finding the best level ( Lbest )

3
4 CLASSIFIER (SVM)
In classification we use a voting strategy: each
Support Vector Machine is supervised Machine
binary classification is considered to be a voting
Learning technique. The existence of SVM is
where votes can be cast for all data points x - in
shown in figure 5. It is primarily a two class
the end a point is designated to be in a class with
classifier. Width of the margin between the clas-
the maximum number of votes. In case that two
ses is the optimization criterion, i.e. the empty
classes have identical votes, though it may not
area around the decision boundary defined by
be a good strategy, now we simply choose the
the distance to the nearest training pattern. The-
class appearing first in the array of storing class
se patterns called support vectors, finally define
names.
the classification function.
LIBSVM is used with Radial Basis Func-
Computer tion (RBF) kernel, a popular, general-purpose
Vision yet powerful kernel, denoted as

K (xi, xj) ≡ exp (-γ||xi-xj||2) (2)


Artificial
Intelligence Now a search is applied to find the val-
ue of γ which is parameter of RBF as like find
the value of c that is cost parameter of SVM us-
Pattern Machine Robotics Natural ing cross-validation. The value of both variance
Language
Recognition Learning
Processing
parameters are firstly select in the range of (0, 2]
and (0, 1000] and examines the recognition rate.
Unsuper- Supervised Semi su- Reinforce-
vised
Learning
pervised ment 5 EXPERIMENTS AND RESULTS
Learning Learning Learning
In order to classify the handwritten numeral and
evaluate the performance of the technique, we
Clustering Support
Vector
have carried out the experiment by setting vari-
Machine ous parameter examples Lbest, gamma, and cost
parameter. All experiments was performed on a
Figure 6 Intel® core 2 duo CPU T6400 @ 2GHz with 3 GB
RAM under 32 bit windows 7 Ultimate operat-
All the experiments are done on LIBSVM ing system.
3.0.1[20] which is multiclass SVM and select RBF
(Redial Basis Function) kernel. A feature vector Experiment 1:
set fv(xi) i=1…m, where m is the total number The training set of Devanagari Handwritten
of character in training set and a class set cs(yj) Numerals provided by ISI, Kolkata contains
j=1…m , cs(yj) ϵ { 0 1 ….9} which defines the class of 18784 samples used to determinate the best
the training set, fed to Multi Class SVM. granularity level. Here to recognition accuracy
LIBSVM implements the “one against at different granularity level used cross valida-
one” approach (Knerr et al .., 1990) [16] for mul- tion function of LIBSVM with n=10 and set the γ
ti-class classification. Some early works of ap- =0.5 and c=500. The recognition accuracy at dif-
plying this strategy to SVM include, for exam- ferent-2 granularity level shows in fig 7. At level
ple, Kressel (1998) [17]. If k is the number of 3, the highest accuracy 98.98 obtained.
classes, then k (k-1)/2 classifiers are constructed
and each one trains data from two classes. For Experiment 2:
training data from the ith and jth classes, we solve After obtaining the best granularity level by ex-
the following two class classification problem: periment 1, train the LIBSVM by ISI training set.
The size of feature vector is 170 (2*4L –
2*40+2*41+2*42+2*43). Some granularity level
applies on the test data to form the feature vec-
tor and obtained the 98.40 % accuracy when
values of γ, c set to 1.1 and 500. Confusion ma-
trix (Table 2 in bold latter) shows that 2 con-

4
fused with 3 and 4 confused with 5 as 7 with 6 Table 4: Comparison of accuracy obtained by
and the highest recognition rate is 99.73% for 8. different methods
Computation time taken by the training phase S.n Method proposed Data Accuracy
and testing phase is shown in table 3. by Size Obtained

1 R. Bajaj et al [6] 400 89.6 %

2 R. J. Ramteke et al 169 92.68 %


[7]
3 U. Bhattacharya et 16274 95.64 %
al. [8]
4 N. Sharma et al. 22,546 98.86 %
[9]
5 Proposed System 22,547 98.98 %

6 CONCLUSION & FUTURE WORK


Figure 7: Define the best level for accuracy In the literature, the many techniques for recog-
nition of Devanagari Handwritten Numerals
have been suggested. In this paper an effort
Table 2: Confusion Matrix at γ, c set to 1.1 and make towards recognition of Devanagari Nu-
500 merals and obtained 98.98% on the database,
which have approximately all the variation oc-
curred in handwritten numerals, provided by
ISI, Kolkata.
This technique is very successful for the
Devanagari Handwritten Numerals and this can
be extended to the recognition of Devanagari
Character. As we have seen in confusion matrix
shown in table 2, the 2 is confused with 3 and 4
is confused with 5 so we can improve this for
decreasing error rate.

REFERENCES
[1] Ivind due trier, anil Jain, torfiinn Taxt, “A feature
Table 3: Computational time (Feature Extracted extraction method for character recognition-A
at level 3) survey “, Pattern Recg, vol 29, No 4, pp-641-662,
Phase Sample size Time Required 1996
Training 18784 66 seconds [2] Sandhya Arora, Debotosh Bhattacharjee, Mita Na-
Testing 3763 15 seconds sipuri, D. K. Basu, M. Kundu, “ Recognition of
Non-Compound Handwritten Devnagari Characters
using a Combination of MLP and Minimum Edit
Distance”, International Journal of Computer Sci-
Experiment 3:
ence and Security (IJCSS),Volume (4) : Issue-1 pp
Test dataset and training dataset combined to
107-120.
perform the cross validation function of LIBSVM
[3] P M Patil, T R Sontakke,” Rotation, scale and transla-
with n=10 and set the γ =0.5 and c=500. Features
tion invariant handwritten Devanagari numeral
vector for whole dataset (22547) is calculated at
character recognition using general fuzzy neural
level 3 (Lbest) and obtained 98.98% recognition
network”, Pattern Recognition, Elsevier, 2007.
rate.

5
[4] Anil K. Jain, Robert P.W. Duin, and Jianchang Mao, A. J. Smola, editors, Advances in Kernel Methods {
“Statistical Pattern Recognition: A Review”, IEEE Support Vector Learning, pages 255{268, Cambridge,
Transactions on Pattern Analysis and Machine Intel- MA, 1998. MIT Press.
ligence, Vol. 22, No. 1, pp- 4-37, January 2000. [18] http://www.csie.ntu.edu.tw/~cjlin/libsvm
[5] G S Lehal and Nivedan Bhatt, “A Recognition Sys- [19] http://www.csie.ntu.edu.tw/~cjlin/papers/libsvm.
tem for Devnagri and English Handwritten Numer- pdf
als”, Proc. Of ICMI, 2000. [20] http://www.isical.ac.in/~ujjwal/download/databa
[6] Reena Bajaj, Lipika Day, Santanu Chaudhari, “De- se.html.
vanagari Numeral Recognition by Combining Deci-
sion of Multiple Connectionist Classifiers”, Sadhana,
Mahesh Jangid is an M.Tech. Student in computer sci-
Vol.27, Part-I, 59-72, 2002. ence & engineering department of Dr. B R Ambedkar
[7] R.J.Ramteke and S.C.Mehrotra, “Recognition Hand- National Institute of Technology.He has completed his
written Devanagari Numerals”, International journal B.E. degree in 2007 from Rajasthan University.He has the
of Computer processing of Oriental languages, 2008. 2 year teaching experience from JECRC Jaipur. His re-
search area is image processing, optical character recog-
[8] U. Bhattacharya, S. K. Parui, B. Shaw, K. Bhattachar- niton, pattern recognition.
ya, “Neural Combination of ANN and HMM for
Handwritten Devnagari Numeral Recognition”. Renu Dhir has done her Ph.D in computer science and
[9] U. Pal, T. Wakabayashi, N. Sharma and F. Kimura, engineering from Punjabi University in 2007 and M.Tech.
in computer science & engineering from TIET Patiala in
“Handwritten Numeral Recognition of Six Popular 1997.Her area of research is mainly image processing
Indian Scripts”, Proc. 9th ICDAR, Curitiba, Brazil, and character recognition. She has published more than
Vol.2 (2007), 749-753. 35 papers in various international journals and confereces
Now she is working as a Associate Professor in NIT Jal-
[10] J. Park, V. Govindaraju, S. N. Shrihari, ''OCR in Hi-
andhar.
erarchical Feature Space'', IEEE Transactions on Pat-
tern Analysis and Machine Intelligence, 2000, Vol. Rajneesh Rani is doing Ph.D. from NIT Jalandahar. She
22, No. 24, pp. 400-408. has completed her M.Tech in computer science and engi-
neering from Punjabi University, Patiala in 2003.She has
[11] Samet H, “The Design and Analysis of Spatial Data 7 year of teaching experience. Her area of research is
Structures", Addison-Wesley Longman Publishing image proceesing and character recognition.
Co., Inc., 1990.
[12] S. Mozaffari, K. Faez, M. Ziaratban, "Character Rep-
resentation and Recognition using Quadtree-based
Fractal Encoding Scheme ", Proceedings of the 8th
International Conference on Document Analysis and
Recognition, Seoul, Korea, 2005, Vol.2, pp. 819-823.
[13] A. P. Sexton, V. Sorge, "Database-Driven Mathemat-
ical Character Recognition", Graphics Recognition,
Algorithms and Applications (GREC), Lecture Notes
in Computer Science (LNCS), Hong Kong, 2006, pp.
206-217.
[14] Georgios Vamvakas, Basilis Gatos, Stavros J. Peran-
tonis,” Handwritten character recognition through
two-stage foreground sub-sampling”,” Pattern
Recognition,” 43 (2010) 2807–2816
[15] U. Bhattacharya and B.B. Chaudhuri, “Databases for
Research on Recognition of Handwritten Characters
of Indian Scripts,” Proc. Eighth Int‟l Conf. Document
Analysis and Recognition (ICDAR ‟05), vol. 2, pp.
789-793, 2005.
[16] S. Knerr, L. Personnaz, and G. Dreyfus. Single-layer
learning revisited: a stepwise procedure for building
and training a neural network. In J. Fogelman, edi-
tor, Neu-rocomputing: Algorithms, Architectures
and Applications. Springer-Verlag, 1990.
[17] U. H.-G. Kressel. Pairwise classication and support
vector machines. In B. Scholkopf, C. J. C. Burges, and

You might also like