Prediction of Tomato Leaf Diseases using Computational Convolution Neural Network Method

1Department of Studies and Research in Computer Applications, Tumkur University, Tumakuru-572 103, Karnataka, India.
2Department of Computer Engineering, AISSMS College of Engineering, Pune-411 006, Maharashtra, India.
3Department of Electronics, University College of Science, Tumkur University, Tumkur-572 103, Karnataka, India.
4Department of Mechanical Engineerong, Ajeenkya DY Patil School of Engineering, Pune-411 006, Maharashtra, India.
Background: The growing world population has led to a rising demand for food. Tomatoes, a staple in global diets, are widely used in fresh consumption, sauces and processed products. However, tomato diseases pose a major challenge, significantly reducing yield and crop quality. Timely and accurate identification of these diseases is essential for effective management. This study uses advancements in deep learning to develop a Convolutional Neural Network model. The model classifies tomato leaf conditions into five categories: Healthy leaves (HC), two-spotted spider mite (TSSM), tomato yellow leaf curl disease (TYLCD), tomato mosaic virus (ToMV) and target spot (TS).

Methods: The study utilized a publicly available dataset from Mendeley. Images were preprocessed by resizing, reorienting and enhancing quality, ensuring compatibility with the CNN model. The dataset was divided into an 80:20 ratio for training and validation. The CNN architecture consisted of six convolutional layers with ReLU activation, max-pooling layers and two fully connected layers for classification. Model performance was evaluated using Precision, Recall, F1-score and accuracy metrics.

Result: The CNN model achieved a training accuracy of 93.51% and a validation accuracy of 94.83%. TYLCD had the highest classification precision (98.67%) and recall (99.8%). Overall model accuracy was 95.7%, with macro-average and weighted-average F1-scores of 0.9264 and 0.9567, respectively. The confusion matrix highlighted TYLCD as the most accurately classified disease, while TSSM showed the highest misclassification rate. These results demonstrate the model’s potential for reliable tomato disease identification, supporting precision agriculture practices.
The agricultural sector has been the most productive, contributing significantly to the national and international economies. Not only does it contribute to about 4.3% of the global gross domestic product (GDP) but it is also responsible for the employment of a substantial proportion of the workforce in the world (26.40%). Tomato (Solanum lycopersicum L.) is one of the most extensively grown and produced crops as evidenced by the fact that around 9 in 10 farmers grow tomatoes in their farms (Agarwal et al., 2020). According to the (FAO, 2023), it is the sixth most-grown vegetable in the world and its annual production has been estimated to be over 180 million.
       
However, several diseases and pests are causing the loss of crops each year, leading to decreased productivity (Savary and Willocquet, 2020). Thus, it is critical to recognize them as soon as possible to reduce severe losses and boost yields. The conventional techniques of diagnosing plant diseases are labor-intensive and costly in terms of time and effort. These diseases are caused by plant pathogens including bacteria, fungi, viruses and nematodes (Blancard et al., 2012; Prasad et al., 2020). Additionally, certain insects, such as sucking insect pests, feed on plant components and deficiencies in micronutrients have a significant impact on plant growth (Castañé et al., 2020; Kusanur and Chakravarthi, 2021; Koike et al., 2023). The focus of this study is the viral diseases (tomato yellow leaf curl disease and the tomato mosaic disease), Fungal disease (target spot also called early blight) and insect (Two-spotted spider mite). In recent times, artificial intelligence (AI) has proven to be of great value in diverse fields involving the classification processes along with making the process of disease identification faster and more accurate (Alzubi, 2023; Kumar et al., 2023; Cho, 2024; Wasik and Pattinson, 2024; Hai and Duong, 2024; Untari and Satria, 2022; Wihardjo et al., 2024).
       
Early identification of plant diseases is important to combat their negative consequences related to production loss and poor yields. Using machine learning techniques such as convolutional neural network (CNN) may help in overcoming the limitations of ongoing human observation and laborious laboratory techniques. CNN’s primary job is to the identification of images and their classification. Its unique feature is that can be taught from the input object itself without the need for manual feature extraction (Taye, 2023). Here, instead of looking at each pixel of an image individually, CNN looks at small pieces of the picture at a time. The construction closely follows the basic structure of the visual cortex found in primates as various stages of its learning process are comparable to the ventral pathway of the visual cortex in primates (Khan et al., 2020). Basha et al. (2024) introduced Tomato Guard, a predictive model for tomato plant diseases. The model uses machine learning with environmental and plant health data. It was validated through field trials and showed better accuracy than traditional methods. The model adapts to different climates and supports sustainable farming. Its interface allows growers to upload images for diagnosis and treatment recommendations. This helps improve agricultural productivity and resilience. Sood et al., (2024) proposed an analytical approach for tomato leaf disease detection using CNNs, focusing on ResNet50 and VGG16 architectures. Using a labeled dataset of 10,388 images with 10 disease classes, the study achieved training accuracies of 99.63% and 94.48% for ResNet50 and VGG16, respectively, at 20 epochs. The method leverages transfer learning and data augmentation, outperforming existing techniques.
       
Several studies attempted to develop a CNN-based model. Agarwal et al. (2020) employed a CNN-based method on the Plant Village dataset of tomato leaves which contained infected and diseased leaves images belonging to 9 disease classes. They obtained classification accuracies that varied from 76% to 100% for different classes of diseases (10 classes: 1 healthy and 9 diseased). Their model was better than the using pre-trained models such as VGG16, InceptionV3 and MobileNet. The overall accuracy obtained for the model was 91.2%. Tian et al. (2023) used the dataset of PlantVillage and a curated in-house dataset to develop a model for the detection of diseases. They tested three pre-trained models (VGG16, InceptionV3 and ResNet50) which were then used to develop a smartphone application Tomato Guard for the convenient identification of tomato diseases. Their model reached an accuracy of 99%.
       
