HACR-MDL: HANDWRITTEN ARABIC CHARACTER RECOGNITION MODEL USING DEEP LEARNING

: Despite the enormous effort and prior research, Arabic handwritten character recognition still has a deep, wide-ranging, and untapped scope for study owing to the enormous challenges faced in this research area. The reason for such challenges is that the Arabic script comprises 28 alphabets, each of which can be written in two to four different forms depending on where it appears in a word—beginning, middle, end, or isolated. The Convolutional Neural Network (CNN or ConvNet) is a subtype of neural network that is commonly used in image classification, speech recognition, video processing, object detection, and segmentation because its built-in convolutional layer reduces the high dimensionality of images without losing significant information. Hence, the scope of this study is to examine the classification performance of various deep CNN models on offline handwritten Arabic character recognition. Based on the experimental comparative studies, this research proposes a Handwritten Arabic Character Recognition Model using Deep Learning (HACR-MDL), a modified CNN model. The proposed model is trained and tested using the AHCD dataset achieving an accuracy of 98.54%. The results achieved showed that HACR outperformed the recent research offline handwritten Arabic character recognition in terms of model complexity, speed, model parameters, and performance metrics.


INTRODUCTION
Arabic is the official language of 26 countries.There are almost 420 million people worldwide who speak Arabic, which makes it the fifth most-spoken language around the world (Ridout , 2019).Arabic also plays an important role in the Islamic faith and belief as Arabic is the language of the Holy Quran ‫الكريم"‬ ‫."قرأن‬ Recognition is an area that covers various fields such as face recognition, fingerprint recognition, image recognition, character recognition, numerals recognition …etc.The handwritten Character Recognition System is an intelligent system able to classify handwritten Characters as humans see.The classification of handwritten characters is a more difficult task due to the different handwriting styles of the writers.Handwritten Arabic character recognition (HACR) has attracted considerable attention in recent decades.Researchers have made significant breakthroughs in this field with the rapid development of deep learning algorithms.Arabic is a kind of Semitic language (Najadat et al., 2019) used in countries of the Middle East as the mother language of millions of people.Generally, the Arabic alphabet characters consist of twentyeight alphabet characters as illustrated in Figure 1.Each character may have up to four forms as shown in Table 1.Convolutional neural network (CNN) is one of the most famous and commonly used Algorithms in deep learning as one of its main strengths is to provide an efficient network that performs identification or prediction.It is widely used in analyzing, segmenting, and classifying visual imagery, it can extract distinct features from images without any human involvement.It uses the mathematical operation, conSvolutions, executed in parallel.CNN consists of one or more fully connected layers as shown in Figure 2. The convolutional layer convolves into a smaller area to extract features, while the pooling layer picks the data with the highest value within an area.They require less pre-processing in comparison to other classification algorithms and are able to learn filters and characteristics.Compared to the fully connected artificial neural network, CNN is easier, and faster to train and has fewer parameters.After training, CNNs converge and generate acceptable results, and accurate decisions (Aghdam et al., 2017).This research proposes HACR-MDL, a modified CNN model that is applied to (AHCD) database created by (El-Sawy et al., 2017) to examine the enhancement of the classification performance of handwritten Arabic character recognition.

