A DenseNet121-based Deep Learning Approach for Multi-class Classification of Cowpea Leaf Diseases

S
Seng-Phil Hong1,*
1School of Computing and AI, HanShin University 137, Hanshindae-gil, Osan-si, Gyeonggi-do, Republic of Korea.
  • Submitted24-03-2026|

  • Accepted29-07-2026|

  • First Online 22-08-2026|

  • doi 10.18805/LR-5659

Background: Cowpea is a drought-resilient legume that is important in India, Africa and parts of Asia. In India, it is widely cultivated in arid and semi-arid regions, supporting rural nutrition and income. Leaf diseases, however, significantly reduce yields, making AI-based detection systems essential for timely and accurate diagnosis.

Methods: This study presents a deep learning framework using DenseNet121 for multi-class classification of cowpea leaf conditions: Bacterial wilt, septoria leaf spot, mosaic virus and fresh leaves. A total of 2,273 annotated images were curated, preprocessed and divided into training, validation and test sets. Real-time data augmentation and transfer learning techniques were employed to improve model generalization. The model was trained using categorical cross-entropy loss and evaluated with various metrics.

Result: The model achieved a test accuracy of 93.87%, with strong F1-scores and precision across all four classes. The matthews correlation coefficient (MCC) was 0.9184, indicating high reliability, while the multi-class ROC-AUC score reached 0.9931, showing excellent class separability. Confusion matrix and precision–recall analysis further confirmed robust performance, especially for bacterial wilt and Septoria leaf spot. These results support the model’s potential for integration into smart agricultural systems for early disease detection in cowpea cultivation.

Cowpea (Vigna unguiculata), a drought-resistant legume crop, plays an important role in food security, especially across sub-Saharan Africa, Asia and parts of Latin America. It is valued not only for its nutritional profile, rich in protein, dietary fiber and essential micronutrients, but also for its agronomic benefits, such as nitrogen fixation and adaptability to marginal soils (Jayathilake et al., 2018; Abebe and Alemayehu, 2022). As of 2022, global cowpea production reached approximately 9.8 million metric tons, cultivated over 15.2 million hectares. Africa dominates this production, contributing around 9.5 million metric tons from 14.9 million hectares. Nigeria and Niger are the leading producers, with Nigeria accounting for about 42% and Niger 29% of global output. The global cowpeas market was valued at USD 7.61 billion in 2024 and is projected to grow at a CAGR of 5.5%, reaching USD 12.32 billion by 2033 (Market Data Forecast, 2024). Cowpea exports to Europe and other regions have also seen significant growth, driven by increasing awareness of plant-based protein sources and demand from the vegan and vegetarian food industries (CBI, 2024). In India, Cowpea is cultivated on approximately 3.9 million hectares, yielding about 2.21 million tonnes, with an average productivity of 567 kg per hectare. Major cowpea-producing states include Tamil Nadu, Andhra Pradesh, Gujarat, Rajasthan, Maharashtra and Madhya Pradesh. For instance, in Nagaland, cowpea is cultivated in districts like Phek and Mon, with areas of 215 and 238 hectares, producing 334 and 344 tonnes respectively (NER Databank, 2023; Parmar et al., 2025).
       
However, cowpea production is frequently threatened by a variety of biotic stresses, particularly fungal and bacterial diseases. Major leaf diseases such as Bacterial wilt, Mosaic virus, Septoria leaf spot and viral infections like mosaic virus significantly reduce yield and quality (Nazarov et al., 2020; Nasir and Adhab, 2021; Deshpande et al., 2023). The Food and Agriculture Organization (FAO) estimates that plant diseases contribute to up to 20-30% of crop losses annually in developing countries, with cowpea being among the most affected pulses (FAO, 2024). In regions like Niger, for example, losses in cowpea value chains are estimated to exceed 30% due to poor disease management practices (FAO, 2024).
       
Traditional disease identification methods in cowpea cultivation rely heavily on visual inspection by farmers or agricultural extension workers (Mohammad et al., 2026; Paek et al., 2026; Souza et al., 2026). These techniques are time-consuming, subjective and prone to error, especially during early infection stages when symptoms may be subtle (Anaz et al., 2023). Moreover, access to expert pathologists is often limited in rural and low-resource areas. This underscores the need for reliable, scalable and cost-effective technologies to detect cowpea diseases at early stages with high precision (Chipeta et al., 2025).
       
Recent developments in artificial intelligence (AI) have improved image-based plant disease detection (Cho, 2024; Kim and AlZubi, 2024; Min et al., 2024). Deep learning has shown great success in identifying diseases in crops like fava bean, chickpea, groundnuts and black gram etc. (Bankina et al., 2021; Belay et al., 2022; Sasmal et al., 2024). Choudhary et al., (2021) employed an Inception-V3 CNN model using TensorFlow and Keras for binary classification of cowpea and mango leaves. The approach used transfer learning to enhance classification accuracy and also estimated leaf weight, demonstrating potential for smart agriculture applications. Megalingam et al., (2024) compared six deep learning models to classify cowpea leaf diseases using a dataset of 5,100 images. The Vision Transformer (ViT) model achieved the highest accuracy of 96%, outperforming InceptionV3, VGG16, VGG19, CNN and an ensemble model. Choudhary et al., (2022) evaluated five edge detection algorithms, SobelX, SobelY, Sobel Combined, Laplacian and Canny, on cowpea leaf images using OpenCV. Among them, the Canny algorithm outperformed others by producing clearer edges with minimal noise, making it the most effective method for highlighting leaf vein patterns.
       
However, cowpea disease detection using CNNs remains underexplored despite promising results in other crops. Most prior studies focus on binary classification, limited datasets, or shallow architectures, leaving a gap in developing robust multiclass classification models for cowpea diseases. There is also a lack of standardized evaluation using metrics like ROC-AUC, MCC and precision-recall curves in this domain.
       
This study is also aligned with the broader transition toward data-driven and sustainable agricultural systems. Precision agriculture increasingly integrates artificial intelligence, remote sensing and machine learning to support informed decision-making and efficient resource utilization (Bayar et al., 2025). Within this context, early detection of plant diseases may assist in enabling timely and targeted management practices. Such approaches can support strategies including integrated pest management and induced systemic resistance, which aim to reduce excessive chemical inputs and improve crop resilience (Choudhary et al., 2026). Related work by Adhab et al., (2025) discussed the gradual shift from conventional practices, such as the use of virus-free planting material, toward more integrated approaches involving plant-based treatments, induced resistance and vector management to enhance sustainable crop protection. In this perspective, AI-based disease detection models may be considered as supportive tools within broader precision agriculture frameworks, contributing to improved crop monitoring and management practices (Joshi et al., 2025).
       
This study proposes a DenseNet121-based deep learning model to identify fresh and diseased leaves of cowpea. It is designed to detect and classify four cowpea leaf classes. The model uses transfer learning and data augmentation to handle limited data. Its performance is measured using detailed metrics. The final goal is to create a smart, practical tool for early disease detection in real farm conditions.
Dataset preparation
 
The presented study employed a publicly accessible dataset of cowpea leaf images collected from reliable plant disease repositories (Rashid et al., 2024). The dataset consists of images representing both fresh and diseased cowpea leaves. Images were manually reviewed to ensure consistency in clarity, resolution and visible disease characteristics. Blurry, mislabeled, or poor-quality images were excluded from the final dataset. The data was categorized into four distinct classes: Fresh leaves, Bacterial wilt, Septoria leaf spot and Mosaic virus. A total of 2,273 images were retained and divided into training, validation and testing subsets. Specifically, 1,362 images were allocated for training, 454 for validation and 457 for testing. This division ensured balanced representation across all classes and minimized bias during the training and evaluation phases.
       
A visual representation of sample images from each class is shown in Fig 1, illustrating both diseased and fresh cowpea leaves.

Fig 1: Representative samples of cowpea leaf classes used in this study: Septoria leaf spot, fresh leaf, bacterial wilt and mosaic virus.


 
Data splitting and preprocessing
 
The dataset was organized into three folders corresponding to the training, validation and testing subsets. Each folder contained separate directories for the four target classes. This structure enabled seamless data loading using TensorFlow’s image_dataset_ from_ directory function. The images were resized uniformly to 224×224 pixels to match the input requirements of the DenseNet121 architecture.
       
To improve generalization and prevent overfitting, real-time data augmentation techniques were applied. These included random horizontal flipping, random rotation (up to 10%) and random zoom (up to 10%). A sequential layer was created using TensorFlow Keras API, combining these augmentation techniques. This allowed augmented images to be generated dynamically during training.
       
Before feeding the images into the model, they were passed through the preprocess_input function from the DenseNet module. This step normalized the pixel values according to the preprocessing scheme used during the model’s original training on the ImageNet dataset. The label mode was set to “categorical,” enabling one-hot encoding for multiclass classification.
       
All datasets were loaded in batches of 32 images and a consistent random seed of 123 was used to ensure reproducibility. While the training set included data augmentation, the validation and testing sets were kept unaltered and only preprocessed for input normalization. The shuffle parameter was set to False for the validation and test datasets to preserve the original order of the samples during evaluation.
 