The present study was conducted to develop a CNN model for classifying tomato leaf conditions. The model focuses on five categories: HC, TSSM, TYCLVD, TMV and TS. It uses a preprocessed dataset to enhance classification accuracy and reliability. This work aims to enable early and automated disease detection for better disease management and improved tomato yields.
The algorithm was developed and executed in a Jupyter Notebook, using Anaconda for environment management. It was built in Python v3.11 to ensure compatibility with required libraries. The model was trained on a PC with 16 GB of RAM. To speed up the training process, a TPU-v3:8 environment was used. This 8-core Tensor Processing Unit accelerated the machine learning tasks. TensorFlow and Keras were employed to build and train the model. These tools provided an efficient platform for developing and evaluating the algorithm. The process of developing a CNN model for the identification of tomato leaf diseases included the following steps:
 
Obtaining the dataset
 
The dataset used in the present study was obtained from an open-access website Mendeley (Huang and Chang, 2020). The images belong to 5 classes of tomato diseases i.e., a) Healthy leaves (HC) b) Two-spotted spider mite (TSSM) c) tomato yellow leaf curl disease (TYLCD) d) tomato mosaic virus (ToMV) and e) target spot (TS) were extracted from this database and utilized for further analysis (Fig 1).

Fig 1: Five Classes of diseases: a) Healthy leaves (HC); b) Two-spotted spider mite disease (TSSM); c) Tomato yellow leaf curl disease (TYLCD); d) Tomato mosaic virus disease (TMV) and e) Target spot disease (TS).


       
The dataset was divided into training, validation and testing subsets using an 80:20 ratio. This partitioning allows the model to learn from a large portion of the data while evaluating its performance on a smaller, unseen set of images. The training dataset was used to teach the model to recognize the features of tomato diseases, while the testing and validation sets were used to assess its generalization ability.
 
Data pre-processing
 
It is the process of cleaning unwanted or incorrect entries from the dataset by either correcting it or removing it. Raw data without being cleaned and curated is typically unsuitable for accurate results. It is an important step in creating a model meant for disease classification using images. The pre-processing steps in this study are as follows:
       
The first step is to load the raw data into memory. This makes the data ready for the model to process. In this study, images of tomato leaves are used to classify healthy and diseased. The image data generator class from TensorFlow’s Keras library is utilized to handle the image data.
       
Next, the image dimensions are resized to 256 by 256 pixels. This resizing ensures that all images have the same size, which is necessary for consistent model training. The pixel values of the images are then rescaled to fall between 0 and 1. This normalization helps the model learn more efficiently. The rescaling is done as follows:

 
Where,
Xscaled = Rescaled pixel value.
Xoriginal = Original pixel value.
       
Data augmentation techniques are then applied to enhance the dataset. These include rotation (up to 20 degrees), shifting (up to 20% of the image size) and flipping (both horizontally and vertically). These augmentations increase the variability of the dataset, making the model more robust. The training data is shuffled to ensure randomness during training. This prevents the model from learning unintended patterns based on the order of the data, improving its generalization. For the validation data, only pixel value rescaling is applied. No data augmentation is performed on the validation set to maintain its integrity for evaluation. Additionally, shuffling is avoided to ensure the order remains consistent during validation.
 
The CNN model
 
The CNN architecture employed in this study consists of several layers, each playing a important role in extracting meaningful features from the images and performing classification. Below is a detailed explanation of each component of the model.
 
Input layer
 
This layer of CNN contains the image data which is represented by a 3-D matrix. The size of the images in this layer was 256 × 256 pixels and the color channels were RGB (Red, Green and Blue). Each pixel in the image corresponds to a value in the matrix, which is processed through the network to extract relevant features.
 
Convolutional layers
 
There were 6 convolutional layers used in this study. This layer makes use of learnable filters for the image and features such as edges, patterns or textures can be extracted. As the layer deepens it starts combining these features capturing the hierarchical representations of the images.
       
Mathematical presentation of convolutional operation:

 
Where,
Zij = Output feature map at position (i, j).
X = Input image patch.
W = Filter.
b = Bias term.
       
In this study, the rectified linear unit (ReLU) is applied after each convolution operation to introduce non-linearity into the model. This allows the model to learn more complex relationships within the data.
 
Activation function: Aij = ReLU(Zij)
 
Max pooling layers
 
Following each convolutional layer, a max pooling layer is applied to reduce the spatial dimensions of the feature maps. This operation condenses the most significant features, making the model more computationally efficient and less prone to overfitting. By selecting the maximum value from small regions within the feature maps, max pooling retains the most important information while reducing the size of the data.
 
Flatten layer
 
After passing through the convolutional and pooling layers, the output is flattened into a one-dimensional vector. This transformation is necessary to prepare the data for the fully connected layers, which require a linear input format.
 
Fully connected layers
 
The flattened output is fed into two fully connected (dense) layers. The first dense layer consists of 64 neurons, which help the model learn complex patterns and relationships from the extracted features. The second dense layer contains 5 neurons, each corresponding to one of the categories (HC, TSSM, TYCLD, TMV and TS). These neurons output the probabilities of an image belonging to each class, with the final classification determined by the highest probability. Fig 2 gives the graphical representation of the CNN model and Table 1 provides the hyperparameter used in the present model.

Fig 2: The architecture of the CNN model used in the present study.



Table 1: Hyper-parameter of CNN model.


 
Evaluation of the model
 
