Search. Read. Cite.

Easy to search. Easy to read. Easy to cite with credible sources.

Journal of Computer Science

Year: 2009  |  Volume: 5  |  Issue: 6  |  Page No.: 427 - 434

Digital Recognition using Neural Network

Saleh Ali K. Al-Omari, Putra Sumari, Sadik A. Al-Taweel and Anas J.A. Husain


Problem statement: Handwriting number recognition is a challenging problem researchers had been research into this area for so long especially in the recent years. In our study there are many fields concern with numbers, for example, checks in banks or recognizing numbers in car plates, the subject of digit recognition appears. A system for recognizing isolated digits may be as an approach for dealing with such application. In other words, to let the computer understand the Arabic numbers that is written manually by users and views them according to the computer process. Scientists and engineers with interests in image processing and pattern recognition have developed various approaches to deal with handwriting number recognition problems such as, minimum distance, decision tree and statistics. Approach: The main objective for our system was to recognize isolated Arabic digits exist in different applications. For example, different users had their own handwriting styles where here the main challenge falls to let computer system understand these different handwriting styles and recognize them as standard writing. Result: We presented a system for dealing with such problem. The system started by acquiring an image containing digits, this image was digitized using some optical devices and after applying some enhancements and modifications to the digits within the image it can be recognized using feed forward back propagation algorithm. The studies were conducted on the Arabic handwriting digits of 10 independent writers who contributed a total of 1300 isolated Arabic digits these digits divided into two data sets: Training 1000 digits, testing 300 digits. An overall accuracy meet using this system was 95% on the test data set used. Conclusion: We developed a system for Arabic handwritten recognition. And we efficiently choose a segmentation method to fit our demands. Our system successfully designs and implement a neural network which efficiently go without demands, after that the system are able to understand the Arabic numbers that was written manually by users.

Fig. 1: Examples of different shapes in number 4

Fig. 2: Scenario of number recognition with artificial neural network

A finally approach was presented by WESTALL in order to use the neural networks in the system of the decision logic for the handwritten numerals segmentation. This approach has been successfully implemented in a commercial system that is internationally used in the recognition of hand written amounts on personal bank checks; computer-based recognition of unconstrained hand written fields within scanned images of financial documents has three steps. The first step is the field identification that supplies the location within the image of the typically rectangular region of interest that consists of the target field. The second step, an identification must be performed by the segmentation of the group of pixels compressing each numeral of the field. The third step is to classify the numerals that are extracted by segmentation[8].

Framework: There are many fields concern with numbers, for example, checks in banks or recognizing numbers in car plates, the subject of digit recognition appears. A system for recognizing isolated digits may be as an approach for dealing with such application. In other words, to let the computer understand the Arabic numbers that is written manually by users and views them according to the computer, we present a way to recognize isolated Arabic digits exist in different applications. For example, different users have their own handwriting styles where here the main challenge falls to let computer system understand these different handwriting styles and recognize them as standard writing. Figure 1 shows some examples of different user-handwritten.and in Fig. 2 the scenario of number recognition with Artificial Neural Network Which contains input and hiding layer and output with the number (4) for examination the Network.

Fig. 3: A general diagram for Arabic digit recognition system

System components: ADR it is a group of Arabic number (0-9) handwritten, the numbers will be given to the system handwritten in a different styles, sizes and possible orientations. And also the system consists of five components Fig. 3.


There are four steps to build the isolated digits recognition system. These steps are presented on Fig. 3 and below are the descriptions of them:

Image acquisition: We will acquire an image to our system as an input .this image should have a specific format, for example, bmp format and with a determined size such as 30x20 pixels. This image can be acquired through the scanner or, digital camera or other digital input devices[9].

Preprocessing: After acquiring the image, it will be processed through sequence of preprocessing steps to be ready for the next step.

Noise removal: reducing noise in an image. For on-line there is no noise to eliminate so no need for the noise removal. In off-line mode, the noise may come from the writing style or from the optical device captures the image[10].

Normalization-scaling: standardize the font size within the image. This problem appears clearly in handwritten text, because the font size is not restricted when using handwriting.