Model architecture
 
The model used DenseNet121 as a backbone for feature extraction (Fig 2). The input layer accepts RGB images of shape (224, 224, 3). Each input image is denoted as X∈R(224×224×3). The DenseNet121 model, pre-trained on ImageNet, was loaded without its top classification layer using include_top=False. The first layer of DenseNet121 applies a 7×7 convolution with 64 filters and a stride of 2. This can be expressed as Equation (1).
 
              Y = Conv2D7×7 (X)                    ...(1)    

Fig 2: Architecture of the DenseNet121 model used for cowpea leaf disease classification.

 
This is followed by batch normalization, ReLU activation and a 3×3 max pooling layer with a stride of 2 to reduce spatial dimensions, as shown in Equation (2).
 
                 Y′ = MaxPool [ReLU (BatchNorm (Y)]                  ...(2)  
 
DenseNet121 is built using dense blocks and transition layers. Each dense block has multiple convolution layers, where each layer receives input from all previous layers. If a block has layers L1, L2, ..., Ln, then.
 
                       Ln = f[(L1, L2,...,Ln - 1)]                         ...(3)
 
Here, [ ]= Concatenation.
f= A sequence of operations: BatchNorm → ReLU → 1×1 Conv → BatchNorm → ReLU → 3×3 Conv.
       
This ensures feature reuse and efficient gradient flow. After each dense block, a transition layer is applied, expressed as Equation (4). This includes a 1×1 convolution to reduce feature map depth and a 2×2 average pooling to reduce spatial dimensions.
 
                          T = AvgPool [Conv2D1×1 (Ln)]                     ...(4)
 
At the end of the DenseNet121 base, a global average pooling is used. It converts each feature map into a single number by computing the average of all spatial values.

 
Where,
Fi,h,w= The value at location (h, w) in the ith feature map.
       
The result is a 1024-dimensional vector, G∈R1024. This output is passed to a Dense (fully connected) layer with 4 neurons, representing the 4 target classes. A softmax activation is used to convert logits into class probabilities.

 
Where,
zj= The logit for class j.
Pj= The predicted probability.
 
The final layer outputs Ŷ∈R4. The base model was frozen during training, so only the weights of the final Dense layer were updated. This reduced computational cost and prevented overfitting on the small cowpea dataset. The model was compiled using the Adam optimizer with a learning rate α = 5×10-5. The loss function was categorical crossentropy, calculated as:
 

 
yj= The true label.
ŷj= The predicted probability.
       
The model was trained using accuracy as the evaluation metric. The learning rate and batch size were selected based on empirical testing and guided by prior studies to ensure stable training and optimal performance (Feizi et al., 2023).
       
Two callbacks were used during training. The Model Check point saved the best model based on validation accuracy. The Early Stopping callback halted training if the model did not improve for 5 epochs.
 
Evaluation metrics
 
The model performance was evaluated using a series of standard classification metrics derived from the confusion matrix. Precision quantifies the proportion of correctly predicted positive observations and is defined as:


Recall measures the proportion of actual positives that were correctly identified, expressed as:


The F1-score balances precision and recall using the harmonic mean:


Accuracy indicates the overall correctness of the model’s predictions and is calculated as:


The matthews correlation coefficient (MCC) provides a balanced measure for binary and multiclass classification, defined as:


The ROC-AUC (One-vs-Rest) score evaluates class separability and is given by the area under the curve of true positive rate against false positive rate, denoted as:
 
       
Additionally, the precision-recall curve plots precision versus recall at various thresholds and the average precision (AP) represents the area under this curve, calculated as:


Together, these metrics offer a detailed assessment of the model’s predictive performance across all classes.
The DenseNet121 model was evaluated using both a frozen feature extractor and a fine-tuned (unfrozen) configuration to assess the impact of domain-specific learning (Fig 3). In the frozen setting, the model showed consistent improvement across training epochs. Initially, the model achieved a training accuracy of 40.18% and a validation accuracy of 40.53% in epoch 1. By epoch 10, training accuracy increased to 69.72%, while validation accuracy reached 68.72%. Further improvements were observed at epoch 25, with training accuracy of 88.88% and validation accuracy of 87.67%. The best validation performance occurred around epoch 47, where accuracy peaked at 92.51%. At the final epoch (50), the model achieved a training accuracy of 94.37% and a validation accuracy of 92.29%. The training loss decreased from 1.3385 in epoch 1 to 0.3429 in epoch 50. Similarly, validation loss declined from 1.2606 to 0.3471. Despite minor fluctuations, the model maintained stable convergence. The close alignment between training and validation curves indicates good generalization with minimal overfitting. Early stopping and checkpoint callbacks further improved robustness by restoring optimal weights.

Fig 3: Training and validation accuracy and loss curves for frozen and fine-tuned DenseNet121 models.


       
In the fine-tuned (unfrozen) configuration, the DenseNet121 model also demonstrated steady and smooth convergence (Fig 3). The model started with a training accuracy of 40.43% and a validation accuracy of 44.93% in epoch 1. By epoch 10, training accuracy increased to 77.78% and validation accuracy reached 74.45%. At epoch 25, training accuracy improved to 91.69%, while validation accuracy reached 88.11%. The best validation accuracy was observed around epoch 44, reaching 93.83%. At the final epoch (50), the model achieved a training accuracy of 95.93% and a validation accuracy of 93.83%. The training loss decreased from 1.3084 to 0.2751, while validation loss declined from 1.2400 to 0.2766 over the training period. The learning curves remained smooth, with only minor variations in later epochs. The close agreement between training and validation performance confirms stable learning and strong generalization.
       
A direct comparison between the two configurations shows that fine-tuning resulted in a modest improvement in performance (Table 1). The validation accuracy increased from 92.29% (frozen) to 93.83% (unfrozen), while validation loss decreased from 0.3471 to 0.2766. Although this improvement is consistent, it is relatively small. This indicates that the pre-trained DenseNet121 features were already highly effective for this agricultural classification task. The limited gain from fine-tuning suggests that the dataset contains visually distinct patterns that can be captured well without extensive parameter updates. Therefore, the frozen model serves as a strong baseline, while fine-tuning provides only marginal enhancement.

Table 1: Final epoch performance comparison of frozen and fine-tuned (unfrozen) DenseNet121 models.


       
Fine-tuning provided only a negligible improvement. The frozen DenseNet121 model was therefore selected for subsequent analyses. It ensures computational efficiency and stable performance without loss of accuracy.
       
Fig 4 shows the confusion matrix of the DenseNet121 model’s predictions (Frozen) across four classes of cowpea leaf images. The class Bacterial wilt achieved perfect classification. All 117 test images were predicted correctly with zero misclassification. This indicates the model learned the distinct visual patterns of bacterial wilt very effectively. In the Fresh Leaf class, out of 108 samples, 98 were correctly identified. However, 9 images were wrongly predicted as Mosaic virus and 1 as Septoria leaf spot. This confusion suggests some overlap in fresh and early-infected leaf appearances. This may be due to subtle visual similarities such as mild discoloration, early-stage mosaic patterns, or uneven lighting conditions that can make healthy leaves appear slightly diseased.

Fig 4: Confusion matrix of the DenseNet121 model (Frozen) for classification of cowpea leaf diseases into four classes: Bacterial wilt, fresh leaf, mosaic virus and septoria leaf spot.


       
For the mosaic virus class, 102 of the 116 images were classified correctly. The model misclassified 12 images as fresh leaf and 1 as septoria leaf spot. These misclassifications imply visual similarity between mosaic symptoms and normal foliage, possibly due to lighting or mild infection stages. In particular, early-stage mosaic infection often presents faint chlorotic patches that resemble natural leaf texture, making it difficult for the model to distinguish from healthy leaves. Variations in illumination, shadow and image capture conditions may further reduce contrast between diseased and healthy regions.
       
In the Septoria leaf spot category, 112 out of 116 samples were correctly predicted. Three images were misclassified as Bacterial wilt and one as Mosaic virus. This may indicate partial symptom resemblance in late-stage infections. Such errors may occur when lesion boundaries are unclear or when multiple symptoms overlap, reducing the distinctiveness of class-specific features. Overall, the model demonstrated high precision across all classes. The confusion matrix reveals that the majority of errors occurred between Fresh Leaf and Mosaic virus, highlighting the need for finer feature extraction in similar-looking conditions. This observation suggests that incorporating more diverse field images or applying fine-tuning of deeper layers may further improve discrimination between visually similar classes.
       
The classification performance of the DenseNet121 model (Frozen) was evaluated using several key metrics (Table 2). The bacterial wilt class achieved a precision of 0.9669 and a perfect recall of 1.0000, indicating that all 117 infected samples were correctly identified with minimal false positives. The resulting F1-score of 0.9832 highlights the model’s strong reliability in detecting this disease. For the fresh leaf class, the model yielded a precision of 0.8909 and a recall of 0.9074. While the accuracy was high, a few fresh samples were misclassified as diseased, leading to an F1-score of 0.8991. In the case of Mosaic virus, the model attained a precision of 0.9107 and a slightly lower recall of 0.8793. The F1-score of 0.8947 suggests good overall detection, though the model occasionally confused mosaic symptoms with other categories. The septoria leaf spot class performed exceptionally well, with a precision of 0.9825 and a recall of 0.9655. Its F1-score of 0.9739 demonstrates the model’s accuracy in identifying complex leaf spot patterns.

Table 2: Classification performance metrics for DenseNet 121 (Frozen) model for each cowpea leaf class, including precision, recall, F1-score and support.


       
The overall accuracy of the model was 93.87%, with both macro and weighted averages for precision, recall and F1-score hovering around 0.938. These consistent values indicate balanced performance across all four classes. In addition to these metrics, the Matthews Correlation Coefficient (MCC) was computed as 0.9184, reflecting a strong agreement between predicted and actual labels. The Multiclass AUC-ROC (OvR) score was 0.9931, suggesting the model is highly capable of distinguishing between the various disease categories.
       
Fig 5 presents the ROC curves of DenseNet 121-Frozen model for the four cowpea leaf classes using a one-vs-rest approach. The ROC curve illustrates the trade-off between the true positive rate (sensitivity) and the false positive rate for each class. The area under the curve (AUC) values are extremely high for all classes, indicating excellent class separability. Specifically, Bacterial wilt achieved an AUC of 0.9998, suggesting nearly perfect classification performance. Septoria leaf spot followed closely with an AUC of 0.9982. The fresh leaf class also performed well with an AUC of 0.9914, while Mosaic virus had a slightly lower but still strong AUC of 0.9831. The dashed line represents the performance of a random classifier. The curves remaining well above this line confirm that the model outperforms random guessing significantly for all classes.

Fig 5: Receiver operating characteristic (ROC) curves of DenseNet 121 (Frozen) model for the four cowpea leaf classes using a one-vs-rest approach.


       
Fig 6 shows the precision-recall (PR) curves of DenseNet 121-Frozen model for the four cowpea leaf classes using a one-vs-rest (OvR) setup. These curves are useful for evaluating model performance on imbalanced datasets. Precision represents the ratio of true positives to all predicted positives. Recall measures the proportion of true positives out of all actual positives. The bacterial wilt class shows a near-perfect curve with an average precision (AP) score of 0.9994. This indicates the model almost always makes correct positive predictions for this class. The fresh leaf class has an AP of 0.9867, showing strong precision and recall despite some misclassifications. The mosaic virus class achieved an AP of 0.9856. Its curve drops slightly at higher recall, suggesting a few false positives at broader thresholds. The septoria leaf spot class yielded an AP of 0.9983, which confirms excellent detection accuracy. All four curves maintain high precision across most recall values. This demonstrates the model’s reliability in distinguishing disease symptoms, especially when classifying harder-to-separate categories like fresh leaf and mosaic virus. Overall, the PR curves confirm that the model maintains high confidence in its predictions, even under relaxed decision thresholds.

Fig 6: Precision-recall curves of DenseNet 121 (Frozen) model for the four cowpea leaf classes.


       
Fig 7 displays sample predictions made by the DenseNet 121-Frozen model. Each image shows a cowpea leaf alongside its true label, predicted label and the model’s confidence score. All samples are correctly classified with high confidence values above 0.99. The top row includes three Bacterial wilt samples. Each shows symptoms such as curling, yellowing, or spots. The model identified all of them accurately. Confidence values range from 0.9944 to 0.9959, indicating strong certainty in its predictions. The bottom row contains one septoria leaf spot sample and two additional bacterial wilt samples. The septoria leaf displays visible dark lesions typical of this disease. The model correctly classified it with a confidence of 0.9937. The last two samples again show signs of Bacterial wilt, including discoloration and shrivelling. These were predicted correctly with high confidence. The figure confirms that the model performs reliably on clear disease cases. High confidence values support that the model is not only accurate but also sure of its decisions. This is especially important for use in real-world disease detection tasks.

Fig 7: Sample predictions of the DenseNet121 model (Frozen) showing cowpea leaf images with their true labels, predicted labels and corresponding confidence scores.


       
DenseNet121 and other deep learning models show different levels of performance across studies because of variations in crops, dataset size, number of classes and task complexity (Table 3).  The present study achieved a test accuracy of 93.87% using a DenseNet-121 model to classify four classes of cowpea leaf conditions. Compared to prior work, this performance demonstrates strong competitiveness. For example, Dubey et al., (2022) reported 99.00% accuracy using DenseNet-121 on a larger and more diverse 15-class crop leaf dataset, while Girmaw and Muluneh (2024) achieved 98.33% for field pea leaves, also using DenseNet-121, but on only three classes. In contrast, Arathi and Dulhare (2023) applied DenseNet-121 to cotton leaf disease detection, achieving 91% and Saputra et al., (2023) reported 91.67% on rice leaf disease classification, showing that the presented model performs better than or on par with DenseNet-based models in other crops.

Table 3: Comparison of the proposed DenseNet121 model with existing deep learning approaches for plant disease classification across different crops and datasets.


       
For cowpea-specific studies, Choudhary et al., (2023) used DenseNet-121 to distinguish cowpea from weed leaves, achieving 88.89% test accuracy. Additionally, Trivedi et al., (2024) used a segmentation-based LinkNet-34 model with DenseNet-121 as an encoder and achieved 97.57% validation accuracy on a mixed dataset, highlighting the potential of combining segmentation with classification. The comparison results are taken from the literature. They are based on different datasets and experimental settings. Therefore, identical training or testing splits were not used.
       
Overall, the presented study contributes significantly to the underexplored domain of multiclass cowpea disease detection, demonstrating promising performance with potential for deployment in real-world agricultural scenarios.
This study developed a DenseNet121-based deep learning model to classify cowpea leaf diseases into four categories. The model achieved a test accuracy of 93.87%, showing strong performance across all classes. The Bacterial wilt class achieved perfect recall and high precision. Misclassification mainly occurred between visually similar classes, such as fresh leaf and Mosaic virus due to subtle symptom variations. Despite promising results, the study had limitations. The dataset was moderate in size and collected under ideal conditions. Field scenarios with variable lighting, complex backgrounds, or occlusions may affect accuracy. Class imbalance may also have influenced some predictions. Additionally, the DenseNet121 base model was kept frozen during training. This might have limited its learning capacity. In future work, the dataset can be expanded with more diverse images from different regions of India. Fine-tuning DenseNet121 or using lighter models like MobileNetV3 will help improve performance and enable mobile deployment. Adding environmental or time-series data may also boost prediction accuracy. Integration with mobile apps or edge devices could support real-time detection. This can help farmers detect diseases early and manage crops more efficiently.
This work was supported by Hanshin University Research grant.
 
Disclaimers
 
The views and conclusions expressed in this article are solely those of the authors and do not necessarily represent the views of their affiliated institutions. The authors are responsible for the accuracy and completeness of the information provided, but do not accept any liability for any direct or indirect losses resulting from the use of this content.
 
Data availability
 
The data analysed/generated in the present study will be made available from corresponding author upon reasonable request.
 
Availability of data and materials
 
Not applicable.
 
Use of artificial intelligence
 
Not applicable.
 
Declarations
 
Author declares that all works are original and this manuscript has not been published in any other journal.
The author declare that he has no conflict of interest.

  1. Abebe, B.K. and Alemayehu, M.T. (2022). A review of the nutritional use of cowpea [Vigna unguiculata (L.) Walp] for human and animal diets. Journal of Agriculture and Food Research. 10: 100383. https://doi.org/10.1016/j.jafr.2022.100383.

  2. Adhab, M., Ezzulddin, D.L. and Ahmed, A.S. (2025). Cultivating resilience: Sustainable plant virus control in Iraq’s agricultural landscape. BIO Web of Conferences. 192: 06002. https://doi.org/10.1051/bioconf/202519206002.

  3. Anaz, A., Kadhim, N., Sadoon, O., Alwan, G. and Adhab, M. (2023). Sustainable utilization of machine-vision-technique- based algorithm in objective evaluation of confocal microscope images. Sustainability. 15(4): 3726. https:// doi.org/10.3390/su15043726.

  4. Arathi, B. and Dulhare, U.N. (2023). Classification of Cotton Leaf Diseases Using Transfer Learning-DenseNet-121. In Lecture Notes in Networks and Systems. (pp. 393-405). https://doi.org/10.1007/978-981-19-9228-5_33.

  5. Bankina, B., Bimšteine, G., Kaņeps, J., Plūduma-Pauniņa, I., Gaile, Z., Paura, L. and Stoddard, F.L. (2021). Discrimination of leaf diseases affecting faba bean (Vicia faba). Acta Agriculturae Scandinavica Section B-Soil and Plant Science. 71(5): 399-407. https://doi.org/10.1080/ 09064710.2021.1903985.

  6. Bayar, J., Ali, N., Cao, Z., Ren, Y. and Dong, Y. (2025). Artificial intelligence of things (AIoT) for precision agriculture: Applications in smart irrigation, nutrient and disease management. Smart Agricultural Technology. 12: 101629.  https://doi.org/10.1016/j.atech.2025.101629.

  7. Belay, A.J., Salau, A.O., Ashagrie, M. and Haile, M.B. (2022). Development of a chickpea disease detection and classification model using deep learning. Informatics in Medicine Unlocked. 31: 100970. https://doi.org/10.1016/ j.imu.2022.100970.

  8. CBI. (2024). Exporting Cowpeas to Europe: Market Potential. Centre for the Promotion of Imports from Developing Countries. https://www.cbi.eu/market-information/grains-pulses- oilseeds/cowpeas/market-potential.

  9. Chipeta, M.M., Kafwambira, J. and Yohane, E. (2025). Cowpea genetic diversity, population structure and genome-wide association studies in Malawi: Insights for breeding programs. Frontiers in Plant Science. 15. https://doi.org/ 10.3389/fpls.2024.1461631.

  10. Cho, O.H. (2024). An evaluation of various machine learning approaches for detecting leaf diseases in agriculture. Legume Research. 47(4): 619-627. doi: 10.18805/LRF-787.

  11. Choudhary, V., Guha, P., Tripathi, K. and Mishra, S. (2021). Automatic Detection of Cowpea Leaves Using Image Processing and Inception-V3 Model of Deep Learning. 2021 6th International Conference on Signal Processing, Computing and Control (ISPCC). 314-318. https://doi.org/10.1109/ ISPCC53510.2021.9609358.

  12. Choudhary, V., Guha, P., Tripathi, K. and Mishra, S. (2022). Edge Detection of Variety of Cowpea Leaves Using OpenCV and Deep Learning. In 2022 4th International Conference on Advances in Computing, Communication Control and Networking (ICAC3N). IEEE. (pp. 1312-1316). https:// doi.org/10.1109/ICAC3N56670.2022.10074348.

  13. Choudhary, V., Guha, P., Pau, G., Dhanaraj, R.K. and Mishra, S. (2023). Automatic classification of cowpea leaves using deep convolutional neural network. Smart Agricultural Technology. 4: 100209. https://doi.org/10.1016/j.atech. 2023.100209.

  14. Choudhary, V., Kumar, S.P. and Saimbhi, V.S. (2026). A brief review on potential applications of drones in agriculture. Next Research. 5: 101309. https://doi.org/10.1016/j.nexres. 2026.101309.

  15. Deshpande, S.K., Kavyashree, N.M., Singh, K., Ramya, K.R., Sharma, N. and Tripathi, K. (2023). Diseases in Cowpea [Vigna unguiculata (L.) Walp.]: Next Generation Breeding Techniques for Developing Disease-Resistant Cowpea. In: Diseases in Legume Crops. [Jha, U.C., Nayyar, H., Sharma, K.D., von Wettberg, E.J.B., Singh, P. and Siddique, K.H. (Eds.)], Springer. (pp. 125-139). https://doi.org/ 10.1007/978-981-99-3358-7_6.

  16. Paek, J.J., Kim, J., Bae, S., Paek, K.S. and Lee, Y. (2026). Chive- fortified fermentation enhances gamma-aminobutyric acid production by Levilactobacillus brevis PL9014. International Journal of Probiotics and Prebiotics. 21: 1-6. https://doi.org/10.37290/ijpp.v21i1.12.

  17. Dubey, N., Bhagat, E., Rana, S. and Pathak, K. (2022). A Novel Approach to Detect Plant Disease Using DenseNet-121 Neural Network. In: Lecture Notes in Networks and Systems. (pp. 63-74). https://doi.org/10.1007/978-981- 16-9967-2_7.

  18. Feizi, H., Sattari, M.T. and Apaydin, H. (2023). A comparative study of different optimization algorithms for the optimum operation of the mahabad dam reservoir. Results in Engineering. 21: 101664. https://doi.org/10.1016/j.rineng.2023.101664.

  19. Food and Agriculture Organization of the United Nations (FAO). (2024). A new Report Sheds Light on Losses Across Agricultural and Agrifood Value Chains in Niger. https:// www.fao.org/in-action/agrisurvey/news/news-detail/a- new-report-sheds-light-on-losses-across-agricultural- and-agrifood-value-chains-in-niger/en.

  20. Girmaw, D.W. and Muluneh, T.W. (2024). Field pea leaf disease classification using a deep learning approach. Plos One. 19(7): e0307747. https://doi.org/10.1371/journal.pone. 0307747.

  21. Jayathilake, C., Visvanathan, R., Deen, A., Bangamuwage, R., Jayawardana, B., Nammi, S. and Liyanage, R. (2018). Cowpea: An overview on its nutritional facts and health benefits. Journal of the Science of Food and Agriculture. 98(13): 4793-4806. https://doi.org/10.1002/jsfa.9074.

  22. Joshi, P., Chauhan, C., Ubale, R., Patil, N., Malusare, V. and Patil, S. (2025). Smart Farming: A Comprehensive Review on the Role of Artificial Intelligence and IoT in Modern Agriculture. In Advances in Intelligent Systems Research/ Advances in Intelligent Systems Research. (pp. 1005- 1025). https://doi.org/10.2991/978-94-6463-948-3_69.

  23. Kim, S.Y. and AlZubi, A.A. (2024). Blockchain and artificial intelligence for ensuring the authenticity of organic legume products in supply chains. Legume Research. 47(7): 1144-1150. doi: 10.18805/LRF-786.

  24. Market Data Forecast. (2024). Cowpeas Market Size, Growth (2024-2033). https://www.marketdataforecast.com/ market-reports/global-cowpeas-market.

  25. Megalingam, R.K., Menon, G.G., Swathi, B., Sai, D.A., Kunnambath, A.R. and Manoharan, S.K. (2024). Cowpea leaf disease identification using deep learning. Smart Agricultural Technology. pp 100662. https://doi.org/10.1016/j.atech. 2024.100662.

  26. Min, P.K., Mito, K. and Kim, T.H. (2024). The evolving landscape of artificial intelligence applications in animal health. Indian Journal of Animal Research. 58(10): 1793-1798. doi: 10.18805/IJAR.BF-1742.

  27. Mohammad, A.A.S., Mohammad, S.I., Vasudevan, A. and Heindric, A. (2026). Intelligent decision support system for crop management using data analytics. Journal of Experimental  Biology and Agricultural Sciences. 14(3): 9-14.

  28. Nasir, A.A. and Adhab, M. (2021). A Biologically Distinct Isolate of Cucumber Mosaic Virus from Iraq. In: Proceedings of the Third International Sustainability and Resilience Conference: Climate Change. IEEE. (pp. 148-150). https:// doi.org/10.1109/IEEECONF53624.2021.9668142.

  29. Nazarov, P.A., Baleev, D.N., Ivanova, M.I., Sokolova, L.M. and Karakozova, M.V. (2020). Infectious plant diseases: etiology, current status, problems and prospects in plant protection. Acta Naturae. 12(3): 46-59. https://doi.org/ 10.32607/actanaturae.11026.

  30. NER Databank. (2023). Pulses. Retrieved from https://databank. nedfi.com/nagaland-agriculture/pulses.

  31. Parmar, H. K., Sharma, M., Patel, P., Soni, N. and Zala, H. (2025). Breeding cowpea (Vigna unguiculata L.) for high seed yield, protein content and harvest index: Genetic parameters to identify useful parents. Legume Research. 49(5): 775-780. doi: 10.18805/LR-5381.

  32. Rashid, M.R.A., Hasan, M., Gani, R., Kamara, R., Tarin, T.K. and Rabbi, S.F. (2024). Image Dataset for Bean and Cowpea Plant Leaf Disease Detection and Freshness Assessment from Bangladesh. Mendeley Data. https://doi.org/ 10.17632/ykvcrjffzd.1

  33. Saputra, A.D., Hindarto, D. and Santoso, H. (2023). Disease classification on rice leaves using DenseNet121, DenseNet169, DenseNet201. SinkrOn. 8(1): 48-55. https://doi.org/10.33395/sinkron.v8i1.11906.

  34. Sasmal, B., Das, A., Dhal, K.G., Saheb, S.B., Khurma, R.A. and Castillo, P.A. (2024). A novel groundnut leaf dataset for detection and classification of groundnut leaf diseases. Data in Brief. 55: 110763. https://doi.org/10.1016/j.dib. 2024.110763.

  35. Souza, K.F., Gonçalves, L.C.O. and Espindola, F.S. (2026). A broad overview of the multifaceted royal jelly and its applicability in health and performance. Current Topics in Nutraceutical Research. 24(1): 4-14. https://doi.org/10.37290/ctnrv24.i1.8.

  36. Trivedi, P., Narayan, Y., Ravi, V., Kumar, P., Kaur, P., Tabianan, K., Singh, P. and Diwakar, M. (2024). Plant leaf disease detection and classification using segmentation encoder techniques. The Open Agriculture Journal. 18(1). https:// doi.org/10.2174/0118743315321139240627092707.

A DenseNet121-based Deep Learning Approach for Multi-class Classification of Cowpea Leaf Diseases

S
Seng-Phil Hong1,*
1School of Computing and AI, HanShin University 137, Hanshindae-gil, Osan-si, Gyeonggi-do, Republic of Korea.
  • Submitted24-03-2026|

  • Accepted29-07-2026|

  • First Online 22-08-2026|

  • doi 10.18805/LR-5659

Background: Cowpea is a drought-resilient legume that is important in India, Africa and parts of Asia. In India, it is widely cultivated in arid and semi-arid regions, supporting rural nutrition and income. Leaf diseases, however, significantly reduce yields, making AI-based detection systems essential for timely and accurate diagnosis.

Methods: This study presents a deep learning framework using DenseNet121 for multi-class classification of cowpea leaf conditions: Bacterial wilt, septoria leaf spot, mosaic virus and fresh leaves. A total of 2,273 annotated images were curated, preprocessed and divided into training, validation and test sets. Real-time data augmentation and transfer learning techniques were employed to improve model generalization. The model was trained using categorical cross-entropy loss and evaluated with various metrics.

Result: The model achieved a test accuracy of 93.87%, with strong F1-scores and precision across all four classes. The matthews correlation coefficient (MCC) was 0.9184, indicating high reliability, while the multi-class ROC-AUC score reached 0.9931, showing excellent class separability. Confusion matrix and precision–recall analysis further confirmed robust performance, especially for bacterial wilt and Septoria leaf spot. These results support the model’s potential for integration into smart agricultural systems for early disease detection in cowpea cultivation.

Cowpea (Vigna unguiculata), a drought-resistant legume crop, plays an important role in food security, especially across sub-Saharan Africa, Asia and parts of Latin America. It is valued not only for its nutritional profile, rich in protein, dietary fiber and essential micronutrients, but also for its agronomic benefits, such as nitrogen fixation and adaptability to marginal soils (Jayathilake et al., 2018; Abebe and Alemayehu, 2022). As of 2022, global cowpea production reached approximately 9.8 million metric tons, cultivated over 15.2 million hectares. Africa dominates this production, contributing around 9.5 million metric tons from 14.9 million hectares. Nigeria and Niger are the leading producers, with Nigeria accounting for about 42% and Niger 29% of global output. The global cowpeas market was valued at USD 7.61 billion in 2024 and is projected to grow at a CAGR of 5.5%, reaching USD 12.32 billion by 2033 (Market Data Forecast, 2024). Cowpea exports to Europe and other regions have also seen significant growth, driven by increasing awareness of plant-based protein sources and demand from the vegan and vegetarian food industries (CBI, 2024). In India, Cowpea is cultivated on approximately 3.9 million hectares, yielding about 2.21 million tonnes, with an average productivity of 567 kg per hectare. Major cowpea-producing states include Tamil Nadu, Andhra Pradesh, Gujarat, Rajasthan, Maharashtra and Madhya Pradesh. For instance, in Nagaland, cowpea is cultivated in districts like Phek and Mon, with areas of 215 and 238 hectares, producing 334 and 344 tonnes respectively (NER Databank, 2023; Parmar et al., 2025).
       
However, cowpea production is frequently threatened by a variety of biotic stresses, particularly fungal and bacterial diseases. Major leaf diseases such as Bacterial wilt, Mosaic virus, Septoria leaf spot and viral infections like mosaic virus significantly reduce yield and quality (Nazarov et al., 2020; Nasir and Adhab, 2021; Deshpande et al., 2023). The Food and Agriculture Organization (FAO) estimates that plant diseases contribute to up to 20-30% of crop losses annually in developing countries, with cowpea being among the most affected pulses (FAO, 2024). In regions like Niger, for example, losses in cowpea value chains are estimated to exceed 30% due to poor disease management practices (FAO, 2024).
       
Traditional disease identification methods in cowpea cultivation rely heavily on visual inspection by farmers or agricultural extension workers (Mohammad et al., 2026; Paek et al., 2026; Souza et al., 2026). These techniques are time-consuming, subjective and prone to error, especially during early infection stages when symptoms may be subtle (Anaz et al., 2023). Moreover, access to expert pathologists is often limited in rural and low-resource areas. This underscores the need for reliable, scalable and cost-effective technologies to detect cowpea diseases at early stages with high precision (Chipeta et al., 2025).
       
Recent developments in artificial intelligence (AI) have improved image-based plant disease detection (Cho, 2024; Kim and AlZubi, 2024; Min et al., 2024). Deep learning has shown great success in identifying diseases in crops like fava bean, chickpea, groundnuts and black gram etc. (Bankina et al., 2021; Belay et al., 2022; Sasmal et al., 2024). Choudhary et al., (2021) employed an Inception-V3 CNN model using TensorFlow and Keras for binary classification of cowpea and mango leaves. The approach used transfer learning to enhance classification accuracy and also estimated leaf weight, demonstrating potential for smart agriculture applications. Megalingam et al., (2024) compared six deep learning models to classify cowpea leaf diseases using a dataset of 5,100 images. The Vision Transformer (ViT) model achieved the highest accuracy of 96%, outperforming InceptionV3, VGG16, VGG19, CNN and an ensemble model. Choudhary et al., (2022) evaluated five edge detection algorithms, SobelX, SobelY, Sobel Combined, Laplacian and Canny, on cowpea leaf images using OpenCV. Among them, the Canny algorithm outperformed others by producing clearer edges with minimal noise, making it the most effective method for highlighting leaf vein patterns.
       
However, cowpea disease detection using CNNs remains underexplored despite promising results in other crops. Most prior studies focus on binary classification, limited datasets, or shallow architectures, leaving a gap in developing robust multiclass classification models for cowpea diseases. There is also a lack of standardized evaluation using metrics like ROC-AUC, MCC and precision-recall curves in this domain.
       
This study is also aligned with the broader transition toward data-driven and sustainable agricultural systems. Precision agriculture increasingly integrates artificial intelligence, remote sensing and machine learning to support informed decision-making and efficient resource utilization (Bayar et al., 2025). Within this context, early detection of plant diseases may assist in enabling timely and targeted management practices. Such approaches can support strategies including integrated pest management and induced systemic resistance, which aim to reduce excessive chemical inputs and improve crop resilience (Choudhary et al., 2026). Related work by Adhab et al., (2025) discussed the gradual shift from conventional practices, such as the use of virus-free planting material, toward more integrated approaches involving plant-based treatments, induced resistance and vector management to enhance sustainable crop protection. In this perspective, AI-based disease detection models may be considered as supportive tools within broader precision agriculture frameworks, contributing to improved crop monitoring and management practices (Joshi et al., 2025).
       
This study proposes a DenseNet121-based deep learning model to identify fresh and diseased leaves of cowpea. It is designed to detect and classify four cowpea leaf classes. The model uses transfer learning and data augmentation to handle limited data. Its performance is measured using detailed metrics. The final goal is to create a smart, practical tool for early disease detection in real farm conditions.
Dataset preparation
 
The presented study employed a publicly accessible dataset of cowpea leaf images collected from reliable plant disease repositories (Rashid et al., 2024). The dataset consists of images representing both fresh and diseased cowpea leaves. Images were manually reviewed to ensure consistency in clarity, resolution and visible disease characteristics. Blurry, mislabeled, or poor-quality images were excluded from the final dataset. The data was categorized into four distinct classes: Fresh leaves, Bacterial wilt, Septoria leaf spot and Mosaic virus. A total of 2,273 images were retained and divided into training, validation and testing subsets. Specifically, 1,362 images were allocated for training, 454 for validation and 457 for testing. This division ensured balanced representation across all classes and minimized bias during the training and evaluation phases.
       
A visual representation of sample images from each class is shown in Fig 1, illustrating both diseased and fresh cowpea leaves.

Fig 1: Representative samples of cowpea leaf classes used in this study: Septoria leaf spot, fresh leaf, bacterial wilt and mosaic virus.


 
Data splitting and preprocessing
 
The dataset was organized into three folders corresponding to the training, validation and testing subsets. Each folder contained separate directories for the four target classes. This structure enabled seamless data loading using TensorFlow’s image_dataset_ from_ directory function. The images were resized uniformly to 224×224 pixels to match the input requirements of the DenseNet121 architecture.
       
To improve generalization and prevent overfitting, real-time data augmentation techniques were applied. These included random horizontal flipping, random rotation (up to 10%) and random zoom (up to 10%). A sequential layer was created using TensorFlow Keras API, combining these augmentation techniques. This allowed augmented images to be generated dynamically during training.
       
Before feeding the images into the model, they were passed through the preprocess_input function from the DenseNet module. This step normalized the pixel values according to the preprocessing scheme used during the model’s original training on the ImageNet dataset. The label mode was set to “categorical,” enabling one-hot encoding for multiclass classification.
       
All datasets were loaded in batches of 32 images and a consistent random seed of 123 was used to ensure reproducibility. While the training set included data augmentation, the validation and testing sets were kept unaltered and only preprocessed for input normalization. The shuffle parameter was set to False for the validation and test datasets to preserve the original order of the samples during evaluation.
 
Model architecture
 
The model used DenseNet121 as a backbone for feature extraction (Fig 2). The input layer accepts RGB images of shape (224, 224, 3). Each input image is denoted as X∈R(224×224×3). The DenseNet121 model, pre-trained on ImageNet, was loaded without its top classification layer using include_top=False. The first layer of DenseNet121 applies a 7×7 convolution with 64 filters and a stride of 2. This can be expressed as Equation (1).
 
              Y = Conv2D7×7 (X)                    ...(1)    

Fig 2: Architecture of the DenseNet121 model used for cowpea leaf disease classification.

 
This is followed by batch normalization, ReLU activation and a 3×3 max pooling layer with a stride of 2 to reduce spatial dimensions, as shown in Equation (2).
 
                 Y′ = MaxPool [ReLU (BatchNorm (Y)]                  ...(2)  
 
DenseNet121 is built using dense blocks and transition layers. Each dense block has multiple convolution layers, where each layer receives input from all previous layers. If a block has layers L1, L2, ..., Ln, then.
 
                       Ln = f[(L1, L2,...,Ln - 1)]                         ...(3)
 
Here, [ ]= Concatenation.
f= A sequence of operations: BatchNorm → ReLU → 1×1 Conv → BatchNorm → ReLU → 3×3 Conv.
       
This ensures feature reuse and efficient gradient flow. After each dense block, a transition layer is applied, expressed as Equation (4). This includes a 1×1 convolution to reduce feature map depth and a 2×2 average pooling to reduce spatial dimensions.
 
                          T = AvgPool [Conv2D1×1 (Ln)]                     ...(4)
 
At the end of the DenseNet121 base, a global average pooling is used. It converts each feature map into a single number by computing the average of all spatial values.

 
Where,
Fi,h,w= The value at location (h, w) in the ith feature map.
       
The result is a 1024-dimensional vector, G∈R1024. This output is passed to a Dense (fully connected) layer with 4 neurons, representing the 4 target classes. A softmax activation is used to convert logits into class probabilities.

 
Where,
zj= The logit for class j.
Pj= The predicted probability.
 
The final layer outputs Ŷ∈R4. The base model was frozen during training, so only the weights of the final Dense layer were updated. This reduced computational cost and prevented overfitting on the small cowpea dataset. The model was compiled using the Adam optimizer with a learning rate α = 5×10-5. The loss function was categorical crossentropy, calculated as:
 

 
yj= The true label.
ŷj= The predicted probability.
       
The model was trained using accuracy as the evaluation metric. The learning rate and batch size were selected based on empirical testing and guided by prior studies to ensure stable training and optimal performance (Feizi et al., 2023).
       
Two callbacks were used during training. The Model Check point saved the best model based on validation accuracy. The Early Stopping callback halted training if the model did not improve for 5 epochs.
 
Evaluation metrics
 
The model performance was evaluated using a series of standard classification metrics derived from the confusion matrix. Precision quantifies the proportion of correctly predicted positive observations and is defined as:


Recall measures the proportion of actual positives that were correctly identified, expressed as:


The F1-score balances precision and recall using the harmonic mean:


Accuracy indicates the overall correctness of the model’s predictions and is calculated as:


The matthews correlation coefficient (MCC) provides a balanced measure for binary and multiclass classification, defined as:


The ROC-AUC (One-vs-Rest) score evaluates class separability and is given by the area under the curve of true positive rate against false positive rate, denoted as:
 
       
Additionally, the precision-recall curve plots precision versus recall at various thresholds and the average precision (AP) represents the area under this curve, calculated as:


Together, these metrics offer a detailed assessment of the model’s predictive performance across all classes.
The DenseNet121 model was evaluated using both a frozen feature extractor and a fine-tuned (unfrozen) configuration to assess the impact of domain-specific learning (Fig 3). In the frozen setting, the model showed consistent improvement across training epochs. Initially, the model achieved a training accuracy of 40.18% and a validation accuracy of 40.53% in epoch 1. By epoch 10, training accuracy increased to 69.72%, while validation accuracy reached 68.72%. Further improvements were observed at epoch 25, with training accuracy of 88.88% and validation accuracy of 87.67%. The best validation performance occurred around epoch 47, where accuracy peaked at 92.51%. At the final epoch (50), the model achieved a training accuracy of 94.37% and a validation accuracy of 92.29%. The training loss decreased from 1.3385 in epoch 1 to 0.3429 in epoch 50. Similarly, validation loss declined from 1.2606 to 0.3471. Despite minor fluctuations, the model maintained stable convergence. The close alignment between training and validation curves indicates good generalization with minimal overfitting. Early stopping and checkpoint callbacks further improved robustness by restoring optimal weights.

Fig 3: Training and validation accuracy and loss curves for frozen and fine-tuned DenseNet121 models.


       
In the fine-tuned (unfrozen) configuration, the DenseNet121 model also demonstrated steady and smooth convergence (Fig 3). The model started with a training accuracy of 40.43% and a validation accuracy of 44.93% in epoch 1. By epoch 10, training accuracy increased to 77.78% and validation accuracy reached 74.45%. At epoch 25, training accuracy improved to 91.69%, while validation accuracy reached 88.11%. The best validation accuracy was observed around epoch 44, reaching 93.83%. At the final epoch (50), the model achieved a training accuracy of 95.93% and a validation accuracy of 93.83%. The training loss decreased from 1.3084 to 0.2751, while validation loss declined from 1.2400 to 0.2766 over the training period. The learning curves remained smooth, with only minor variations in later epochs. The close agreement between training and validation performance confirms stable learning and strong generalization.
       
A direct comparison between the two configurations shows that fine-tuning resulted in a modest improvement in performance (Table 1). The validation accuracy increased from 92.29% (frozen) to 93.83% (unfrozen), while validation loss decreased from 0.3471 to 0.2766. Although this improvement is consistent, it is relatively small. This indicates that the pre-trained DenseNet121 features were already highly effective for this agricultural classification task. The limited gain from fine-tuning suggests that the dataset contains visually distinct patterns that can be captured well without extensive parameter updates. Therefore, the frozen model serves as a strong baseline, while fine-tuning provides only marginal enhancement.

Table 1: Final epoch performance comparison of frozen and fine-tuned (unfrozen) DenseNet121 models.


       
Fine-tuning provided only a negligible improvement. The frozen DenseNet121 model was therefore selected for subsequent analyses. It ensures computational efficiency and stable performance without loss of accuracy.
       
Fig 4 shows the confusion matrix of the DenseNet121 model’s predictions (Frozen) across four classes of cowpea leaf images. The class Bacterial wilt achieved perfect classification. All 117 test images were predicted correctly with zero misclassification. This indicates the model learned the distinct visual patterns of bacterial wilt very effectively. In the Fresh Leaf class, out of 108 samples, 98 were correctly identified. However, 9 images were wrongly predicted as Mosaic virus and 1 as Septoria leaf spot. This confusion suggests some overlap in fresh and early-infected leaf appearances. This may be due to subtle visual similarities such as mild discoloration, early-stage mosaic patterns, or uneven lighting conditions that can make healthy leaves appear slightly diseased.

Fig 4: Confusion matrix of the DenseNet121 model (Frozen) for classification of cowpea leaf diseases into four classes: Bacterial wilt, fresh leaf, mosaic virus and septoria leaf spot.


       
For the mosaic virus class, 102 of the 116 images were classified correctly. The model misclassified 12 images as fresh leaf and 1 as septoria leaf spot. These misclassifications imply visual similarity between mosaic symptoms and normal foliage, possibly due to lighting or mild infection stages. In particular, early-stage mosaic infection often presents faint chlorotic patches that resemble natural leaf texture, making it difficult for the model to distinguish from healthy leaves. Variations in illumination, shadow and image capture conditions may further reduce contrast between diseased and healthy regions.
       
In the Septoria leaf spot category, 112 out of 116 samples were correctly predicted. Three images were misclassified as Bacterial wilt and one as Mosaic virus. This may indicate partial symptom resemblance in late-stage infections. Such errors may occur when lesion boundaries are unclear or when multiple symptoms overlap, reducing the distinctiveness of class-specific features. Overall, the model demonstrated high precision across all classes. The confusion matrix reveals that the majority of errors occurred between Fresh Leaf and Mosaic virus, highlighting the need for finer feature extraction in similar-looking conditions. This observation suggests that incorporating more diverse field images or applying fine-tuning of deeper layers may further improve discrimination between visually similar classes.
       
The classification performance of the DenseNet121 model (Frozen) was evaluated using several key metrics (Table 2). The bacterial wilt class achieved a precision of 0.9669 and a perfect recall of 1.0000, indicating that all 117 infected samples were correctly identified with minimal false positives. The resulting F1-score of 0.9832 highlights the model’s strong reliability in detecting this disease. For the fresh leaf class, the model yielded a precision of 0.8909 and a recall of 0.9074. While the accuracy was high, a few fresh samples were misclassified as diseased, leading to an F1-score of 0.8991. In the case of Mosaic virus, the model attained a precision of 0.9107 and a slightly lower recall of 0.8793. The F1-score of 0.8947 suggests good overall detection, though the model occasionally confused mosaic symptoms with other categories. The septoria leaf spot class performed exceptionally well, with a precision of 0.9825 and a recall of 0.9655. Its F1-score of 0.9739 demonstrates the model’s accuracy in identifying complex leaf spot patterns.

Table 2: Classification performance metrics for DenseNet 121 (Frozen) model for each cowpea leaf class, including precision, recall, F1-score and support.


       
The overall accuracy of the model was 93.87%, with both macro and weighted averages for precision, recall and F1-score hovering around 0.938. These consistent values indicate balanced performance across all four classes. In addition to these metrics, the Matthews Correlation Coefficient (MCC) was computed as 0.9184, reflecting a strong agreement between predicted and actual labels. The Multiclass AUC-ROC (OvR) score was 0.9931, suggesting the model is highly capable of distinguishing between the various disease categories.
       
Fig 5 presents the ROC curves of DenseNet 121-Frozen model for the four cowpea leaf classes using a one-vs-rest approach. The ROC curve illustrates the trade-off between the true positive rate (sensitivity) and the false positive rate for each class. The area under the curve (AUC) values are extremely high for all classes, indicating excellent class separability. Specifically, Bacterial wilt achieved an AUC of 0.9998, suggesting nearly perfect classification performance. Septoria leaf spot followed closely with an AUC of 0.9982. The fresh leaf class also performed well with an AUC of 0.9914, while Mosaic virus had a slightly lower but still strong AUC of 0.9831. The dashed line represents the performance of a random classifier. The curves remaining well above this line confirm that the model outperforms random guessing significantly for all classes.

Fig 5: Receiver operating characteristic (ROC) curves of DenseNet 121 (Frozen) model for the four cowpea leaf classes using a one-vs-rest approach.


       
Fig 6 shows the precision-recall (PR) curves of DenseNet 121-Frozen model for the four cowpea leaf classes using a one-vs-rest (OvR) setup. These curves are useful for evaluating model performance on imbalanced datasets. Precision represents the ratio of true positives to all predicted positives. Recall measures the proportion of true positives out of all actual positives. The bacterial wilt class shows a near-perfect curve with an average precision (AP) score of 0.9994. This indicates the model almost always makes correct positive predictions for this class. The fresh leaf class has an AP of 0.9867, showing strong precision and recall despite some misclassifications. The mosaic virus class achieved an AP of 0.9856. Its curve drops slightly at higher recall, suggesting a few false positives at broader thresholds. The septoria leaf spot class yielded an AP of 0.9983, which confirms excellent detection accuracy. All four curves maintain high precision across most recall values. This demonstrates the model’s reliability in distinguishing disease symptoms, especially when classifying harder-to-separate categories like fresh leaf and mosaic virus. Overall, the PR curves confirm that the model maintains high confidence in its predictions, even under relaxed decision thresholds.

Fig 6: Precision-recall curves of DenseNet 121 (Frozen) model for the four cowpea leaf classes.


       
Fig 7 displays sample predictions made by the DenseNet 121-Frozen model. Each image shows a cowpea leaf alongside its true label, predicted label and the model’s confidence score. All samples are correctly classified with high confidence values above 0.99. The top row includes three Bacterial wilt samples. Each shows symptoms such as curling, yellowing, or spots. The model identified all of them accurately. Confidence values range from 0.9944 to 0.9959, indicating strong certainty in its predictions. The bottom row contains one septoria leaf spot sample and two additional bacterial wilt samples. The septoria leaf displays visible dark lesions typical of this disease. The model correctly classified it with a confidence of 0.9937. The last two samples again show signs of Bacterial wilt, including discoloration and shrivelling. These were predicted correctly with high confidence. The figure confirms that the model performs reliably on clear disease cases. High confidence values support that the model is not only accurate but also sure of its decisions. This is especially important for use in real-world disease detection tasks.

Fig 7: Sample predictions of the DenseNet121 model (Frozen) showing cowpea leaf images with their true labels, predicted labels and corresponding confidence scores.


       
DenseNet121 and other deep learning models show different levels of performance across studies because of variations in crops, dataset size, number of classes and task complexity (Table 3).  The present study achieved a test accuracy of 93.87% using a DenseNet-121 model to classify four classes of cowpea leaf conditions. Compared to prior work, this performance demonstrates strong competitiveness. For example, Dubey et al., (2022) reported 99.00% accuracy using DenseNet-121 on a larger and more diverse 15-class crop leaf dataset, while Girmaw and Muluneh (2024) achieved 98.33% for field pea leaves, also using DenseNet-121, but on only three classes. In contrast, Arathi and Dulhare (2023) applied DenseNet-121 to cotton leaf disease detection, achieving 91% and Saputra et al., (2023) reported 91.67% on rice leaf disease classification, showing that the presented model performs better than or on par with DenseNet-based models in other crops.

Table 3: Comparison of the proposed DenseNet121 model with existing deep learning approaches for plant disease classification across different crops and datasets.


       
For cowpea-specific studies, Choudhary et al., (2023) used DenseNet-121 to distinguish cowpea from weed leaves, achieving 88.89% test accuracy. Additionally, Trivedi et al., (2024) used a segmentation-based LinkNet-34 model with DenseNet-121 as an encoder and achieved 97.57% validation accuracy on a mixed dataset, highlighting the potential of combining segmentation with classification. The comparison results are taken from the literature. They are based on different datasets and experimental settings. Therefore, identical training or testing splits were not used.
       
Overall, the presented study contributes significantly to the underexplored domain of multiclass cowpea disease detection, demonstrating promising performance with potential for deployment in real-world agricultural scenarios.
This study developed a DenseNet121-based deep learning model to classify cowpea leaf diseases into four categories. The model achieved a test accuracy of 93.87%, showing strong performance across all classes. The Bacterial wilt class achieved perfect recall and high precision. Misclassification mainly occurred between visually similar classes, such as fresh leaf and Mosaic virus due to subtle symptom variations. Despite promising results, the study had limitations. The dataset was moderate in size and collected under ideal conditions. Field scenarios with variable lighting, complex backgrounds, or occlusions may affect accuracy. Class imbalance may also have influenced some predictions. Additionally, the DenseNet121 base model was kept frozen during training. This might have limited its learning capacity. In future work, the dataset can be expanded with more diverse images from different regions of India. Fine-tuning DenseNet121 or using lighter models like MobileNetV3 will help improve performance and enable mobile deployment. Adding environmental or time-series data may also boost prediction accuracy. Integration with mobile apps or edge devices could support real-time detection. This can help farmers detect diseases early and manage crops more efficiently.
This work was supported by Hanshin University Research grant.
 
Disclaimers
 
The views and conclusions expressed in this article are solely those of the authors and do not necessarily represent the views of their affiliated institutions. The authors are responsible for the accuracy and completeness of the information provided, but do not accept any liability for any direct or indirect losses resulting from the use of this content.
 
Data availability
 
The data analysed/generated in the present study will be made available from corresponding author upon reasonable request.
 
Availability of data and materials
 
Not applicable.
 
Use of artificial intelligence
 
Not applicable.
 
Declarations
 
Author declares that all works are original and this manuscript has not been published in any other journal.
The author declare that he has no conflict of interest.

  1. Abebe, B.K. and Alemayehu, M.T. (2022). A review of the nutritional use of cowpea [Vigna unguiculata (L.) Walp] for human and animal diets. Journal of Agriculture and Food Research. 10: 100383. https://doi.org/10.1016/j.jafr.2022.100383.

  2. Adhab, M., Ezzulddin, D.L. and Ahmed, A.S. (2025). Cultivating resilience: Sustainable plant virus control in Iraq’s agricultural landscape. BIO Web of Conferences. 192: 06002. https://doi.org/10.1051/bioconf/202519206002.

  3. Anaz, A., Kadhim, N., Sadoon, O., Alwan, G. and Adhab, M. (2023). Sustainable utilization of machine-vision-technique- based algorithm in objective evaluation of confocal microscope images. Sustainability. 15(4): 3726. https:// doi.org/10.3390/su15043726.

  4. Arathi, B. and Dulhare, U.N. (2023). Classification of Cotton Leaf Diseases Using Transfer Learning-DenseNet-121. In Lecture Notes in Networks and Systems. (pp. 393-405). https://doi.org/10.1007/978-981-19-9228-5_33.

  5. Bankina, B., Bimšteine, G., Kaņeps, J., Plūduma-Pauniņa, I., Gaile, Z., Paura, L. and Stoddard, F.L. (2021). Discrimination of leaf diseases affecting faba bean (Vicia faba). Acta Agriculturae Scandinavica Section B-Soil and Plant Science. 71(5): 399-407. https://doi.org/10.1080/ 09064710.2021.1903985.

  6. Bayar, J., Ali, N., Cao, Z., Ren, Y. and Dong, Y. (2025). Artificial intelligence of things (AIoT) for precision agriculture: Applications in smart irrigation, nutrient and disease management. Smart Agricultural Technology. 12: 101629.  https://doi.org/10.1016/j.atech.2025.101629.

  7. Belay, A.J., Salau, A.O., Ashagrie, M. and Haile, M.B. (2022). Development of a chickpea disease detection and classification model using deep learning. Informatics in Medicine Unlocked. 31: 100970. https://doi.org/10.1016/ j.imu.2022.100970.

  8. CBI. (2024). Exporting Cowpeas to Europe: Market Potential. Centre for the Promotion of Imports from Developing Countries. https://www.cbi.eu/market-information/grains-pulses- oilseeds/cowpeas/market-potential.

  9. Chipeta, M.M., Kafwambira, J. and Yohane, E. (2025). Cowpea genetic diversity, population structure and genome-wide association studies in Malawi: Insights for breeding programs. Frontiers in Plant Science. 15. https://doi.org/ 10.3389/fpls.2024.1461631.

  10. Cho, O.H. (2024). An evaluation of various machine learning approaches for detecting leaf diseases in agriculture. Legume Research. 47(4): 619-627. doi: 10.18805/LRF-787.

  11. Choudhary, V., Guha, P., Tripathi, K. and Mishra, S. (2021). Automatic Detection of Cowpea Leaves Using Image Processing and Inception-V3 Model of Deep Learning. 2021 6th International Conference on Signal Processing, Computing and Control (ISPCC). 314-318. https://doi.org/10.1109/ ISPCC53510.2021.9609358.

  12. Choudhary, V., Guha, P., Tripathi, K. and Mishra, S. (2022). Edge Detection of Variety of Cowpea Leaves Using OpenCV and Deep Learning. In 2022 4th International Conference on Advances in Computing, Communication Control and Networking (ICAC3N). IEEE. (pp. 1312-1316). https:// doi.org/10.1109/ICAC3N56670.2022.10074348.

  13. Choudhary, V., Guha, P., Pau, G., Dhanaraj, R.K. and Mishra, S. (2023). Automatic classification of cowpea leaves using deep convolutional neural network. Smart Agricultural Technology. 4: 100209. https://doi.org/10.1016/j.atech. 2023.100209.

  14. Choudhary, V., Kumar, S.P. and Saimbhi, V.S. (2026). A brief review on potential applications of drones in agriculture. Next Research. 5: 101309. https://doi.org/10.1016/j.nexres. 2026.101309.

  15. Deshpande, S.K., Kavyashree, N.M., Singh, K., Ramya, K.R., Sharma, N. and Tripathi, K. (2023). Diseases in Cowpea [Vigna unguiculata (L.) Walp.]: Next Generation Breeding Techniques for Developing Disease-Resistant Cowpea. In: Diseases in Legume Crops. [Jha, U.C., Nayyar, H., Sharma, K.D., von Wettberg, E.J.B., Singh, P. and Siddique, K.H. (Eds.)], Springer. (pp. 125-139). https://doi.org/ 10.1007/978-981-99-3358-7_6.

  16. Paek, J.J., Kim, J., Bae, S., Paek, K.S. and Lee, Y. (2026). Chive- fortified fermentation enhances gamma-aminobutyric acid production by Levilactobacillus brevis PL9014. International Journal of Probiotics and Prebiotics. 21: 1-6. https://doi.org/10.37290/ijpp.v21i1.12.

  17. Dubey, N., Bhagat, E., Rana, S. and Pathak, K. (2022). A Novel Approach to Detect Plant Disease Using DenseNet-121 Neural Network. In: Lecture Notes in Networks and Systems. (pp. 63-74). https://doi.org/10.1007/978-981- 16-9967-2_7.

  18. Feizi, H., Sattari, M.T. and Apaydin, H. (2023). A comparative study of different optimization algorithms for the optimum operation of the mahabad dam reservoir. Results in Engineering. 21: 101664. https://doi.org/10.1016/j.rineng.2023.101664.

  19. Food and Agriculture Organization of the United Nations (FAO). (2024). A new Report Sheds Light on Losses Across Agricultural and Agrifood Value Chains in Niger. https:// www.fao.org/in-action/agrisurvey/news/news-detail/a- new-report-sheds-light-on-losses-across-agricultural- and-agrifood-value-chains-in-niger/en.

  20. Girmaw, D.W. and Muluneh, T.W. (2024). Field pea leaf disease classification using a deep learning approach. Plos One. 19(7): e0307747. https://doi.org/10.1371/journal.pone. 0307747.

  21. Jayathilake, C., Visvanathan, R., Deen, A., Bangamuwage, R., Jayawardana, B., Nammi, S. and Liyanage, R. (2018). Cowpea: An overview on its nutritional facts and health benefits. Journal of the Science of Food and Agriculture. 98(13): 4793-4806. https://doi.org/10.1002/jsfa.9074.

  22. Joshi, P., Chauhan, C., Ubale, R., Patil, N., Malusare, V. and Patil, S. (2025). Smart Farming: A Comprehensive Review on the Role of Artificial Intelligence and IoT in Modern Agriculture. In Advances in Intelligent Systems Research/ Advances in Intelligent Systems Research. (pp. 1005- 1025). https://doi.org/10.2991/978-94-6463-948-3_69.

  23. Kim, S.Y. and AlZubi, A.A. (2024). Blockchain and artificial intelligence for ensuring the authenticity of organic legume products in supply chains. Legume Research. 47(7): 1144-1150. doi: 10.18805/LRF-786.

  24. Market Data Forecast. (2024). Cowpeas Market Size, Growth (2024-2033). https://www.marketdataforecast.com/ market-reports/global-cowpeas-market.

  25. Megalingam, R.K., Menon, G.G., Swathi, B., Sai, D.A., Kunnambath, A.R. and Manoharan, S.K. (2024). Cowpea leaf disease identification using deep learning. Smart Agricultural Technology. pp 100662. https://doi.org/10.1016/j.atech. 2024.100662.

  26. Min, P.K., Mito, K. and Kim, T.H. (2024). The evolving landscape of artificial intelligence applications in animal health. Indian Journal of Animal Research. 58(10): 1793-1798. doi: 10.18805/IJAR.BF-1742.

  27. Mohammad, A.A.S., Mohammad, S.I., Vasudevan, A. and Heindric, A. (2026). Intelligent decision support system for crop management using data analytics. Journal of Experimental  Biology and Agricultural Sciences. 14(3): 9-14.

  28. Nasir, A.A. and Adhab, M. (2021). A Biologically Distinct Isolate of Cucumber Mosaic Virus from Iraq. In: Proceedings of the Third International Sustainability and Resilience Conference: Climate Change. IEEE. (pp. 148-150). https:// doi.org/10.1109/IEEECONF53624.2021.9668142.

  29. Nazarov, P.A., Baleev, D.N., Ivanova, M.I., Sokolova, L.M. and Karakozova, M.V. (2020). Infectious plant diseases: etiology, current status, problems and prospects in plant protection. Acta Naturae. 12(3): 46-59. https://doi.org/ 10.32607/actanaturae.11026.

  30. NER Databank. (2023). Pulses. Retrieved from https://databank. nedfi.com/nagaland-agriculture/pulses.

  31. Parmar, H. K., Sharma, M., Patel, P., Soni, N. and Zala, H. (2025). Breeding cowpea (Vigna unguiculata L.) for high seed yield, protein content and harvest index: Genetic parameters to identify useful parents. Legume Research. 49(5): 775-780. doi: 10.18805/LR-5381.

  32. Rashid, M.R.A., Hasan, M., Gani, R., Kamara, R., Tarin, T.K. and Rabbi, S.F. (2024). Image Dataset for Bean and Cowpea Plant Leaf Disease Detection and Freshness Assessment from Bangladesh. Mendeley Data. https://doi.org/ 10.17632/ykvcrjffzd.1

  33. Saputra, A.D., Hindarto, D. and Santoso, H. (2023). Disease classification on rice leaves using DenseNet121, DenseNet169, DenseNet201. SinkrOn. 8(1): 48-55. https://doi.org/10.33395/sinkron.v8i1.11906.

  34. Sasmal, B., Das, A., Dhal, K.G., Saheb, S.B., Khurma, R.A. and Castillo, P.A. (2024). A novel groundnut leaf dataset for detection and classification of groundnut leaf diseases. Data in Brief. 55: 110763. https://doi.org/10.1016/j.dib. 2024.110763.

  35. Souza, K.F., Gonçalves, L.C.O. and Espindola, F.S. (2026). A broad overview of the multifaceted royal jelly and its applicability in health and performance. Current Topics in Nutraceutical Research. 24(1): 4-14. https://doi.org/10.37290/ctnrv24.i1.8.

  36. Trivedi, P., Narayan, Y., Ravi, V., Kumar, P., Kaur, P., Tabianan, K., Singh, P. and Diwakar, M. (2024). Plant leaf disease detection and classification using segmentation encoder techniques. The Open Agriculture Journal. 18(1). https:// doi.org/10.2174/0118743315321139240627092707.
In this Article
Published In
Legume Research

Editorial Board

View all (0)