A confusion matrix was employed to visualize the performance of the model by comparing the predicted labels with the actual labels. The matrix consists of four key components true negatives (TrN), true positives (TrP), false negatives (FsN) and false positives (FsP).


       
Any newly developed ML model’s performance can be evaluated by using four systems of measurement. They are F1 score, Recall, Precision and Accuracy. These metrics offer a comprehensive understanding of the model’s ability to classify images correctly. Accuracy was calculated as the ratio of correctly classified instances (TP + TN) to the total number of instances (TP + TN + FP + FN). Precision was used to measure how many of the instances predicted as diseased leaves were actually correctly identified, calculated as TP/(TP + FP). Recall was calculated to evaluate how well the model identified all diseased leaves, using the formula TP/(TP + FN). The F1-score, which is the harmonic mean of Precision and Recall, was computed to provide a balanced measure of the model’s performance, ensuring a trade-off between Precision and Recall. These evaluation metrics, derived from the Confusion Matrix, gave a thorough understanding of the model’s performance, highlighting areas of strength and potential improvement in distinguishing between healthy and diseased tomato leaves. By using these metrics, the model’s effectiveness in early disease detection for tomato crop management could be assessed, guiding future model improvements.







The CNN model developed showed strong performance as it achieved high accuracy for both the training and validation datasets. After 25 epochs, the training dataset achieved an accuracy of 93.51% and the validation dataset showed a slightly higher accuracy of 94.83% (Fig 3). The loss which is the error between the predicted output and the actual target for each training example, tells how the model is performing during training. The value of loss was 0.19 during training and 0.14 during validation. The lower the values of loss the better the performance, of the model.

Fig 3: Training and validation accuracies (a) and loss (b).


       
The confusion matrix presented in Fig 4 provides a detailed analysis of the model’s performance across five classes. The model performs well in identifying HC, with 115 correct classifications, though it misclassifies 3 instances as TSSM. TS shows good performance with 106 correct predictions, but there are 2 instances misclassified as HC and 1 as ToMV, indicating some confusion between these classes. TYLCD achieves the highest accuracy, correctly classifying 446 instances, with only 1 misclassification as TSSM. In contrast, ToMV has more significant misclassi-fications, including 29 instances predicted as TS and 3 as TYLCD, reflecting the difficulty in distinguishing ToMV from these diseases. TSSM has 131 correct classifications, but 14 instances are misclassified as TS and 3 as HC. Overall, while the model performs well with HC and TYCLD, it struggles to differentiate TS, ToMV and TSSM, indicating the need for further model refinement to improve accuracy across these more challenging classes.

Fig 4: Confusion matrix.


       
Table 2 presents the related precision (P), accuracy (A), F1-score (F1) and Recall (R). For HC, the model achieved a high Precision of 0.9504, correctly identifying 95.04% of predicted healthy instances. The Recall of 0.9746 shows the model identified 97.46% of all actual HC instances, resulting in an F1-score of 0.9623, indicating strong performance. TYLCD showed excellent results with a Precision of 0.9867 and a Recall of 0.9978. The F1-Score of 0.9922 reflects the model’s high accuracy in identifying this disease. TS had a Precision of 0.8548, indicating 85.48% accuracy in predictions and a Recall of 0.9550, meaning 95.50% of actual TS instances were detected. The F1-Score of 0.9021 shows a good balance between Precision and Recall, although performance is slightly lower than for the other classes. For ToMV, the model achieved perfect Precision (1.0000), correctly predicting all instances, but had a lower Recall of 0.7632, identifying 76.32% of actual instances, leading to an F1-score of 0.8657. Finally, TSSM showed a precision of 0.9493, accurately identifying 94.93% of predicted instances and a Recall of 0.8733, detecting 87.33% of all actual instances, resulting in an F1-score of 0.9097. The overall accuracy of the model was 95.72%, indicating strong performance across all classes. The macro average values (0.9483 for Precision, 0.9128 for Recall and 0.9264 for F1-Score) reflect robust overall performance, while the weighted average values (0.9589 for Precision, 0.9572 for Recall and 0.9567 for F1-score) demonstrate consistency in classification despite the varying number of instances per class. The model performs particularly well with HC and TYLCD, though there is room for improvement in distinguishing ToMV and TS.

Table 2: Performance evaluation metrics for the developed model.


       
Fig 5 (a-f) provides few examples of tomato leaf disease classification with predicted outcomes, actual classes and confidence values. These images represent different predictions by the model on tomato leaves infected by various diseases. In 5(a), the model accurately predicted TYLCD with 100% confidence, perfectly matching the actual label. 5(b) displays a correct prediction of TS with 95.13% confidence, indicating strong performance. In 5(c), the model correctly classified another instance of TYLCD with a confidence of 98.69%. For 5(d), the model successfully identified a healthy leaf with 99.89% confidence, demonstrating its ability to distinguish non-diseased leaves. Similarly, 5(e) shows another correct prediction of TYLCD with 99.97% confidence, emphasizing the model’s reliability in identifying this disease. Finally, in 5(f), the model accurately predicted TS with 98.61% confidence, further confirming its capability to classify this class with high certainty.

Fig 5: The prediction of diseases.


       
The model shows remarkable accuracy in classifying diseases like TYLCD and TS, as well as identifying healthy leaves. These results can help farmers detect diseases at an early stage and manage tomato crops effectively. This can improve yields and reduce losses.
The study developed a CNN model for the identification of tomato leaf diseases, achieving a high overall accuracy of 95.72%. The model performed well in classifying healthy leaves and TYLCD while showing limitations in distinguishing between classes like ToMV and TS. Data preprocessing, model design and evaluation metrics, including precision, recall and F1-score, demonstrated the model’s effectiveness in early disease detection, aiding agricultural crop management. The study has some limitations. The model showed reduced accuracy in differentiating certain similar disease classes. Moreover, it relied heavily on a specific dataset, which may not capture real-world variability. Future work will include expanding the dataset with more diverse samples and optimizing the CNN architecture to enhance classification accuracy. Implementing the model in field conditions using mobile or IoT devices can improve practical utility for farmers.
Disclaimer
 
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.
 
Funding details
 
This research received no external funding.
 
Authors’ contributions
 
All authors contributed toward data analysis, drafting and revising the paper and agreed to be responsible for all the aspects of this work.
 
Availability of data and materials
 
Not applicable.
 
