1. Introduction
Learning disabilities are neurodevelopmental conditions that affect how children acquire, process, store, and respond to information. They reflect differences in how the brain processes information and handles specific cognitive tasks, such as reading, writing, and language processing. Learning disabilities encompass a spectrum of disorders that affect a child’s ability to learn, often manifesting in various aspects of academic performance, including handwriting [
1]. Nowadays, learning disabilities represent one of the most persistent challenges in early childhood education. When these conditions remain unidentified during the critical early years of schooling, they may lead to serious long-term consequences, including sustained academic underachievement, reduced self-efficacy, and significant social and psychological difficulties for affected children [
2].
Early identification and targeted intervention are the most effective strategies for improving developmental outcomes; therefore, every undetected year narrows the window available for effective intervention [
3]. However, traditional screening and diagnostic approaches typically rely on standardized cognitive assessments and structured behavioral observations conducted by trained specialists. Nevertheless, these methods are often time-consuming, costly, dependent on professional expertise, and susceptible to subjectivity, making the evaluation process slow and resource-intensive [
1,
4,
5]. Moreover, children are often assessed only after continuous academic struggles have been observed [
5,
6]. These limitations highlight the need for screening approaches that are accurate, efficient, objective, automated, and scalable, enabling earlier identification of at-risk children and supporting timely referral for further assessment.
Handwriting has emerged as a particularly informative domain for identifying early indicators of learning disabilities [
3,
6]. As one of the earliest observable outcomes of a child’s developing cognitive and motor systems, handwriting encodes a rich set of diagnostic signals accessible through simple observation. Variations in handwriting can reveal characteristic patterns related to motor coordination, spatial planning, and cognitive processing, which may help distinguish children with learning disabilities from their typically developing peers [
2]. Beyond its role in written expression, handwriting can therefore serve as a valuable early screening modality, offering educators and clinicians accessible yet meaningful insights into a child’s learning profile [
1].
Handwriting difficulties often arise from deficits in orthographic knowledge (the understanding of how letters are formed and structured) and impairments in motor skills. Among the most observable manifestations of such disabilities is dysgraphia, a specific learning disorder characterized by persistent problems with handwriting fluency, letter formation, and fine motor coordination during writing [
2]. Handwriting contains rich diagnostic information that reflects a child’s cognitive and motor development. Characteristics such as the consistency of stroke formation, regularity of letter sizing, spatial distribution of characters and words, and adherence to the horizontal baseline can reveal meaningful differences in writing behavior. These attributes often differ systematically between typically developing children and those experiencing learning disabilities. Consequently, handwriting patterns may serve as markers of learning challenges, enabling researchers to utilize handwriting samples to identify children who may be at risk [
2,
7,
8].
Recent advances in machine learning and deep learning have attracted increasing attention for the early detection of learning disabilities. Motivated by this perspective, the present study aims to develop an automated approach for recognizing and classifying Arabic children’s handwriting to support the early detection of dysgraphia. In particular, convolutional neural networks (CNNs) are employed due to their proven effectiveness in extracting hierarchical visual features and recognizing complex patterns in image data, making them well-suited for handwriting analysis [
6]. CNN-based models are capable of learning both local and global visual representations without requiring manual feature engineering. For handwriting analysis, this includes capturing fine-grained local cues such as stroke texture, edge irregularities, and subtle variations in writing pressure proxies, as well as global structural cues such as layout organization, spacing distribution, line stability, and overall writing rhythm [
9,
10]. This capability enables CNN models to automatically identify discriminative patterns that may be indicative of learning disabilities.
Within this broader context, the present study specifically focuses on dysgraphia as the target condition; accordingly, the term “learning disabilities” is used when referring to the broader educational and clinical context, whereas “dysgraphia” is used when referring to the specific condition investigated by the proposed model.
Research Gap and Contributions
Despite growing interest in automated handwriting-based screening for learning disabilities, the literature reveals several persistent limitations. Most existing CNN-based studies on learning-disability and dysgraphia detection have been developed and validated on English-language handwriting. and Arabic handwriting, characterized by cursive connectivity, context-dependent letter forms, and diacritic dependency, remains largely unexplored in this context. While Alqahtani et al. [
11] recently demonstrated that CNNs can detect dyslexia from isolated Arabic letter images in a Saudi sample, no prior study, to our knowledge, has addressed this task for whole-sample, connected-text Arabic handwriting under a formally validated, multi-stage diagnostic labeling framework. This gap motivates the present research: to develop a CNN model capable of learning discriminative patterns directly from full Arabic handwriting samples, evaluated with metrics appropriate to real-world class imbalance, and benchmarked against classical feature-based classifiers. By addressing this gap, the present research aims to complement and extend recent Arabic-language efforts such as [
11], moving from isolated-character classification toward full-sample, page-level analysis. To address this gap, the primary contributions of this study are as follows:
Design of a custom CNN architecture capable of learning discriminative Arabic handwriting patterns directly from raw image data, without manual feature engineering.
Evaluation of the feasibility of CNN-based early risk screening using full, connected-text Arabic children’s handwriting, while recognizing that independent external validation is required before practical deployment can be considered.
Comparison of the performance of the proposed CNN against four classical machine learning classifiers: logistic regression, linear support vector machine (SVM), RBF SVM, and random forest, trained on handcrafted handwriting features, under identical experimental conditions.
The remainder of this paper is organized as follows.
Section 2 reviews the related work on the detection of learning disabilities through handwriting analysis.
Section 3 describes the methodology adopted in this study.
Section 4 presents the experimental setup and the corresponding results.
Section 5 discusses the findings, and the paper concludes in
Section 6.
2. Related Works
Learning disabilities have gained increasing awareness and growing research interest, and various approaches have been used to detect and diagnose them at an early stage. Recent advances in machine learning and deep learning have led to the development of automated methods for detecting learning disabilities.
The study by Kedar et al. [
12] proposed a method for analyzing a child’s writing dynamics using a standardized digital writing pad and machine learning algorithms. The study employed online handwriting analysis, which takes into account factors such as pen pressure, timestamp, and other variables to enhance the effectiveness of the analysis. The dataset used in the research consisted of 60 handwriting samples collected through a WACOM digital tablet, comprising Latin-based (English) handwriting. Handwriting parameters, such as timestamp, time, coordinates, and pressure, were recorded using the digital tablet for each task. Motion, time, and pressure-related features were extracted from the dataset for further analysis. The study compared the performance of different machine learning algorithms, including Random Forest, Decision Tree, and Voting Classifier, for classifying and predicting subjects with learning disabilities. The Random Forest classifier showed the highest accuracy, at 92.59% during testing. The results suggested that features such as the in-air time of the pen, the on-paper time of the pen, and the standard deviation in pressure are essential for accurate classification.
Several studies have applied deep learning techniques, especially CNN, to detect learning disabilities among children using handwriting. CNN is an artificial neural network consisting of multiple layers of neurons that can learn hierarchical features from the input data. The following studies have utilized various CNN architectures and achieved promising results.
Isa et al. [
13] presented an automated detection system for identifying dyslexia symptoms in children based on their handwriting images. The study was conducted on English handwriting samples from primary school students. The system used pattern recognition techniques, specifically Optical Character Recognition (OCR), to detect and extract features of written characters. An artificial neural network (ANN) was then used to classify dyslexia risk levels as low risk (LR) and risk (R). The classification accuracy was obtained through automated correct detection and manual calculation. Their proposed system achieved an accuracy rate of 73.33% based on the ANN. Similarly, Isa et al. [
14] explored and compared the performance of different CNN models for detecting dyslexia based on handwriting images obtained from a Kaggle database, comprising English Latin-script handwriting. Four CNN models were tested in the study, and each model had a different architecture and was trained on the preprocessed dataset. The study found that the LeNet-5 model had the best accuracy and lowest loss among the tested CNN models.
The study by Vilasini et al. [
15] focused on using CNN and Vision Transformers (ViT). The specific learning disability addressed in their study was Motor dysgraphia, which affects a person’s writing ability. The CNN model processed pixel data and classified the writings, while the ViT model prepared patches from each image and analyzed them to make predictions. The proposed model achieved a test accuracy of 86.22% on English handwriting samples.
Moreover, Rosli et al. [
5] proposed a CNN model that utilized transfer learning based on the LeNet-5 architecture for dyslexia handwriting recognition. The model was trained and tested on a dataset of 138,500 handwriting images representing three dyslexic handwriting classes: normal, reversal, and corrected, each consisting of English letters. Data augmentation and preprocessing techniques were applied to balance the dataset and improve the model’s performance. The developed CNN model achieved an accuracy of 95.34% in classifying dyslexic handwriting into three classes.
Furthermore, Spoon et al. [
16] created two novel datasets: a “messy” set of naturally produced samples (2 dyslexic, 15 non-dyslexic) and a controlled set containing word lists, paragraphs, and story-completion tasks (9 dyslexic, 62 non-dyslexic) collected via classroom sessions, in the English language. Their CNN architecture (5 convolutional layers, 3 max-pooling layers, 2 fully connected layers, dropout) was trained with a 4:1:1 train--validation--test split, and achieved an average accuracy of 55.7 ± 1.4%.
In addition, Yogarajah and Bhushan [
17] focused on Hindi-speaking children in India, where dyslexia and dysgraphia are prevalent. The researchers collected handwriting samples from 54 children with a risk of dyslexia and compared them to samples from age-matched children without dyslexia. They analyzed the samples using a CNN to identify specific features indicative of dyslexia–dysgraphia. The CNN achieved an average accuracy of 86.14% in identifying dyslexia–dysgraphia based on the handwriting samples.
Moreover, Al Abadleh et al. [
6] present a structured literature review on using handwriting images with deep learning to detect and classify dyslexia, dysgraphia, and other learning disabilities, and demonstrate the ability of CNN models. They selected 502 records and included 24 studies, all of which were in the English language. The review shows that CNNs are the dominant approach, as they can automatically learn fine-grained spatial handwriting patterns (letter shape, spacing, alignment irregularities) and achieve high accuracy in distinguishing children with learning disabilities from typically developing peers. The review highlights several persistent challenges: small and imbalanced datasets, limited diversity in languages and populations, poor generalizability of models across settings, computational cost, and a lack of interpretability and real-world deployment in schools or clinics.
However, Arabic has not received attention in this research field. Arabic script presents a set of structural and visual properties that make it fundamentally distinct from Latin alphabets, introducing unique and significant challenges for automated recognition that cannot be addressed simply by adapting existing models developed for English data [
10].
Limited studies have applied deep learning techniques, especially CNN, to recognize Arabic characters in children’s writing. Most existing research has instead focused on adult handwriting. Nevertheless, children’s handwriting has recently become a significant research focus. However, the application of CNNs to Arabic children’s handwriting recognition is still in its early stages. A few studies have explored the use of CNNs for this task, with promising results. For instance, Alheraki et al. [
18] proposed a handwritten Arabic character recognition system for children’s writing using CNN and stroke identification. The proposed CNN architecture is designed for recognizing children’s Arabic handwritten characters. This architecture achieved significantly improved prediction accuracy: 91% on the Hijja dataset and 97% on the Arabic Handwritten Character Dataset. Furthermore, they proposed a CNN model to recognize characters based on their strokes, identified by the number and direction of endpoints and junction points in the thinned images. This approach used multiple models instead of a single model, based on the number of strokes in a character, and merged Hijja with AHCD, achieving an average prediction accuracy of 96%.
Furthermore, Altwaijry and Al-Turaiki [
10] designed a CNN tailored for recognizing handwritten Arabic letters, focusing on improving accuracy for both children’s and adults’ handwriting. The CNN architecture they proposed involves multiple convolutional layers followed by fully connected layers, optimized for high-dimensional image data. They trained this CNN on their newly collected Hijja dataset (children’s handwriting) as well as the existing Arabic Handwritten Character Dataset (AHCD). Data augmentation, normalization, and preprocessing steps were applied to handle variability. The CNN achieved 88% accuracy on Hijja, demonstrating its effectiveness in recognizing children’s handwriting, which is more variable and complex compared to adult handwriting datasets.
Similarly, Alwagdani and Jaha [
19] developed a deep learning-based child handwritten Arabic character recognition and handwriting discrimination system. The study proposes a CNN model trained on children’s and adults’ handwriting datasets and evaluates its performance in recognizing children’s handwriting. The study used two datasets, namely Hijja and AHCD. The proposed methodology was divided into four phases: data preprocessing, feature extraction using CNN, extraction of supplementary features, and classification using popular machine learning-based classifiers (Softmax, SVM, KNN, RF). It also proposed supplementary features based on empirical observations to enhance the classification of child and adult writers. The system achieved an accuracy of 93% for character recognition and 94% for child handwriting discrimination. Most closely related to the present work, Alqahtani et al. [
11] proposed a CNN-based model for predicting dyslexia in Arabic-speaking children using handwriting. Their dataset comprised 3611 images of isolated Arabic letters, written by children aged 7–10, divided into a dyslexic group and a non-dyslexic group. A CNN trained on these character-level images achieved an accuracy of 95.30%, improving to 95.97% following data augmentation. This study confirms the feasibility of CNN-based dyslexia detection from Arabic handwriting.
To sum up,
Table 1 and
Table 2 summarize the related works on the automated prediction of learning disabilities using children’s handwriting. As shown, while Alqahtani et al. [
11] recently demonstrated that CNNs can detect dyslexia from isolated Arabic letter images in a Saudi sample, the broader literature on detecting learning disabilities from full, connected-text handwriting using deep learning remains dominated by English-language studies. The specific research gap this motivates, and our contributions in addressing it, are outlined in the Research Gap and Contributions section.
4. Experiments and Results
This section presents the experiments conducted to determine the optimal configuration and best performance of the proposed CNN model, covering key design decisions, including architecture choices, loss function selection, and cross-validation strategy. In addition, handwriting features are analyzed by comparing multiple machine learning classifiers. Finally, a comprehensive evaluation of the proposed CNN model’s performance metrics is presented to demonstrate the approach’s effectiveness.
4.1. CNN Architecture Choices Experiments
To validate the effect of each architectural decision, two configurations were evaluated under the same training conditions and compared to assess whether they affect the final proposed model, without batch normalization and without GAP Layer, as illustrated in
Table 5.
The proposed CNN Model, before adding the batch normalization layer, achieved strong accuracy (90.35%). However, balanced accuracy was 78.52%. The model predicted the majority class effectively, but struggled with the minority class. The confusion matrix indicates that 22 false negatives accounted for the majority of errors. Precision was high 91.118%, but recall for the positive class was 58.49%, reflecting a bias toward specificity over sensitivity, as shown in
Table 5. Therefore, the research aims for both high accuracy and reliable detection of children with dysgraphia. So, a lower recall for the positive class (with_dysgraphia) is not preferred in this case.
The most notable observation without Batch Normalization was that the CNN still learns to classify handwriting, but training is slower, less stable, and most likely to bias toward the majority class. This instability reduces the model’s ability to correctly detect the minority class (with_dysgraphia), which is the main objective of this study. Also, instability produces worse generalization on unseen handwriting. With an imbalanced set, this instability can raise bias toward the majority class and reduce the model’s ability to recognize the minority (with_dysgraphia) patterns [
44].
Furthermore, the impact of GAP, the proposed CNN model, before the addition of the GAP layer, achieved an overall accuracy of 79.54%. At first glance, the accuracy suggested a reasonable level of performance. However, closer review revealed that the balanced accuracy was only 50%, with a sensitivity of 0% and a specificity of 100%.
In practice, this mean the model classified all handwriting samples as belonging to the (without_disabilities) class. The confusion matrix confirmed this limitation: out of 53 positive cases, none were detected (TP = 0, FN = 53), while all negative cases were correctly classified (TN = 206, FP = 0). This outcome rendered the model ineffective for this study, since it completely failed to recognize children with dysgraphia without GAP, the model likely relied on fully connected layers that memorized training set spatial patterns, which led to poor generalization. The model without GAP confirms this, which learned to minimize loss by always predicting the majority class, indicating complete failure to learn meaningful feature representations for the minority class.
As shown in
Table 5, without the GAP layer caused a failure in sensitivity (0%), confirming its critical role in detecting handwriting difficulties.
4.2. Loss Function Selection
Four loss functions were evaluated under LOOCV: standard cross-entropy, class-weighted cross-entropy, and Focal Loss at
= 3 and
= 4.
Table 6 reports the mean loss and standard deviation across LOOCV folds.
Cross-entropy and weighted cross-entropy produced similar mean loss values (0.558 and 0.564) with high variance, indicating unstable training. Focal Loss at = 3 reduced the mean loss to 0.0223 and the variance substantially. Focal Loss at = 4 achieved the lowest mean loss (0.0120 ± 0.0047), indicating the most stable and focused training. The parameter controls the rate at which the loss down-weights easy examples: at = 4, the model concentrates almost entirely on the harder minority-class samples. Focal Loss with = 4 was selected for the proposed model.
4.3. Handwriting Feature Analysis: Machine Learning Classifiers Results
Four machine learning classifiers were trained on the ten handwriting features under LOOCV to establish a performance baseline for comparison with the proposed CNN.
Table 7 presents classification results.
Logistic Regression achieved the highest balanced accuracy (62.6%) and sensitivity (50.9%). Random Forest produced the highest overall accuracy (80.3%) but only 13.2% sensitivity, a direct impact of the model depending to the majority class to maximize accuracy, which represents a failure mode under class imbalance. Even the best-performing classifier missed approximately half of children with dysgraphia, a result that falls well short of the performance required for a reliable automated early screening.
4.4. Comprehensive Proposed CNN Model Performance Metrics
Under the LOOCV protocol, the proposed CNN with its architecture and loss configuration fixed following the exploratory comparisons in
Section 4.1 and
Section 4.2 achieved an accuracy of 88.8% and a balanced accuracy of 92.3%. As these design choices were informed by performance signals on the same dataset used for this evaluation, the reported metrics should be interpreted as a potentially optimistic estimate of generalization performance rather than a fully unbiased one; see
Section 5 for discussion.
Table 8 presents a comprehensive summary of the model’s performance.
The balanced accuracy of 92.3% is notably higher than the standard accuracy, suggesting that the model performs well across all classes rather than being biased toward the majority class. This is particularly important in classification tasks where the class distribution may be unbalanced. The macro-averaged recall of 92.3% aligns with the balanced accuracy, indicating consistent performance across per-classes.
Precision, Recall, and F1-Score are reported under two averaging strategies: Macro Average, which treats all classes equally regardless of their size, and Micro Average, which weights each class proportionally to its number of samples, equivalent to overall accuracy in binary classification.
Precision metrics reveal some variation between macro and micro averaging, with macro-averaged precision at 82.2% compared to micro-averaged precision at 88.8%. This difference suggests that while the model performs well overall, there may be some classes where precision could be improved. The F1-scores follow a similar pattern, with macro-averaged F1 at 85.3% and micro-averaged F1 at 88.8%, indicating a reasonable balance between precision and recall.
The macro-averaged precision reached 82.2%, while the macro-averaged recall was 92.3%, leading to a macro F1-score of 85.3%. The corresponding micro-averaged values for precision, recall, and F1-score were all consistent at 88.8%.
A key indicator of the model’s quality is the MCC of 0.738, as this metric is considered more informative than accuracy alone, especially for imbalanced datasets. The MCC is a highly robust metric that produces a high score only if the classifier obtains good results in all four categories of the confusion matrix (true positives, false negatives, true negatives, and false positives).
Furthermore, as shown in
Table 9, the confusion matrix indicated that out of 259 samples, the model produced 52 true positives (TP) and 178 true negatives (TN), with only one false negative (FN) and 28 false positives (FP). The single false negative is particularly notable: it indicates that only one child with dysgraphia was missed across all LOOCV folds. In contrast, the majority of misclassifications appeared from false positives, where some children without disabilities were incorrectly flagged as having dysgraphia.
As illustrated in
Figure 4, both the ROC and Precision–Recall (PR) curves confirm the model’s excellent discriminative performance.
The ROC curve confirms that the model achieves near-perfect discriminative performance. With an AUC of 0.9936, the classifier consistently ranks positive cases above negatives, maintaining both high sensitivity and specificity across thresholds. This indicates that the model separates the two handwriting categories with exceptional reliability.
Moreover, the PR AUC of 0.9806 is especially significant in light of the 4:1 class imbalance. Unlike ROC, the PR curve is sensitive to skewed data distributions, so such a high score demonstrates that the model not only excels at ranking but also maintains strong precision and recall trade-offs. Together, these metrics show that the model has successfully learned discriminative handwriting features and is robust against class imbalance.
5. Discussion
The primary objective of this study is to develop a CNN-based screening model to support the early identification of children who may be showing indicators of dysgraphia in their handwriting, assisting educators and specialists in making timely referrals for further assessment. The proposed CNN architecture is designed to balance sufficient feature extraction capacity while taking into consideration the constraints of having a small dataset. It is notable that two specific architectural components made a difference in the proposed CNN, which were not just performance enhancers but were absolutely critical to the model’s ability to learn a meaningful and useful classification function, especially given the complexity of the Arabic handwriting.
First one, Batch Normalization had a clear and measurable impact on performance. Although overall accuracy decreased slightly from 90.35% without BatchNorm to 88.8% with it, the balanced accuracy increased from 78.52% to 92.3%. This shows that the trade-off was not in correctness but in achieving a more acceptable detection across both classes. Sensitivity, which had been only 58.49% without BatchNorm, improved to 98.1%. Similarly, the MCC increased from 0.6814 to 0.738, and ROC AUC improved from 0.9618 to 0.9936, indicating stronger class discrimination.
Without the stabilizing effect of Batch Normalization, training became unstable, and the model struggled to learn the features of the minority class, resulting in a biased classifier unsuitable for early screening. In contrast, adding BatchNorm not only stabilized optimization but also refined the internal feature representations, enabling the model to capture subtle handwriting distortions. These gains were directly aligned with the study’s objective of early and reliable detection of dysgraphia.
Second one, the GAP layer, before adding the GAP layer, the CNN struggled to generalize and showed severe class imbalance problems. The model without GAP reached only 79.54% accuracy and its balanced accuracy was 50%, meaning it effectively failed to detect the minority class. Sensitivity dropped to 0%, with the model predicting all samples as belonging to the majority class, even though specificity remained perfect at 100%. ROC AUC was limited to 88.78% and the MCC fell to 0, confirming that the classifier provided no meaningful discrimination. And, by looking at the performance after introducing the GAP layer, led to huge performance improvement.
By having the GAP, the proposed CNN helped in two areas: the GAP improved generalization by emphasizing the presence of discriminative features rather than their exact spatial location, which is essential in children’s handwriting, where relevant features may appear at different spatial locations within writing samples. Children with dysgraphia may exhibit inconsistent letter placement and irregular line adherence, requiring a classification model that can recognize diagnostic patterns regardless of their specific spatial position within the image. Therefore, Spatial feature integration provided by GAP layers enables the model to consider global handwriting characteristics such as overall spacing consistency, general letter size regularity, and line adherence patterns.
Second, it significantly reduced the number of trainable parameters by replacing fully connected layers with a pooling operation that converts each feature map into a single scalar value. This was particularly valuable given the small and imbalanced dataset, as it lowered the risk of overfitting.
The results indicate that GAP was most crucial architectural choice for enabling the model to capture meaningful patterns. Removing GAP caused the model to collapse toward majority-class prediction, with sensitivity and MCC both falling to zero. However, GAP is a well-established CNN component. Its relevance here is empirical: within the investigated full-sample Arabic handwriting setting, GAP provided a compact mechanism for aggregating spatial feature information while substantially reducing the number of trainable parameters, which was particularly beneficial given the limited and imbalanced dataset.
Furthermore, the implementation of focal loss in the proposed CNN model addresses the critical challenge in the dataset’s class imbalance (206 without_disabilities vs. 53 with_dysgraphia). Among the tested configurations, was identified as the optimal setting, hitting the best balance between stability and sensitivity. This choice directly supports the study’s objective of reliably recognizing children with dysgraphia without having a low overall accuracy. Because the dataset is imbalanced between with_dysgraphia and without_disabilities cases, the selection of the loss function is critical for effective learning. Standard cross-entropy (0.5579 ± 0.1773) treated all examples equally and biased the model toward the majority class, while weighted cross-entropy (0.5643 ± 0.2787) showed even greater instability.
In contrast, focal loss reduced the validation loss by more than 95%, reaching 0.0120 ± 0.0047 with . At , the model was forced to learn from the harder minority cases without entirely ignoring correctly classified majority examples. Therefore, was chosen as the optimal configuration, as it ensured discriminative feature learning across both classes and aligned directly with the goal of early and reliable detection of dysgraphia.
The proposed CNN outperforms feature-based classification. The 47.4% relative improvement in balanced accuracy (62.6% → 92.3%) and the 92.7% relative improvement in sensitivity (50.9% → 98.1%) demonstrate that learned visual representations capture information that manually defined features cannot encode.
The overall performance metrics indicate that the proposed CNN has a strong, foundational capability to distinguish between handwriting samples from children with dysgraphia and those without learning disabilities. The overall accuracy reached 88.8%, while the balanced accuracy was even higher at 92.3%, showing that the model maintained strong predictive ability despite the dataset’s class imbalance. The high balanced accuracy suggests that the model was not biased toward the majority class and was able to effectively capture patterns from both classes. A major obstacle faced in this study was the imbalance between the two classes: a majority of handwriting samples from children without learning disabilities, and a minority from those diagnosed with dysgraphia.
The model’s performance is further supported by the MCC was 0.738. The MCC is widely regarded as one of the most balanced performance measures for binary classification, as it produces a high score only if the classifier obtains good results in all four categories of the confusion matrix (true positives, true negatives, false positives, and false negatives).
Precision and recall metrics provide deeper insights into the class-specific performance. The macro-average precision stood at 82.2%, while macro-average recall reached 92.3%, indicating that although the model occasionally misclassified some positive cases, it achieved very high sensitivity overall. This pattern is reflected in the class-wise results: for the with_dysgraphia class, the model reached 98.1% recall but only 65.2% precision resulting in an F1-score of 78.2% In contrast, the without_disabilities class achieved 99.4% precision and 86.4% recall with a higher F1-score of 92.4%.
This imbalance between precision and recall in the with_dysgraphia class suggests that the model strongly favors sensitivity, prioritizing the identification of children with potential dysgraphia even at the cost of generating more false positives. From a practical perspective, this trade-off aligns with the objective of early screening: it is preferable to flag more children for further evaluation rather than risk missing cases of genuine difficulty. False positives, while not ideal, can be resolved through secondary diagnostic assessments, whereas false negatives carry a greater long-term risk of leaving disabilities unaddressed.
The model’s discriminative power is further confirmed by the ROC AUC of 0.9936 and the PR AUC of 0.9806, both of which are near-perfect values. These results suggests that the CNN may be highly effective in distinguishing between children with dysgraphia and without learning disabilities, even under imbalanced conditions. However, these results should not be interpreted as evidence that overfitting is absent. Given the relatively small dataset and the lack of external validation, the possibility of overfitting cannot be completely excluded, and further validation on independent datasets is required to assess the robustness and generalizability of the model.
Notably, these findings suggest that this carefully designed CNN not only achieved excellent overall performance but also fulfilled the primary goal of prioritizing early detection of children at risk. By maximizing recall for the with_dysgraphia class, the model may help reduce the likelihood of undetected cases, suggesting it could serve as a useful preliminary screening tool in early detection. At the same time, the relatively lower precision for this class highlights the need for follow-up evaluation to confirm flagged cases, ensuring that resources are allocated efficiently and that children without dysgraphia are not unnecessarily referred for further evaluation.
However, the high sensitivity of 98.1% was accompanied by a substantially lower precision of 65.2% for the with_dysgraphia class. The confusion matrix further illustrates this trade-off, with 52 true positives and 28 false positives. Thus, although the model missed only one child in the with_dysgraphia class, a considerable proportion of the children flagged as potentially at risk were false positives. This trade-off has important practical implications. In a preliminary screening context, prioritizing sensitivity may be appropriate because the objective is to minimize the number of potentially at-risk children who remain unidentified. However, the relatively high number of false positives could lead to unnecessary referrals and increase the workload and resources required for the subsequent specialist evaluation. Therefore, the proposed approach should not be used as a diagnostic system or as a standalone basis for educational decisions. Rather, its potential role is as an initial screening tool, in which positive predictions indicate the need for further evaluation by specialists.
Although the proposed CNN achieved strong results, several limitations need to be highlighted. A methodological limitation concerns the relationship between model selection and performance evaluation. The architectural components retained in the final model (Batch Normalization, GAP) and the Focal Loss focusing parameter (
= 4) were selected based on comparative results obtained on the same 259-sample dataset that was subsequently used for the LOOCV evaluation reported in
Section 4.4. When model or hyperparameter selection and final performance estimation draw on the same data, the resulting estimate can be optimistically biased, a phenomenon well documented in the model-selection literature [
45]. A fully unbiased estimate would require either nested cross-validation, in which model selection is repeated independently within each outer training fold, or evaluation on a separate, untouched cohort. Given the dataset size (N = 259) and the computational cost of retraining a CNN under a full nested-LOOCV scheme, this was not performed in the present study, and the reported LOOCV metrics should therefore be read as a potentially optimistic estimate of generalization performance rather than a fully independent estimate.
However, we note that this risk is not uniform across the model-selection decisions made. The Batch Normalization and GAP components were retained based on comparisons against alternatives that failed by a wide margin (e.g., complete failure to detect the minority class, with sensitivity and MCC both reduced to 0 in the absence of GAP, as shown in
Table 5); this is a coarse, binary architectural decision rather than fine-grained tuning across many closely competing configurations, and both components are standard, broadly validated choices in the general CNN literature [
28] independent of this particular dataset. The Focal Loss
parameter, by contrast, was selected via a finer comparison among four candidate configurations (
Table 6) and is therefore more susceptible to the selection bias described above.
Bedsides that, most critical risk is misclassifications due to natural handwriting variation. Some children may simply exhibit poor or inconsistent handwriting without having dysgraphia. In such cases, the model may mistakenly flag them as with_dysgraphia. A further limitation concerns the image preprocessing pipeline itself. The scanned handwriting samples were collected on ruled school paper, and the current pipeline applies grayscale conversion and Otsu binarization directly to the scans without an explicit step to remove the printed ruling lines. Consequently, the binarized images retain both the child’s handwriting strokes and the background ruling grid, and it cannot be fully excluded that the CNN and potentially certain handcrafted features, such as Line Straightness, which relies on Hough-based line detection partially reflect page-level artifacts (e.g., ruling-line geometry or scan characteristics) rather than relying exclusively on handwriting-specific motor and spatial cues. Future work should incorporate an automated line-removal step, such as Hough-based line filtering or morphological line subtraction, prior to binarization to isolate handwriting strokes more cleanly. Relatedly, the current pipeline resizes whole-page images to a fixed 256 × 256 resolution for both the CNN and the handcrafted-feature extraction described in
Section 3.4, which may compress fine-grained stroke-level detail, such as subtle pressure variation or edge irregularity, in both approaches. Transitioning from whole-page processing to line-level or word-level cropping prior to resizing would better preserve native stroke resolution for both pipelines and may further improve sensitivity to the fine-grained motor and spatial irregularities associated with dysgraphia.
A major limitation of this study concerns the dataset size, class imbalance, and particularly the limited size of the minority class. The final dataset included 206 samples in the without_disabilities class and 53 samples in the with_dysgraphia class, all collected from fourth-grade students across six government schools in Jeddah, Saudi Arabia. Focal Loss and Leave-One-Out Cross-Validation (LOOCV) address different aspects of this limitation, but neither fully resolves it. Focal Loss shifts the training emphasis toward harder-to-classify examples, including minority-class samples, and reduces the tendency of the optimizer to favor the majority class, as demonstrated in
Section 4.2. LOOCV, on the other hand, maximizes the amount of data available for training in each fold and avoids the variability associated with a single arbitrary train–test split. However, neither approach increases the diversity or number of handwriting samples represented in the dataset.
Expanding the minority class is therefore a key requirement for strengthening the generalization and robustness of these findings. In practice, however, collecting additional positive cases is challenging because inclusion in the with_dysgraphia class requires formal classification by qualified learning specialists.
A further limitation concerns external validity, the model was developed and evaluated entirely within a single data of 259 participants. Although Leave-One-Out Cross-Validation ensures that no individual sample contributes to the model that classifies it, every fold draws its training data from the same schools, the same grade level, the same curriculum, and the same data collection protocol. Cross-validation of this form estimates performance on unseen samples drawn from the same distribution; it provides no evidence regarding performance on samples drawn from a different one. Several sources of variation are therefore untested. All participants attended six government schools in Jeddah and received handwriting instruction under a single curriculum, so the model has not been exposed to differences in pedagogical practice across regions or education systems. All samples were produced by copying the same standardized passage and were digitized using a single scanner, so the model has not been evaluated under different variation. No claim regarding scalability or readiness for deployment is therefore warranted on the present evidence. The results establish that discriminative signal is present in this cohort and can be learned by a convolutional model; they do not establish that the model would perform comparably elsewhere. External validation on an independent cohort is a prerequisite for any operational use.
When comparing the proposed CNN with previous studies, it is important to note that most prior studies on the detection of learning disabilities based on handwriting have focused on English-language samples. Within the Arabic-language literature specifically, Alqahtani et al. [
11] reported a CNN accuracy of 95.30–95.97% for dyslexia detection from isolated Arabic letter images collected in the same city (Jeddah, Saudi Arabia). At face value, this exceeds the 88.8% accuracy achieved by the proposed model. However, the two results are not directly comparable: [
11] classifies single, isolated letters—a lower-dimensional and visually more constrained problem—whereas the present study classifies full connected-text samples reflecting natural page-level handwriting behavior, and evaluates performance using balanced accuracy, sensitivity, and MCC rather than raw accuracy alone, which is a more conservative standard given the dataset’s class imbalance. Relative to the English-language studies summarized above, it should further be noted that the unique characteristics of Arabic script—its cursive nature, context-dependent letterforms, and reliance on diacritics—introduce additional challenges that are not present in Latin alphabets.
Despite these added complexities, the proposed model achieves a balanced accuracy of 92.3%, a result that is competitive with, and in some cases exceeds, the performance reported in English-language contexts. More importantly, the proposed methodological contribution lies in the use of a GAP layer, a technique not explored in the related works, including [
11]. This study argues that GAP is particularly suited to the challenges of Arabic script, as it emphasizes global feature presence over precise location, which is important for analyzing a fluid, cursive writing style. Therefore, rather than being the first study to apply deep learning to Arabic children’s handwriting, this work extends recent efforts such as [
11] from isolated-character classification to full-sample, imbalance-aware screening, and offers methodological design choices—particularly GAP—that could inform future studies on other complex scripts.