International Journal of Computer Applications (0975 – 8887) Volume 14– No.2, January 2011

Machine Recognition of Hand Written Characters using Neural Networks

Yusuf Perwej Ashish Chaturvedi Department of Computer Science Department of Applied Sciences Singhania University, Rajsthan, India Gyan Bharti Institute of Technology, Meerut, India

ABSTRACT applied to the image; then the feature of the character will be Even today in Twenty First Century Handwritten extracted from the image; finally, on the basis of extracted communication has its own stand and most of the times, in daily features from the image, the character can be classify to life it is globally using as means of communication and recognize using learning method for feed recording the information like to be shared with others. forward neural network. In next sections we explore the Challenges in handwritten characters recognition wholly lie in proposed hand written character recognition system step by step. the variation and distortion of handwritten characters, since Finally, in the last section results will be discussed which are different people may use different style of handwriting, and obtained from the system and conclusion will be made on the direction to draw the same shape of the characters of their basis of result obtained. known script. This paper demonstrates the nature of handwritten characters, conversion of handwritten data into electronic data, 2. PROPOSED HANDWRITTEN and the neural network approach to make machine capable of CHARACTER RECOGNITION SYSTEM recognizing hand written characters. The construction of Handwritten Character Recognition system consists of several phases. First phase is to preprocessing the Key Words: Machine recognition, Handwriting string of characters. Then second phase is to extract the features recognition, neural networks. from the string of characters. It is a very important phase. This method must very effective and efficient since 1. INTRODUCTION the extracted features will become the basis of recognition. Thus Handwritten characters are vague in nature as there may not the feature extraction will be done at the unit level i.e. for always be sharp perfectly straight lines, and curves not individual characters bounding boxes in the string and finally necessarily be smooth, unlikely the printed characters. the union operator can provide the sum of features for the string Furthermore, characters can be drawn in different sizes and of characters. These extracted features will then provided as orientation which are often supposed to be written on a baseline input patterns to neural networks system. Once the neural in an upright or downright position. Therefore, a robust network system has been trained for these input patterns, it will handwritten recognition system can be designed by considering be able to classify them. these limitations. However, it is quiet tedious sometimes to recognize hand written characters as it can be seen that most of 2.1 Preprocessing phase the people can not even read their own written notes. Therefore, In this phase each character in string is pre-processed. It deals there is an obligation for a writer to write clearly. But even with technique for enhancing contrast; removing noise and today in Twenty First Century Handwritten communication has isolating regions whose texture indicate a likelihood of its own stand and most of the times, in daily life it is globally character information. In preprocessing phase it is being using as means of communication and recording the information normalized and removing all redundancy errors from the like to be shared with others. character image and sends it to next stage of feature extraction. Researchers already paid many efforts in designing hand written The following preprocessing steps are followed here to make the character recognition system most of them cited as [1-5] because individual characters smooth and clear: of its important application like bank checking process, reading i) Firstly, the characters are cropped i.e. extra pixels are postal codes and reading different forms [6]. Handwritten digit removed from the character image. recognition is still a problem for many languages like Arabic, ii) Then, RGB characters image is converted into Gray scale Farsi, Chinese, English, etc [7]. A machine can perform more image. tasks than a human being in the same time; this kind of iii) After that, edges are finding out of the individual characters. application saves time and money and eliminates the iv) Extra holes fill up from the characters. requirement that a human perform such a repetitive task. For the v) Bounding Boxes are made up of all the individual characters recognition of English handwritten characters, various methods in the string of hand written characters. These boxes represent have been proposed [8-12]. Also a few numbers of studies have the area of individual character. We have tested our been reported for Farsi language [13-15]. experiment over hand written Hindi characters and their Proposed Hand written character recognition system for strings. machine recognition can be developed in these phases: scanning of hand written characters i.e conversion into electronic data, usually an black & white image file; some preprocessing can be

6 International Journal of Computer Applications (0975 – 8887) Volume 14– No.2, January 2011