Use of artificial intelligence
 
Not applicable.
 
Declarations
 
Authors declare that all works are original and this manuscript has not been published in any other journal.
Authors declare that they have no conflict of interest.

  1. Agarwal, M., Singh, A., Arjaria, S., Sinha, A. and Gupta, S. (2020). ToLeD: Tomato leaf disease detection using convolution neural network. Procedia Computer Science. 167: 293- 301. https://doi.org/10.1016/j.procs.2020.03.225. 

  2. AlZubi, A.A. (2023). Artificial intelligence and its application in the prediction and diagnosis of animal diseases: A review. Indian Journal of Animal Research. 57(10): 1265-1271. doi: 10.18805/IJAR.BF-1684

  3. Basha, S.J., Veeraiah, D., Dev, B.S., Hymavathi, C.S.L. and Govardhan, I. (2024). Tomato guard: A predictive model for disease prediction and treatment recommendation in tomato plants. 2024 3rd International Conference on Applied Artificial Intelligence and Computing (ICAAIC), Salem, India. pp: 1102- 1107. https://doi.org/10.1109/ICAAIC60222.2024.10575613.

  4. Blancard, D., Laterrot, H., Marchoux, G., Fletcher, J., Candresse, T. (2012). Tomato diseases: Identification, biology and control. Netherlands: Manson Publishing Limited. 

  5. Castañé, C., van der Blom, J., Nicot, P.C. (2020). Tomatoes. In: Gullino, M., Albajes, R., Nicot, P. (eds) Integrated Pest and Disease Management in Greenhouse Crops. Plant Pathology in the 21st Century. Springer, Cham. vol 9. https://doi.org/10.1007/978-3-030-22304-5_17. 

  6. 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

  7. Food and Agriculture Organization (FAO), (2023). The future of food and agriculture: Drivers and triggers for transformation. FAO, (Accessed: 5 December 2024). https://openknowledge. fao.org/server/api/core/bitstreams/28cfd24e-81a9-4ebc- b2b5-4095fe5b1dab/content/cc8166en.html. 

  8. Hai, N.T. and Duong, N.T. (2024). An improved environmental management model for assuring energy and economic prosperity. Acta Innovations. 52: 9-18. https://doi.org/ 10.62441/ActaInnovations.52.2 

  9. Huang, M-L., Chang, Y-H. (2020). Dataset of Tomato Leaves, Mendeley Data, V1, https://data.mendeley.com/datasets/ngdgg 79rzb/1.

  10. Khan, A., Sohail, A., Zahoora, U. and Qureshi, A.S. (2020). A survey of the recent architectures of deep convolutional neural networks. Artificial Intelligence Review. 53: 5455-5516. https://doi.org/10.1007/s10462-020-09825-6.

  11. Koike, T., Yamamoto, S., Furui, T., Miyazaki, C., Ishikawa, H. and Morishige, K.I. (2023). Evaluation of the relationship between equol production and the risk of locomotive syndrome in very elderly women. International Journal of Probiotics and Prebiotics. 18(1): 7-13. https://doi.org/ 10.37290/ijpp2641-7197.18:7-13. 

  12. Kumar, V., Chaturvedi, V., Lal, B. and Alam, S. (2023). Application of machine learning in analyzing the psychological well being amongst the employees in the private sector. An Analysis of Work-Life Balance in the Healthcare Industry. Pacific Business Review (International). 16(1): 124-131.

  13. Kusanur, V. and Chakravarthi, V. S. (2021). Using transfer learning for nutrient deficiency prediction and classification in tomato plant. Int. J. Adv. Comput. Sci. Appl. 12(10): 784- 790. 

  14. Prasad, A., Sharma, N., Hari-Gowthem, G., Muthamilarasan, M. and Prasad, M. (2020). Tomato yellow leaf curl virus: Impact, challenges and management. Trends in Plant Science. 25(9): 897-911. https://doi.org/10.1016/j.tplants.2020.03.015. 

  15. Savary, S., Willocquet, L. (2020). Modeling the impact of crop diseases on global food security. Annual Review of Phytopathology. 58: 313-341. https://doi.org/10.1146/annurev- phyto-010820-012856.

  16. Sood, M., Srivastava, J., Mallick, A.K. (2024). Revolutionizing tomato agriculture: Leaf disease detection using CNN and its variants. 2024 IEEE 9th International Conference for Convergence in Technology (I2CT), Pune, India. 1-6. https: //doi.org/10.1109/I2CT61223.2024.10544294.

  17. Taye, M.M. (2023). Theoretical understanding of convolutional neural network: Concepts, architectures, applications, future directions. Computation. 11(3): 52.  https://doi.org/ 10.3390/computation11030052. 

  18. Tian, K., Zeng, J., Song, T., Li, Z., Evans, A. and Li, J. (2023). Tomato leaf diseases recognition based on deep convolutional neural networks. Journal of Agricultural Engineering. 54(1). https://doi.org/10.4081/jae.2022.1432.

  19. Untari, D.T. and Satria, B. (2022). Repositioning culinary “betawi ora” as bekasi eco-culinary tourism icon. International Journal of Environmental Sciences. 8(2): 15-24. https:// www.theaspd.com/resources/IJES%20Paper02-%20Dhian %20Tyas.pdf.

  20. Wihardjo, R.S.D., Muktiono, A. and Suwanda (2024). Exploring critical thinking in environmental education: A PBL approach to reaction rate material at public senior high schools in Indonesia. International Journal of Environmental Sciences. 10(1): 14-25. https://www.theaspd.com/resources/2.%20 Exploring%20Critical%20Thinking%20in%20Environ- mental%20Education.pdf.

  21. Wasik, S. and Pattinson, R.  (2024). Artificial intelligence applications in fish classification and taxonomy: Advancing our under- standing of aquatic biodiversity. Fish Taxa. 31: 11-21. 

Prediction of Tomato Leaf Diseases using Computational Convolution Neural Network Method