Thinning and skeletonization: Representing the shape of the object in a relatively smaller number of pixels[9]. Thinning algorithms can be parallel or sequential. Parallel is applied on all pixels simultaneously. Sequential examine pixels and transform them depending on the preceding processed results.

Segmentation: Since the data are isolated, no need for segmentation. With regards to the isolated digits, to apply vertical segmentation on the image containing more than digit will isolate each digit alone.

Normalization scaling and translation: Handwriting produces variability in size of written digits. This leads to the need of scaling the digits size within the image to a standard size, as this may lead to better recognition accuracy. We tried to normalize the size of digit within the image and also translate it to a specific position by the following.

Feature extraction: Feature extraction is not part of this project. Feature types are categorized as follows:

Structural features: It describes geometrical and topological characteristics of a pattern by representing its global and local properties
Statistical features: Statistical features are derived from the statistical distribution of pixels and describe the characteristic measurements of the pattern
Global transformation: Global transformation technique transforms the pixel representation to a more compact form. This reduces the dimensionality of the feature vector and provides feature invariants to global deformation like translation, dilation and rotation

Classification and recognition: Neural Network is a network of non-linear system that may be characterized according to a particular network topology. Where, this topology is determined by the characteristics of the neurons and the learning methodology. The most popular architecture Of Neural Networks used in Arabic digits recognition takes a network with three layers. These are: Input layer, hidden layer and output layer. The number of nodes in the input layer differs according to the feature vector’s dimensionality of the segment image size.

Fig. 4: Two layers network, one hidden and one output, with 50, 10 neurons respective

In the hidden layer the number of nodes governs the variance of samples which can be accurately and correctly recognized by this Network. In our system project, the data will be divided using neural networks. In addition, we use the algorithm of back propagation[11].

Algorithm code: Commonly neural networks are trained, so that a particular input leads to a specific target output. There, the network is adjusted, based on a comparison of the output and the target, until the network output matches the target. In both networks we applied feed forward back propagation neural network algorithm.

The first network (two layers) shown in Fig. 4 is consisted of an input layer P1 of a vector of 600 inputs and an input weights IW1,1 of 50×600 and b1 a vector bias with 50 biases connecting the input vector with the hidden layer which consist of 50 neurons. n1 = IW1,1 P1+ b1 represents the input for the 50 neurons of the hidden layer. a1 is the output of 50 neurons of the hidden layer resulted of applying an activation function on n1, a1 is now is the input vector of the next layer which is here the output layer. LW2,1 of 10×50 represents layer weights and b2 a vector bias with 10 biases which connects the hidden layer with the output layer which consist of 10 neurons. n2 = IW2,1 a1+ b2 the input for the 10 neurons of the output layer. a2 is the output of 10 neurons of the output layer resulted of applying an activation function on n2. The output layer of the first network consist of 10 neurons since we need to classify 10 digits [0,1,…,9], each of which correspond to one of the possible digits that might be considered.

The architecture of the second network (three layers) as illustrated in Fig. 5 also is the same as the architecture of the first network except that there are an additional hidden layer rather than one hidden layer. The input vector also consists of 600 inputs. There are two hidden layers, the first consists of 250 neurons and the second consists of 6 neurons.

Fig. 5: Three layers network, two hidden and one output, with 250,6,10 neurons respectively for each layer

The output layer also consists of 10 neurons. Also the same as in the first network, each neuron is used to correspond to one of the possible digits that might be considered.

Both networks are fully connected feed forward network, which means activation travels in a direction from the input layer to the output layer and the units in one layer are connected to every other unit in the next layer up[12]. The back propagation algorithm consists of three stages. The first is the forward phase, spread inputs from the input layer to the output layer through hidden layer to provide outputs. The second is the backward stage, calculate and propagate back of the associated error from the output layer to the input layer through hidden layer. And the third stage is the adjustment of the weights[13].

The backward stage is similar to the forward stage except that error values are propagated back through the network to determine how the weights are to be changed during training. During training each input pattern will have an associated target pattern. After training, application of the net involves only the computations of the feed forward stage. Hereafter, we will describe the algorithm used to train the network in details[14].

Training algorithm:

1. Initialize weights by zero
2. .While E >= 0.000001 iterate steps 3-9
{Feed forward stage}
3. For input layer, assign as net input to each unit (Xi, i = 1,…,n) its corresponding element in the input vector. The output for each unit is its net input. We have (600×10) input vector