uncorrelated variables called principal components. There are three reasons why PCA is an appropriate transformation method for the handwritten characters. Firstly, PCA as a linear transformation method is very simple. Secondly, the components of the transformed feature vector are statistically independent. Another reason for using PCA is that the feature components are ordered according to their importance. By removing the last some n components, the dimensionality of the feature vector may be reduced without losing too much information. The optimal value for n can be empirically determined for different applications. Suppose (feature vector) of train data are P1, P 2, P 3…..P N. 1 N (1) A = ∑ Pn N n=1

X j = Pj − A1 < j < N (2)

Y = X 1 X 2 ...... X N (3) Where A is the mean vector, Xi is the difference between feature vector and the mean vector and Y matrix is determined by Equation (3). Covariance Matrix is M×M matrix that is represented in Equation (4); M is the dimension of feature vector N 1 T 1 T (4) A = ∑ X n X n = YY Figure 1 representing Bounding area of a N n=1 N character In this paper, first pictures are mapped in to center of a zero matrix. Then all of pictures are the same size. The component of 2.2 Feature Extraction Phase characteristic Loci features was calculated. Then a few number Transforming the input data into the set of features is called of PCA component was selected in those. These feature vector features extraction. Feature extraction is a special characteristic are transform matrices. These reduced vectors are given to of dimensionality reduction methods. Analysis with a large neural network. By this method feature vector is reduced and number of variables generally requires a large amount of large computational is decreased. memory and computation power or a classification algorithm, which over fits the training sample and generalizes poorly to 2.3 Back propagation based Neural new samples. When the input data is too large to be processed network recognition system then the input data will be transformed into a reduced The back-propagation algorithm is a gradient descent method representation set of features. Obviously, it is important to select minimizing the mean square error between the actual and target type of feature extraction method because it is the important, output of a multilayer . Assuming sigmoidal nonlinear factor in the performance of systems [16]. function Selection type of feature extraction is dependent on the 1 application. Different features are purposed to recognize hand f ()net = (5) written digits and characters. They are Furies Transform, i 1− e −net Invariant Moments, Geometric Moments, Characteristic Loci The back-propagation algorithm consists of the following steps: and others [17]-[22]. In this paper we are using Characteristic Loci to recognize handwritten characters. I. Initialize Weights and Offsets It is already been established that the Characteristic Loci Feature Initialize all weights and node offsets to small random values. extraction method gives good results in handwritten digit II. Present Input and Desired Output Vector recognition [23]. Characteristic Loci Feature extraction method Present continuous input vector x and specify the desired output is commonly in vertical, horizontal and 45 or 135 degree d. Output vector elements are set to zero values except for that orientations. A digit is related to each point of picture. This digit corresponding to the class of the current input. is dependent on the number of contacts along four directions, up, III. Calculate Actual Outputs down, left and right. This feature vector has 81 components that Calculate the actual output vector y using the sigmoidal each of them is relative amplitude of the specified digit in the nonlinearity. picture. To normalize this, it can be divided to the number of IV. Adapt weights black pixels. Adjust weights by One of the most important transform to reduce dimensionality ' for simple and fast data processing and picture classification is wij (t + )1 = wij (t) +ιδ j xi (6) Principal component analysis (PCA). Now it is mostly used as a where is the output of the node i and is the sensitivity of the tool in exploratory data analysis and for making predictive node j. If node j is an output node, then models. It involves a mathematical procedure that transforms a number of possibly correlated variables into a smaller number of δ j = f ′(net j )(d j − y j ) (7)