1Department of Studies and Research in Computer Applications, Tumkur University, Tumakuru-572 103, Karnataka, India.
2Department of Computer Engineering, AISSMS College of Engineering, Pune-411 006, Maharashtra, India.
3Department of Electronics, University College of Science, Tumkur University, Tumkur-572 103, Karnataka, India.
4Department of Mechanical Engineerong, Ajeenkya DY Patil School of Engineering, Pune-411 006, Maharashtra, India.
Background: The growing world population has led to a rising demand for food. Tomatoes, a staple in global diets, are widely used in fresh consumption, sauces and processed products. However, tomato diseases pose a major challenge, significantly reducing yield and crop quality. Timely and accurate identification of these diseases is essential for effective management. This study uses advancements in deep learning to develop a Convolutional Neural Network model. The model classifies tomato leaf conditions into five categories: Healthy leaves (HC), two-spotted spider mite (TSSM), tomato yellow leaf curl disease (TYLCD), tomato mosaic virus (ToMV) and target spot (TS).

Methods: The study utilized a publicly available dataset from Mendeley. Images were preprocessed by resizing, reorienting and enhancing quality, ensuring compatibility with the CNN model. The dataset was divided into an 80:20 ratio for training and validation. The CNN architecture consisted of six convolutional layers with ReLU activation, max-pooling layers and two fully connected layers for classification. Model performance was evaluated using Precision, Recall, F1-score and accuracy metrics.

Result: The CNN model achieved a training accuracy of 93.51% and a validation accuracy of 94.83%. TYLCD had the highest classification precision (98.67%) and recall (99.8%). Overall model accuracy was 95.7%, with macro-average and weighted-average F1-scores of 0.9264 and 0.9567, respectively. The confusion matrix highlighted TYLCD as the most accurately classified disease, while TSSM showed the highest misclassification rate. These results demonstrate the model’s potential for reliable tomato disease identification, supporting precision agriculture practices.
The agricultural sector has been the most productive, contributing significantly to the national and international economies. Not only does it contribute to about 4.3% of the global gross domestic product (GDP) but it is also responsible for the employment of a substantial proportion of the workforce in the world (26.40%). Tomato (Solanum lycopersicum L.) is one of the most extensively grown and produced crops as evidenced by the fact that around 9 in 10 farmers grow tomatoes in their farms (Agarwal et al., 2020). According to the (FAO, 2023), it is the sixth most-grown vegetable in the world and its annual production has been estimated to be over 180 million.
       
However, several diseases and pests are causing the loss of crops each year, leading to decreased productivity (Savary and Willocquet, 2020). Thus, it is critical to recognize them as soon as possible to reduce severe losses and boost yields. The conventional techniques of diagnosing plant diseases are labor-intensive and costly in terms of time and effort. These diseases are caused by plant pathogens including bacteria, fungi, viruses and nematodes (Blancard et al., 2012; Prasad et al., 2020). Additionally, certain insects, such as sucking insect pests, feed on plant components and deficiencies in micronutrients have a significant impact on plant growth (Castañé et al., 2020; Kusanur and Chakravarthi, 2021; Koike et al., 2023). The focus of this study is the viral diseases (tomato yellow leaf curl disease and the tomato mosaic disease), Fungal disease (target spot also called early blight) and insect (Two-spotted spider mite). In recent times, artificial intelligence (AI) has proven to be of great value in diverse fields involving the classification processes along with making the process of disease identification faster and more accurate (Alzubi, 2023; Kumar et al., 2023; Cho, 2024; Wasik and Pattinson, 2024; Hai and Duong, 2024; Untari and Satria, 2022; Wihardjo et al., 2024).
       
Early identification of plant diseases is important to combat their negative consequences related to production loss and poor yields. Using machine learning techniques such as convolutional neural network (CNN) may help in overcoming the limitations of ongoing human observation and laborious laboratory techniques. CNN’s primary job is to the identification of images and their classification. Its unique feature is that can be taught from the input object itself without the need for manual feature extraction (Taye, 2023). Here, instead of looking at each pixel of an image individually, CNN looks at small pieces of the picture at a time. The construction closely follows the basic structure of the visual cortex found in primates as various stages of its learning process are comparable to the ventral pathway of the visual cortex in primates (Khan et al., 2020). Basha et al. (2024) introduced Tomato Guard, a predictive model for tomato plant diseases. The model uses machine learning with environmental and plant health data. It was validated through field trials and showed better accuracy than traditional methods. The model adapts to different climates and supports sustainable farming. Its interface allows growers to upload images for diagnosis and treatment recommendations. This helps improve agricultural productivity and resilience. Sood et al., (2024) proposed an analytical approach for tomato leaf disease detection using CNNs, focusing on ResNet50 and VGG16 architectures. Using a labeled dataset of 10,388 images with 10 disease classes, the study achieved training accuracies of 99.63% and 94.48% for ResNet50 and VGG16, respectively, at 20 epochs. The method leverages transfer learning and data augmentation, outperforming existing techniques.
       
Several studies attempted to develop a CNN-based model. Agarwal et al. (2020) employed a CNN-based method on the Plant Village dataset of tomato leaves which contained infected and diseased leaves images belonging to 9 disease classes. They obtained classification accuracies that varied from 76% to 100% for different classes of diseases (10 classes: 1 healthy and 9 diseased). Their model was better than the using pre-trained models such as VGG16, InceptionV3 and MobileNet. The overall accuracy obtained for the model was 91.2%. Tian et al. (2023) used the dataset of PlantVillage and a curated in-house dataset to develop a model for the detection of diseases. They tested three pre-trained models (VGG16, InceptionV3 and ResNet50) which were then used to develop a smartphone application Tomato Guard for the convenient identification of tomato diseases. Their model reached an accuracy of 99%.
       