For the first hidden layer units calculate the net input and output:

And repeat step 4 for all subsequent hidden layers

For the output layer units calculate the net input and output:

{Back propagation stage}

For each output unit calculate its error:

7. For last hidden layer calculate error for each unit:
And repeat step 7 for all subsequent hidden layers:
{Update weights and biases}
8. For all layers update weight for each unit:
9. Test stopping condition in step-2

As shown in Fig. 6 the applying the three stages, feed forward, back propagation of error and adjustment of weights and biases represents one epoch. In our research, the first network used needed 36 epochs to reach the goal and the other network needed 33 epochs to reach the goal. The goal in the first network was until E <= 0.00001, while in the second network was until E <= 0.000001.

Fig. 6: Training performance function for both networks


We have experimented two networks, one with two layers and another with three layers. Both networks have been trained on the same training data set using feed forward back propagation algorithm. We used different ordering for the data set in the training process. The same test data set has been used for testing both networks. In Table 1, we show the results and a comparison between the two networks constructed. We observe that the net2 converged more rapidly than net1 as the number of epochs is greater in net1, in spite of that error rate in net1 is greater than in net2. The accuracy of recognition is 93% in net1 and 95% in net2.

In Table 2, we tested each digit alone. We found that the recognition accuracy for digits (1, 2, 3, 5, 6 and 7) remains the same in both networks. And the recognition accuracy for digits (0, 4 and 8) was better in net2, while the recognition accuracy for digit (9) was better in net1. Digit (0) achieved the best average accuracy 96.65% in both networks. Digit (9) achieved the least average accuracy 89.95% in both networks. We conclude that net2 recognized all digits more accurately than net1 except for digit (9).

The input data is an image format file containing numbers. The data feed into the system and then passed through several preprocessing steps before it can be recognized. The preprocessing steps is an image processing methods, such as (convert the (RGP) image to grayscale, sequentially, convert it to a grayscale to binary). The binary image then passed through a filtering technique to remove the noise.

Implementation: In Fig. 7 show the different steps involved in the proposed recognition system of Arabic number from Zero to nine and we been able to select any part from the image before the recognition process.

Table 1: Comparison between the networks constructed

Table 2: Recognition accuracy for each digit individually

The noiseless image is segmented if it contains more than one digit. The previous segments are normalized to a common size to be suits as an input for the neural network.

As a last step before the recognition process, thinning and skeletonaization process are applied on each segment. Finally, digits within the image are recognized using Neural Networks.

Our system is designed to deal with any field where the digits could be used for example in bank checks, postal arrangement according to zip-code, car plates and any application forms that deals with numbers.

Fig. 7: Example to illustrate the different step involved in the proposed recognition system for the number from Zero to nine

Fig. 8: A comparison between the theories with our System In terms of recognition accuracy

At the end of the study we proved the ability for our system dependent on the results for the recognition accuracy after the applied our system using neural network. In Fig. 8 shown A comparison between the theories with our System In terms of recognition accuracy. We conclude that our Neural Network approach to recognizing Arabic Handwritten digits proved as a viable concept. Further refinement of the networks will certainly produce higher recognition accuracy while increasing the robustness of the solution.

Scientists and researchers are still interested in this area, because it has many challenges until now ,and the system involves a verity of process operate sequentially to achieve the goal, many issues related to those process have not been touched, as the needed in the future those issues can be studied and tested under the proposed system and some of the following can be consider as the base for the future work, like check robustness in noisy setting and with different random initializations and skew detection and correction to the digits.


We can conclude that we reached the computer to the human’s brain by the importance use of isolated digits recognition for different applications. This recognition starts with acquiring the image to be preprocessed throw a number of steps. As an important point, classification and recognition have to be done to gain a numeral text. In a final conclusion, neural network seems to be better than other techniques used for recognition.


Special thank and recognition go to my advisor, Associate Professor. Dr. Putra Sumari, who guided me through this study, inspired and motivated me.

Last but not least, the researchers would like to thank the University Sains Malaysia USM for supporting this study.

" class="btn btn-success" target="_blank">View Fulltext