RELATED WORK
Various methods have been proposed and high recognition rates are reported for the handwritten recognition for all languages for example for English (Bai et al., 2014), and (Yuan et al., 2012) using CNN.Recently, many researchers started to get interested in the Arabic recognition system.Elsawy et al created a model with deep learning architecture that can be effectively applied to recognizing Arabic and showed that the results were promising with a 94.9% classification accuracy rate on testing images of handwritten characters (El-Sawy et al. 2017).Also, Khaled Younis presents a deep neural network for the handwritten Arabic character recognition problem that uses robust CNN DL mode using TensorFlow/Keras used AIA9k and the AHCD datasets, the accuracies for AIA9k and the AHCD datasets were 94.8% and 97.6%, respectively (Younis, 2017).Ahmed SB et al. used CNN the input image was preprocessed at the size of 50950 and at a grayscale level.Each image was saved in five various orientations.They used ReLU activation functions in the hidden layers, SoftMax activation function in the output layer, maxpooling layer after each convolution layer, and the kernel sizes of the two convolutional layers were 393 and 595.They segmented the characters of the Arabic scene image manually.Results: Their best-reported accuracy was achieved when the filter size was 393, the stride was 2, and the LR was 0.005.The error rate was 18.24%.The drawback of their work was that they used a small number of data (which was 2450 in training) which impacted their accuracy and error rate.They have extracted Arabic images from EAST (English Arabic Scene Text) dataset (Ahmed et al., 2017).Boufenar et al. developed a system composed of three main modules: preprocessing, feature extraction, and recognition.The system was 14 trained and tested with a ten-fold cross-validation technique on an original realistic database that we 15 built from the well-known IFN/ENIT benchmark, they obtained results with a classification rate of 93.25% (Boufenar et al., 2018) 2020).While Abdalkafor presents an Arabic offline handwritten isolated character recognition system using a neural network on CENPARMI database which contains 6000 digit images (600 images from each of 10 classes) collected from live mails of USPS, scanned at 166DPI and has achieved an overall accuracy of 94.75% for all letters (Abdalkafor et al., 2020).AlKhateeb et al. proposed a modified CNN model, they obtained an accuracy of 89.8%, 95.4%, and 92.5% when employing the AHCR, AHCD, and Hijja datasets, respectively (Al Khateeb et al., 2020).Balaha et al. introduce a deep learning (DL) system with two convolutional neural networks (CNN) architectures (named HMB1 and HMB2) and reported a testing accuracy of 98.4% with 865,840 records using augmentation on the HMDB dataset (Balaha et al., 2021).Altwaijry et al. used CNN to develop a modified model for Arabic handwritten character recognition.They created their own dataset, known as Hijja.To train the model, Hijja and AHCD were utilized, and the Adam optimizer was employed to train the model.The achieved rate of learning was 0.001.The results demonstrated that the model's performance was 97% and 88% accurate according to the AHCD and Hijja datasets (Altwaijry et al., 2021).Balaha et al. proposed a native CNN architectures model on the HMBD database, which includes 54,115 handwritten Arabic characters with an accuracy of 91.96%.In the same study, a transfer learning (TL) and genetic algorithm (GA) approach called HMB-AHCR-DLGA was also developed to improve the recognition phase's training parameters and hyper parameters.For the latter technique, pre-trained CNN models (VGG16, VGG19, and MobileNetV2) were used.The best combinations were presented after five optimization experiments.The highest testing accuracy reported was 92.88%, achieved in the VGG16 experiment using the AdaMax weights optimizer (Balaha et al., 2021).

Motivation:
The motivation of this study is to enhance the performance of Arabic handwritten character recognition.In recent years, Arabic handwritten character recognition with different handwriting styles as well, making it important to find and work on a new and advanced solution for handwriting recognition.A deep learning system needs a huge number of data (images) to be able to make good decisions.

Prepossessing data:
Load our dataset AHCD, checking for null and missing values then we normalized and reshape our dataset, we explore data analysis by applying exploratory data analysis (EDA) to investigate the data and summarize the key insights.It gives a basic understanding of the data by identifying the important variables, clean data as null values, and irrelevant information so that the data contains only those values that are relevant and important to our goal which reduces time and computational power.You can either explore data using graphs or through some Python functions, then we converted the labels into a numeric form so as to convert them into machine readable form as shown in Figure 3.

Modelling and Evaluation:
CNN Model is used, initially, the optimizer function is utilized to modify the attributes of the neural network, such as weights and learning rate.Thus, it helps in reducing the overall loss and improving the accuracy, then used RMSprop optimizer which is similar to the gradient descent algorithm with momentum.The RMSprop optimizer restricts the oscillations in the vertical direction.Therefore, we can increase our learning rate and our algorithm could take larger steps in the horizontal direction converging faster.Finally, we Implemented Data augmentation which is a set of techniques to artificially increase the amount of data by generating new data points from existing data to reduce Steps of Data augmentation, we set the input means to 0 over and for each sample means to 0, then we divided the inputs by stander division of the dataset and divide each input by its stander division, we applied ZCA whitening to maximize the average cross-covariance between each component of the whitened and original vector.After that we randomly rotated the images in the range (degrees, 0 to 180), zoom image, shift images and R randomly flip images.
20 epochs and 69 batch sizes.It is preferable to have a decreasing learning rate during the training to reach efficiently the global minimum of the loss function.Therefore to maintain the advantage of the fast computation time with a high Learning rate, we decreased the Learning rate dynamically every X step (epochs) depending on whether it is necessary (when accuracy is not improved).This section introduces the results obtained by the proposed AHCR network.The following section will describe the results of applying the network to classify AHCD datasets.