7 International Journal of Computer Applications (0975 – 8887) Volume 14– No.2, January 2011 where dj is the desired output of the node j, yj is the actual a) The input pattern file output and is the derivation of the calculated b) No. of neurons in each hidden at netj. If the node j is an internal node, then the sensitivity is c) Value of learning rate defined as d) Value of momentum constant e) Error value for convergence δ = f ′(net ) δ w (8) j j ∑ k jk The output of training program is a file which contains modified k weights of different connection of the network. This file is used where k sums over all nodes in the layer above the node j. as the input to testing program. This file also contains the values Update equations are derived using the chain derivation rule of numbers of neurons in input layer, Hidden layers, output applied to the LMS training criterion function. Convergence can layer, value of learning rate and momentum factor so that user is be faster if a momentum term is added and weight changes are no further required to re-enter these values during testing. smoothed by After the completion of the training phase, a test pattern is given ' wij (t + )1 = wij (t) +ιδ j xi + α[wij (t) − wij (t − )1 ](9) to the neural network and the results are compared with the Characters string No. of samples No. of No. of No. of epochs % for training samples hidden Recognition for units Accuracy testing 100 25 30 700 92.0

140 25 36 888 95.0

120 25 36 920 91.2

90 25 36 799 98.5

140 25 48 1010 88.0

140 25 54 1200 94.5

120 25 60 1112 96.0

100 25 54 1220 90.1

130 25 60 1030 96.5

95 25 60 990 93.4

desired result. Difference between the two values gives the V. Repeat by Going to Step 2 error. Percentage accuracy can be obtained as: The program based on the back propagation algorithm as described above, trains the network to recognize the handwritten % Accuracy = No of characters found correctly *100 characters. This network takes input-output vector pairs during Total no of patterns training. The network trains its weight array to minimize the selected performance measure, i.e., error using back propagation algorithm. Our designed neural network system takes following as inputs from the user:

8 International Journal of Computer Applications (0975 – 8887) Volume 14– No.2, January 2011