The present study was conducted to develop a CNN model for classifying tomato leaf conditions. The model focuses on five categories: HC, TSSM, TYCLVD, TMV and TS. It uses a preprocessed dataset to enhance classification accuracy and reliability. This work aims to enable early and automated disease detection for better disease management and improved tomato yields.
The algorithm was developed and executed in a Jupyter Notebook, using Anaconda for environment management. It was built in Python v3.11 to ensure compatibility with required libraries. The model was trained on a PC with 16 GB of RAM. To speed up the training process, a TPU-v3:8 environment was used. This 8-core Tensor Processing Unit accelerated the machine learning tasks. TensorFlow and Keras were employed to build and train the model. These tools provided an efficient platform for developing and evaluating the algorithm. The process of developing a CNN model for the identification of tomato leaf diseases included the following steps:
 
Obtaining the dataset
 
The dataset used in the present study was obtained from an open-access website Mendeley (Huang and Chang, 2020). The images belong to 5 classes of tomato diseases i.e., a) Healthy leaves (HC) b) Two-spotted spider mite (TSSM) c) tomato yellow leaf curl disease (TYLCD) d) tomato mosaic virus (ToMV) and e) target spot (TS) were extracted from this database and utilized for further analysis (Fig 1).

Fig 1: Five Classes of diseases: a) Healthy leaves (HC); b) Two-spotted spider mite disease (TSSM); c) Tomato yellow leaf curl disease (TYLCD); d) Tomato mosaic virus disease (TMV) and e) Target spot disease (TS).


       
The dataset was divided into training, validation and testing subsets using an 80:20 ratio. This partitioning allows the model to learn from a large portion of the data while evaluating its performance on a smaller, unseen set of images. The training dataset was used to teach the model to recognize the features of tomato diseases, while the testing and validation sets were used to assess its generalization ability.
 
Data pre-processing
 
It is the process of cleaning unwanted or incorrect entries from the dataset by either correcting it or removing it. Raw data without being cleaned and curated is typically unsuitable for accurate results. It is an important step in creating a model meant for disease classification using images. The pre-processing steps in this study are as follows:
       
The first step is to load the raw data into memory. This makes the data ready for the model to process. In this study, images of tomato leaves are used to classify healthy and diseased. The image data generator class from TensorFlow’s Keras library is utilized to handle the image data.
       
Next, the image dimensions are resized to 256 by 256 pixels. This resizing ensures that all images have the same size, which is necessary for consistent model training. The pixel values of the images are then rescaled to fall between 0 and 1. This normalization helps the model learn more efficiently. The rescaling is done as follows:

 
Where,
Xscaled = Rescaled pixel value.
Xoriginal = Original pixel value.
       
Data augmentation techniques are then applied to enhance the dataset. These include rotation (up to 20 degrees), shifting (up to 20% of the image size) and flipping (both horizontally and vertically). These augmentations increase the variability of the dataset, making the model more robust. The training data is shuffled to ensure randomness during training. This prevents the model from learning unintended patterns based on the order of the data, improving its generalization. For the validation data, only pixel value rescaling is applied. No data augmentation is performed on the validation set to maintain its integrity for evaluation. Additionally, shuffling is avoided to ensure the order remains consistent during validation.
 
The CNN model
 
The CNN architecture employed in this study consists of several layers, each playing a important role in extracting meaningful features from the images and performing classification. Below is a detailed explanation of each component of the model.
 
Input layer
 
This layer of CNN contains the image data which is represented by a 3-D matrix. The size of the images in this layer was 256 × 256 pixels and the color channels were RGB (Red, Green and Blue). Each pixel in the image corresponds to a value in the matrix, which is processed through the network to extract relevant features.
 
Convolutional layers
 
There were 6 convolutional layers used in this study. This layer makes use of learnable filters for the image and features such as edges, patterns or textures can be extracted. As the layer deepens it starts combining these features capturing the hierarchical representations of the images.
       
Mathematical presentation of convolutional operation:

 
Where,
Zij = Output feature map at position (i, j).
X = Input image patch.
W = Filter.
b = Bias term.
       
In this study, the rectified linear unit (ReLU) is applied after each convolution operation to introduce non-linearity into the model. This allows the model to learn more complex relationships within the data.
 
Activation function: Aij = ReLU(Zij)
 
Max pooling layers
 
Following each convolutional layer, a max pooling layer is applied to reduce the spatial dimensions of the feature maps. This operation condenses the most significant features, making the model more computationally efficient and less prone to overfitting. By selecting the maximum value from small regions within the feature maps, max pooling retains the most important information while reducing the size of the data.
 
Flatten layer
 
After passing through the convolutional and pooling layers, the output is flattened into a one-dimensional vector. This transformation is necessary to prepare the data for the fully connected layers, which require a linear input format.
 
Fully connected layers
 
The flattened output is fed into two fully connected (dense) layers. The first dense layer consists of 64 neurons, which help the model learn complex patterns and relationships from the extracted features. The second dense layer contains 5 neurons, each corresponding to one of the categories (HC, TSSM, TYCLD, TMV and TS). These neurons output the probabilities of an image belonging to each class, with the final classification determined by the highest probability. Fig 2 gives the graphical representation of the CNN model and Table 1 provides the hyperparameter used in the present model.

Fig 2: The architecture of the CNN model used in the present study.



Table 1: Hyper-parameter of CNN model.


 
Evaluation of the model
 