Training and validation:
The results obtained after testing the proposed network are discussed in sub-section 3.2.2 on the AHCD Arabic isolated alphabet dataset described here.We divided the data into two parts; training and testing, with ratios of 80% and 20 for each set, respectively.Then, we ran training for 20 epochs and 69 batch sizes.We obtained an accuracy of 97.6% on the test set at the end of the training.We increased the number of epochs to 50 and 75, respectively, and change in Batch size until we reached the highest accuracy after the test trials at 98.54% with

Confusion Matrix:
We applied a confusion matrix to our model to summarize its performance as shown in Figure 7 that our EM MODIFIED CNN Model performs very well on all characters with few errors.Then we evaluated the model on the test set which obtained accuracy = 0.9854166666666667.Then we displayed six images with their predicted and real labels which our model couldn't predict right as shown in Figure 8.For example, misclassification in the case of Reh ‫)ر(‬ and Zain ‫)ز(‬ where the difference between Reh and Zain is the dot of the above character Zain ‫)ز(‬ which is very confusing to classify, even in the real world.In some other cases, the misclassification is due to the loss of some of the basic parts of the characters or the addition of some strange touches to the characters as in Feh ‫)ف(‬ and Noon ‫.)ن(‬

CONCLUSIONS
Automated software systems for the recognition of Arabic characters could have huge applications in many industry and government sectors.In this paper, we presented a Deep Learning system based on a convolutional neural network that is capable of classifying Arabic handwritten characters with a state-of-the-art classification accuracy of 98.5% AHDC datasets.
The system employs some augmentation techniques, which provide performance and efficiency improvements.The system was implemented using TensorFlow and Keras framework.
As a future work, in addition to working with ResNets, we plan to apply the algorithm to a larger and more diverse database.This could be done by merging more than one source of the database.We plan to implement deeper networks with state-ofthe-art techniques for regularization and optimization.In the next stages, we plan to use segmentation-free techniques to train our network with larger datasets that contain Arabic handwritten connected characters (words) to use the context using LSTM networks.Ultimately, this research will open the door to great opportunities to expand deep learning applications using these powerful libraries to problems of ancient Arabic handwritten character recognition.
. Najadat et al. used AHCD dataset by proposing a modified CNN architecture to achieve better results by changing many parameters to enhance a CNN for Arabic character recognition by obtaining 97.2% accuracy (Najadat et al., 2019).Djaghbellou et al. proposed a new Arabic handwritten characters recognition framework by using multi-scale Histogram-Oriented Gradient (HOG) features and the deep rule-based classifier (DRB), They combined multi-scale HOG features, and then the DRB is applied to comprehensive HOG features to obtain the final classification label/class by applying it on AHCD dataset the experimental results on show that the proposed multi-scale and multi resolution features with multilayer Deep rule base classification scheme can outperform the existing state-of-the-art method and this will open the door for applications of deep rule based classifier to the problems of Arabic script recognition (Djaghbellou et al.,

Figure 3 .
Figure 3. Label Encoding In this work, the AHCD dataset for isolated Arabic Characters was used.This is a free publically dataset created by El-Sawy et al.We downloaded it from the Kaggle site (Kaggle,2017) AHCD dataset consists of 16800 letters gathered from 60 participants the age range is between 19 to 40 years, and 90% of participants are right-hand.Each participant wrote each character (from Alef to Yeh) ten times.Thus, we have 600 examples for each character.The dataset is divided into training and testing sets, 13,440 and 3360 respectively.

Figure 4 .
EM MODIFIED CNN ModelTable3.A summary of the proposed model test trails Notable improvements have been obtained and accuracy increased to 98.2% and 98.4% respectively as shown in Figure6.Data augmentation was deemed necessary to improve the network performance.We increased the number of training images from ~13k to ~80k using translation in both horizontal and vertical directions by 3 pixels, rotation of +10 and -10 degrees, and by adding Gaussian noise with zero mean and a standard deviation of 5. Horizontal or vertical flipping was deemed unsuitable for our application.

Figure 6 .
Figure 6.Training accuracy and validation accuracy during training.