3. RESULTS & DISCUSSION [7] S. Impedovo, P. Wang, and H. Bunke 1997. First of all, training of system is done by using different data set Automatic Bankcheck Processing. World Scientific, Singapore, or samples and then system is tested for few of the given [8] CL Liu, K Nakashima, H Sako and H. Fujisawa. 2003. samples, and accuracy is measured. The data set was partitioned Benchmarking of state-of- the-art techniques. Pattern into two parts. The first part is used for training the system and Recognition, vol. 36, no 10, 2271– 2285. the second was for testing purpose. For each character, feature [9] M. Shi, Y. Fujisawa, T. Wakabayashi and F. Kimura were computed and stored for training the network. Following 2002. Handwritten numeral recognition using gradient and parameters are used for training of our Neural Network system: curvature of gray scale image. Pattern Recognition, vol. 35, no. No. of neurons in Input Layer: 6 10, 2051–2059. No of neurons in Hidden Layer: 8 [10] LN. Teow and KF. Loe 2002. Robust vision-based Transfer Function Used for Layer 1: “Logsig” features and classification schemes for off-line handwritten digit Transfer Function Used for Layer 2: “Tansig” recognition. Pattern Recognition, vol. 35, no. 11, 2355–2364. Adaption Learning Function: “Learngdm” [11] K. Cheung, D. Yeung and RT. Chin, “A Bayesian Performance Function: “MSE” framework for deformable pattern recognition with application The table given below display the results obtained from to handwritten character recognition,” IEEE Trans experiment. PatternAnalMach Intell, vol. 20, no. 12, pp. 382–1388, Dec. As we can observe from the table that as we increase the number 1998. of units in hidden layer, network converges with more accuracy [12] IJ . Tsang, IR. Tsang and DV Dyck 1998. Handwritten and this can be seen for the whole pattern. The recognition character recognition based on moment features derived from accuracy rate is very up to the mark and as per our predictions. image partition. In Int. Conf. image processing, vol. 2, 939–942. The experiment shows that the string of handwritten characters [13] H. Soltanzadeh and M. Rahmati 2004. Recognition of can be recognized by the machine with a significant accuracy. Persian handwritten digits using image profiles of multiple orientations. Pattern Recognition Letters, vol. 25, no. 14, 1569– 1576, Oct. 4. CONCLUSION [14] FN. Said, RA. Yacoub and CY Suen 1999. We have proposed and developed a scheme for recognizing Recognition of English and Arabic numerals using a dynamic hand written characters. We have tested our experiment over number of hidden neurons. In Proc. 5th Int. Conf. document Hand written Hindi characters and the strings of these Hand analysis and recognition, 237–240. written characters. Experimental results shown that the machine [15] J. Sadri, CY. Suen, and TD. Bui. 2003. Application of has successfully recognized the characters string with the support vector machines for recognition of handwritten average accuracy of 93.5%, which significant and may be Arabic/Persian digits. In Proc. 2th Iranian Conf. machine vision acceptable in some applications. The experiment shows as we and image procesing, vol. 1, 300–307. have increased the number of hidden units in hidden layers, the [16] ID. Trier and AK. Jain. 1996. Feature Extraction network converges with more accuracy. In future the similar Methods for Character Recognition- A Survey,” Pattern experiment can be tested over some other characters and with Recognition, vol. 29, no. 4, 641- 662. some more or new parameters to improve the accuracy of the [17] H. Takahashi 1991. A Neural Net OCR using machine. geometrical and zonal pattern features. In Proc. 1th. Conf. Document Analysis and Recognition, 821-828. 5. REFERENCES [18] L.O. Jimenez, A. Morales-Morell and A. Creus 1999. [1] H. Al-Yousefi and S. S. Udpa 1988. Recognition of Classification of Hyperdimensional Data Based on Feature and handwritten Arabic characters. In Proc. SPIE 32 nd Ann. Int. Decision Fusion Approachs Using Projection Pursuit, Majority Tech. Symp. Opt. Optoelectric Applied Sci. Eng. (San Diego, Voting, and Neural Networks. IEEE Trans. on Geoscience and CA), Aug. Remote Sensing, vol. 37, no. 3. [2] K. Badi and M. Shimura 1982. Machine recognition of [19] Y. Li. 1992. Reforming the theory of invariant Arabic cursive script. Trans. Inst. Electron. Commun. Eng., Vol. moments for Pattern recognition,” Pattern Recognition Letters, E65, no. 2, pp. 107-114, Feb. vol. 25, no. 7, 723-730. [3] M Altuwaijri , M.A Bayoumi 1994. Arabic Text [20] H.A. Glucksman 1997. Multicategory of Patterns Recognition Using Neural Network. ISCAS 94. IEEE Represented by High-Order Vectors of Multilevel Measurement. International Symposium on Circuits and systems, Volume 6. IEEE Transaction Computer, vol. C-20, no. 12, 1593-1598. [4] C. Bahlmann, B. Haasdonk, H. Burkhardt. 2002. [21] Sh. Shahreza, M.H. Khotanzad, A. 1994. Recognition Online Handwriting Recognition with Support Vector Machine Letterpress Works Independent of Size and Displacement with – A Kernel Approach. In proceeding of the 8th Int. Workshop in Zernike Moments and Neural Networks. In Proc. 2th Iranian Handwriting Recognition (IWHFR), 49-54, Conf of Electrical Engineering, Trbiat modares Univ, vol. 5, [5] Homayoon S.M. Beigi. 1993. An Overview of 417-424. Handwriting Recognition. Proceedings of the 1 st Annual [22] K. Azmi, R. Kabir and E. Badi 2003. Recognition Conference on Technological Advancements in Developing Printed Letters wit Zonong Features. Iran Computer Group, vol. Countries, Columbia University, New York, 30-46. 1, 29-37. [6] Nadal, C. Legault, R. Suen and C.Y. 1990. [23] S.H. Nabavikahrizi, R. Ebrahimpour and E. Kabir. Complementary Algorithms for Recognition of totally 2004. Application of Combining classifiers for Recognition of Unconstrained Handwritten Numerals. In Proc. 10th Int. Conf. Farsi handwritten digits. In Proc. 3th Iranian Conf. Machine Pattern Recognition, vol. 1, 434-449. vision and image processing, , vol. 1, 115–119.

9