A confusion matrix was employed to visualize the performance of the model by comparing the predicted labels with the actual labels. The matrix consists of four key components true negatives (TrN), true positives (TrP), false negatives (FsN) and false positives (FsP).


       
Any newly developed ML model’s performance can be evaluated by using four systems of measurement. They are F1 score, Recall, Precision and Accuracy. These metrics offer a comprehensive understanding of the model’s ability to classify images correctly. Accuracy was calculated as the ratio of correctly classified instances (TP + TN) to the total number of instances (TP + TN + FP + FN). Precision was used to measure how many of the instances predicted as diseased leaves were actually correctly identified, calculated as TP/(TP + FP). Recall was calculated to evaluate how well the model identified all diseased leaves, using the formula TP/(TP + FN). The F1-score, which is the harmonic mean of Precision and Recall, was computed to provide a balanced measure of the model’s performance, ensuring a trade-off between Precision and Recall. These evaluation metrics, derived from the Confusion Matrix, gave a thorough understanding of the model’s performance, highlighting areas of strength and potential improvement in distinguishing between healthy and diseased tomato leaves. By using these metrics, the model’s effectiveness in early disease detection for tomato crop management could be assessed, guiding future model improvements.







The CNN model developed showed strong performance as it achieved high accuracy for both the training and validation datasets. After 25 epochs, the training dataset achieved an accuracy of 93.51% and the validation dataset showed a slightly higher accuracy of 94.83% (Fig 3). The loss which is the error between the predicted output and the actual target for each training example, tells how the model is performing during training. The value of loss was 0.19 during training and 0.14 during validation. The lower the values of loss the better the performance, of the model.

Fig 3: Training and validation accuracies (a) and loss (b).


       
The confusion matrix presented in Fig 4 provides a detailed analysis of the model’s performance across five classes. The model performs well in identifying HC, with 115 correct classifications, though it misclassifies 3 instances as TSSM. TS shows good performance with 106 correct predictions, but there are 2 instances misclassified as HC and 1 as ToMV, indicating some confusion between these classes. TYLCD achieves the highest accuracy, correctly classifying 446 instances, with only 1 misclassification as TSSM. In contrast, ToMV has more significant misclassi-fications, including 29 instances predicted as TS and 3 as TYLCD, reflecting the difficulty in distinguishing ToMV from these diseases. TSSM has 131 correct classifications, but 14 instances are misclassified as TS and 3 as HC. Overall, while the model performs well with HC and TYCLD, it struggles to differentiate TS, ToMV and TSSM, indicating the need for further model refinement to improve accuracy across these more challenging classes.

Fig 4: Confusion matrix.


       
Table 2 presents the related precision (P), accuracy (A), F1-score (F1) and Recall (R). For HC, the model achieved a high Precision of 0.9504, correctly identifying 95.04% of predicted healthy instances. The Recall of 0.9746 shows the model identified 97.46% of all actual HC instances, resulting in an F1-score of 0.9623, indicating strong performance. TYLCD showed excellent results with a Precision of 0.9867 and a Recall of 0.9978. The F1-Score of 0.9922 reflects the model’s high accuracy in identifying this disease. TS had a Precision of 0.8548, indicating 85.48% accuracy in predictions and a Recall of 0.9550, meaning 95.50% of actual TS instances were detected. The F1-Score of 0.9021 shows a good balance between Precision and Recall, although performance is slightly lower than for the other classes. For ToMV, the model achieved perfect Precision (1.0000), correctly predicting all instances, but had a lower Recall of 0.7632, identifying 76.32% of actual instances, leading to an F1-score of 0.8657. Finally, TSSM showed a precision of 0.9493, accurately identifying 94.93% of predicted instances and a Recall of 0.8733, detecting 87.33% of all actual instances, resulting in an F1-score of 0.9097. The overall accuracy of the model was 95.72%, indicating strong performance across all classes. The macro average values (0.9483 for Precision, 0.9128 for Recall and 0.9264 for F1-Score) reflect robust overall performance, while the weighted average values (0.9589 for Precision, 0.9572 for Recall and 0.9567 for F1-score) demonstrate consistency in classification despite the varying number of instances per class. The model performs particularly well with HC and TYLCD, though there is room for improvement in distinguishing ToMV and TS.

Table 2: Performance evaluation metrics for the developed model.


       
Fig 5 (a-f) provides few examples of tomato leaf disease classification with predicted outcomes, actual classes and confidence values. These images represent different predictions by the model on tomato leaves infected by various diseases. In 5(a), the model accurately predicted TYLCD with 100% confidence, perfectly matching the actual label. 5(b) displays a correct prediction of TS with 95.13% confidence, indicating strong performance. In 5(c), the model correctly classified another instance of TYLCD with a confidence of 98.69%. For 5(d), the model successfully identified a healthy leaf with 99.89% confidence, demonstrating its ability to distinguish non-diseased leaves. Similarly, 5(e) shows another correct prediction of TYLCD with 99.97% confidence, emphasizing the model’s reliability in identifying this disease. Finally, in 5(f), the model accurately predicted TS with 98.61% confidence, further confirming its capability to classify this class with high certainty.

Fig 5: The prediction of diseases.


       
The model shows remarkable accuracy in classifying diseases like TYLCD and TS, as well as identifying healthy leaves. These results can help farmers detect diseases at an early stage and manage tomato crops effectively. This can improve yields and reduce losses.
The study developed a CNN model for the identification of tomato leaf diseases, achieving a high overall accuracy of 95.72%. The model performed well in classifying healthy leaves and TYLCD while showing limitations in distinguishing between classes like ToMV and TS. Data preprocessing, model design and evaluation metrics, including precision, recall and F1-score, demonstrated the model’s effectiveness in early disease detection, aiding agricultural crop management. The study has some limitations. The model showed reduced accuracy in differentiating certain similar disease classes. Moreover, it relied heavily on a specific dataset, which may not capture real-world variability. Future work will include expanding the dataset with more diverse samples and optimizing the CNN architecture to enhance classification accuracy. Implementing the model in field conditions using mobile or IoT devices can improve practical utility for farmers.
Disclaimer
 
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.
 
Funding details
 
This research received no external funding.
 
Authors’ contributions
 
All authors contributed toward data analysis, drafting and revising the paper and agreed to be responsible for all the aspects of this work.
 
Availability of data and materials
 
Not applicable.
 
Use of artificial intelligence
 
Not applicable.
 
Declarations
 
Authors declare that all works are original and this manuscript has not been published in any other journal.
Authors declare that they have no conflict of interest.

  1. Agarwal, M., Singh, A., Arjaria, S., Sinha, A. and Gupta, S. (2020). ToLeD: Tomato leaf disease detection using convolution neural network. Procedia Computer Science. 167: 293- 301. https://doi.org/10.1016/j.procs.2020.03.225. 

  2. AlZubi, A.A. (2023). Artificial intelligence and its application in the prediction and diagnosis of animal diseases: A review. Indian Journal of Animal Research. 57(10): 1265-1271. doi: 10.18805/IJAR.BF-1684

  3. Basha, S.J., Veeraiah, D., Dev, B.S., Hymavathi, C.S.L. and Govardhan, I. (2024). Tomato guard: A predictive model for disease prediction and treatment recommendation in tomato plants. 2024 3rd International Conference on Applied Artificial Intelligence and Computing (ICAAIC), Salem, India. pp: 1102- 1107. https://doi.org/10.1109/ICAAIC60222.2024.10575613.

  4. Blancard, D., Laterrot, H., Marchoux, G., Fletcher, J., Candresse, T. (2012). Tomato diseases: Identification, biology and control. Netherlands: Manson Publishing Limited. 

  5. Castañé, C., van der Blom, J., Nicot, P.C. (2020). Tomatoes. In: Gullino, M., Albajes, R., Nicot, P. (eds) Integrated Pest and Disease Management in Greenhouse Crops. Plant Pathology in the 21st Century. Springer, Cham. vol 9. https://doi.org/10.1007/978-3-030-22304-5_17. 

  6. 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

  7. Food and Agriculture Organization (FAO), (2023). The future of food and agriculture: Drivers and triggers for transformation. FAO, (Accessed: 5 December 2024). https://openknowledge. fao.org/server/api/core/bitstreams/28cfd24e-81a9-4ebc- b2b5-4095fe5b1dab/content/cc8166en.html. 

  8. Hai, N.T. and Duong, N.T. (2024). An improved environmental management model for assuring energy and economic prosperity. Acta Innovations. 52: 9-18. https://doi.org/ 10.62441/ActaInnovations.52.2 

  9. Huang, M-L., Chang, Y-H. (2020). Dataset of Tomato Leaves, Mendeley Data, V1, https://data.mendeley.com/datasets/ngdgg 79rzb/1.

  10. Khan, A., Sohail, A., Zahoora, U. and Qureshi, A.S. (2020). A survey of the recent architectures of deep convolutional neural networks. Artificial Intelligence Review. 53: 5455-5516. https://doi.org/10.1007/s10462-020-09825-6.

  11. Koike, T., Yamamoto, S., Furui, T., Miyazaki, C., Ishikawa, H. and Morishige, K.I. (2023). Evaluation of the relationship between equol production and the risk of locomotive syndrome in very elderly women. International Journal of Probiotics and Prebiotics. 18(1): 7-13. https://doi.org/ 10.37290/ijpp2641-7197.18:7-13. 

  12. Kumar, V., Chaturvedi, V., Lal, B. and Alam, S. (2023). Application of machine learning in analyzing the psychological well being amongst the employees in the private sector. An Analysis of Work-Life Balance in the Healthcare Industry. Pacific Business Review (International). 16(1): 124-131.

  13. Kusanur, V. and Chakravarthi, V. S. (2021). Using transfer learning for nutrient deficiency prediction and classification in tomato plant. Int. J. Adv. Comput. Sci. Appl. 12(10): 784- 790. 

  14. Prasad, A., Sharma, N., Hari-Gowthem, G., Muthamilarasan, M. and Prasad, M. (2020). Tomato yellow leaf curl virus: Impact, challenges and management. Trends in Plant Science. 25(9): 897-911. https://doi.org/10.1016/j.tplants.2020.03.015. 

  15. Savary, S., Willocquet, L. (2020). Modeling the impact of crop diseases on global food security. Annual Review of Phytopathology. 58: 313-341. https://doi.org/10.1146/annurev- phyto-010820-012856.

  16. Sood, M., Srivastava, J., Mallick, A.K. (2024). Revolutionizing tomato agriculture: Leaf disease detection using CNN and its variants. 2024 IEEE 9th International Conference for Convergence in Technology (I2CT), Pune, India. 1-6. https: //doi.org/10.1109/I2CT61223.2024.10544294.

  17. Taye, M.M. (2023). Theoretical understanding of convolutional neural network: Concepts, architectures, applications, future directions. Computation. 11(3): 52.  https://doi.org/ 10.3390/computation11030052. 

  18. Tian, K., Zeng, J., Song, T., Li, Z., Evans, A. and Li, J. (2023). Tomato leaf diseases recognition based on deep convolutional neural networks. Journal of Agricultural Engineering. 54(1). https://doi.org/10.4081/jae.2022.1432.

  19. Untari, D.T. and Satria, B. (2022). Repositioning culinary “betawi ora” as bekasi eco-culinary tourism icon. International Journal of Environmental Sciences. 8(2): 15-24. https:// www.theaspd.com/resources/IJES%20Paper02-%20Dhian %20Tyas.pdf.

  20. Wihardjo, R.S.D., Muktiono, A. and Suwanda (2024). Exploring critical thinking in environmental education: A PBL approach to reaction rate material at public senior high schools in Indonesia. International Journal of Environmental Sciences. 10(1): 14-25. https://www.theaspd.com/resources/2.%20 Exploring%20Critical%20Thinking%20in%20Environ- mental%20Education.pdf.

  21. Wasik, S. and Pattinson, R.  (2024). Artificial intelligence applications in fish classification and taxonomy: Advancing our under- standing of aquatic biodiversity. Fish Taxa. 31: 11-21. 
In this Article
Published In
Indian Journal of Agricultural Research

Editorial Board

View all (0)