با همکاری انجمن مهندسان مکانیک ایران

نوع مقاله : مقاله پژوهشی انگلیسی

نویسنده

گروه مهندسی تولید و ژنتیک گیاهی، دانشکده کشاورزی، آب، غذا و فراسودمندها، واحد اصفهان (خوراسگان)، دانشگاه آزاد اسلامی، اصفهان، ایران

چکیده

در موضوع بیماری‌های گیاهی، انتخاب روش‌های پیشگیری مناسب مانند کاربرد علف‌کش‌ها تنها زمانی امکان‌پذیر است ‌که نوع بیماری به سرعت و به دقت تشخیص داده شود. در این مطالعه یک مدل یادگیری انتقالی بر مبنای مدل از پیش آموزش‌دیده EfficientNet به‌منظور تشخیص و دسته‌بندی برخی از بیماری‌های گوجه‌فرنگی با استفاده از 2340 تصویر از گیاه گوجه‌فرنگی به‌عنوان پایگاه تصاویر آموزشی توسعه یافت. برمبنای نتایج این مطالعه در مرحله اعتبارسنجی مدل، نرخ دسته‌بندی تصاویر در حدود 5 fps (5 فریم در ثانیه) بود که برای مدل یادگیری عمیقی که روی رایانه مجهز به CPU معمولی اجرا می‌شود، منطقی است. به‌علاوه چون منحنی‌های صحت و هزینه مربوط به مراحل آموزش و آزمایش در عددهای دوره بیش از 20 تقریباً افقی شده بودند (از نظر عددی، بدترین ضریب تغییرات داده‌های مربوط به این چهار حالت 7% بود)، مدل به‌خوبی آموزش دیده است و افزایش عدد دوره به افزایش صحت مدل منجر نخواهد شد. به‌علاوه سلول‌های واقع در قطر اصلی ماتریس در هم‌ریختگی مربوط به عملکرد مدل روی تصاویر آزمون با اعداد بزرگتری در مقایسه با محتوای سایر سلول‌های ماتریس پر شده بودند، به‎طور دقیق 88.8%، 7.7%، و 3.3% از سلول‌های باقیمانده (جایی‎که سلول‌های مربوط به قطر اصلی ماتریس کنار گذاشته شده بودند) به‌ترتیب با اعداد 0 و 1 و 2 پر شده بودند. در نهایت مقادیر حساسیت، اختصاصیت، دقت، نمره F1 و صحت مدل به‌ترتیب برابر با 85%، 98%، 86%، 84% و 85% بود.

کلیدواژه‌ها

موضوعات

Introduction

In the context of plant diseases, the selection of appropriate preventive measures, such as correct pesticide application, is only possible when plant diseases have been diagnosed quickly and accurately. If plant diseases are not controlled on time, a significant reduction in crop quantity and quality will result.

One of the methods used to detect plant diseases is through human observation of disease symptoms on different parts of the plant. Since different diseases may have similar symptoms, an amateur inspector may falsely diagnose a disease, and the wrong chemical may be chosen to cure the disease (Shah, Harshadkumar, Prajapati, and Dabhi, 2016); however, machine learning (ML) techniques such as feature extraction and classification can help an amateur inspector in this regard (Jena, Sethy, and Behera, 2021). Ali, Bachik, Muhadi, Tuan Yusof, and Gomes (2019) highlighted that utilizing machine learning techniques to evaluate plant diseases leads to enhanced precision, reliability, and accuracy. The inability of machine learning techniques to reliably detect subtle indications of plant illnesses and early-stage disease detection, and the requirement for complex and high-resolution images, are drawbacks of using feature extraction approaches for plant disease diagnosis (Anjna, Sood, and Singh, 2020; Genaev et al., 2021).

Using deep learning (DL) techniques such as Convolutional Neural Networks (CNNs) and Deep Belief Networks (DBNs) can overcome the limitations of traditional ML methods (Khan, Khan, Albattah, and Qamar, 2021; Liu and Wang, 2021); however, DL models need high computational power, a limiting factor for some applications.

Another Artificial Intelligence (AI) model that has been recently used for plant disease detection is a model based on the transfer learning (TL) concept. In the TL paradigm, a pre-trained DL model is used to develop a custom model on another dataset that has the same function as the first pre-trained model. In other words, TL entails refining pre-trained models using a custom dataset to boost the performance of a model developed specifically for that dataset.

The accuracies obtained in studies conducted on plant disease identification using AI methods range from above 50% to nearly 100%. For example, Burhan, Minhas, Tariq, and Nabeel Hassan (2020) performed a study on five different modern DL models to identify rice diseases and obtained accuracies of 70.42%, 73.6%, 51.99%, 61.6%, and 87.79% on VGG16, VGG19, ResNet50, ResNet50v2, and ResNet101v2 models, respectively. Agarwal, Singh, Arjaria, Sinha, and Gupta (2020) carried out a study to classify 9 groups of tomato diseases and obtained accuracy values of 63.7%, 63.4%, and 90% using InceptionV3, MobileNet, and VGG16 models, respectively. Batool, Hyder, Rahim, Waheed, and Asghar (2020) aimed to detect and classify tomato leaf diseases using a training dataset of 450 images. Results showed that among the models used, the AlexNet model was superior, with an accuracy of 76.1%. Kirola et al. (2022) compared the performance of five ML models and one DL model for plant disease prediction. They stated that the accuracies of ML models such as LR, SVM, KNN, RF, and NB were 71.89%, 75.76%, 82.17%, 97.12%, and 81.12%, respectively; while the accuracy of the deep learning CNN model was 98.43%. Bharali, Bhuyan, and Boruah (2019) developed a new architecture called plant disease detection neural network (PDDNN). An 86% accuracy was obtained for detecting diseases of maize, grape, apple, and tomato plants using this architecture. Balaji et al. (2023) utilized an enhanced CNN technique to detect rice diseases. For the TL, CNN+TL, ANN, and ECNN+GA models, they attained accuracies of 80%, 85%, 90%, and 95%, respectively. A fully connected CNN method was employed by Upadhyay and Kumar (2022) to identify three rice illnesses. Four thousand photos of each sick leaf and four thousand photos of healthy rice leaves were used to train the model. This study's accuracy rate was 99.7%.

To sum up, the development of a deep learning model for diagnosing some groups of tomato diseases, in order to assist in the curing process of diseased plants, is the main challenge followed in this study. Another challenge of this study is the lack of modern hardware resources required for running a deep learning model. In this study, it is necessary to run the model on a regular computer with a CPU instead of a modern GPU. It appears that the only deep learning model that may satisfy these criteria is the transfer learning (TL) model. As a result, a TL model based on the EfficientNet pre-trained model was implemented to distinguish between healthy tomatoes and nine groups of diseased plants. The original small custom dataset contained 320 images of tomato plants, divided into 234 images for the training dataset and 86 images for the test dataset; however, the training dataset was augmented, and the final number of images in it was increased to 2340 images. The following justifies the use of EfficientNet as a pre-trained model: EfficientNet emerges as a superior model for image classification tasks due to its efficient network structure and ingenious mechanisms. It utilizes a triplet attention mechanism to enhance feature expression and acquire channel and spatial attention information, leading to improved accuracy. Additionally, the model enhances transfer learning by loading pre-trained parameters, accelerating convergence, and reducing training time, resulting in strong robustness and generalization ability. These specifications make EfficientNet a powerful choice for image classification tasks, surpassing other models in accuracy and efficiency (Huang, Su, Wu, and Chen, 2023).

Materials and Methods

Preparation of raw images

Nine predominant diseases of the tomato plant (Solanum lycopersicum) along with healthy crops, were considered as targets for diagnosis. The names of these diseases served as the classifier groups’ names: Anthracnose, Bacterial_Speck, Blossom_End_Rot, Buckeye_Rot, Damping_Off, Gray_Wall, Healthy_Tomato, Leaf_Mold, Southern_Blight, and Tomato_Pith_Necrosis. Some of the pictures belonging to each group were considered for developing the model. While the total number of images was 2426, they were divided into 2340 pictures in the train folder and 86 pictures in the test folder. The exact number of pictures in the train and test datasets of each classifier group are as follows: Anthracnose (300, 11), Bacterial_Speck (170, 6), Blossom_End_Rot (350, 13), Buckeye_Rot (200, 7), Damping_Off (220, 9), Gray_Wall (120, 5), Healthy Tomato (230, 10), Leaf_Mold (320, 11), Southern_Blight (140, 4), and Tomato_Pith_Necrosis (290, 10). The first number in the parentheses indicates the number of images in the training dataset for that classifier group, while the second number indicates the number of images in the test dataset. Images of the "train" folder will be used for training the model (i.e. changing weights of the model in the convergence direction so that the model predictions on train images match reality), while the unseen images of the "test" folder will be used to test the goodness of those weights for diagnosing tomato diseases.

Model development procedure

Development of the model was conducted using code written in the PyCharm environment, using the PyTorch package of the Python programming language. The codes are attached to this paper as an appendix. Some functions in the PyTorch package make it suitable for creating models based on the transfer learning concept.

The architecture of the TL model to classify 10 groups of tomato diseases is shown in Table 1.

Table 1. The architecture of the TL model based on the EfficientNet pre-trained model

As shown, the parameters of the feature extraction section are not trainable during the model’s training process, and only the parameters of the classifier section are trainable. This leads to a significant decrease in the model’s training time. Numerically, the number of trainable parameters decreased from 4,020,358 parameters of the EfficientNet model to 12,810 parameters of the model based on the transfer learning concept. This feature of the TL model allows it to run efficiently on a regular computer with a standard CPU in a reasonable time.

Other informative data about the TL model are summarized in Table 2.

Parameter Setting
Training epoch 30
Batch size 32
optimizer Adam
Learning rate 0.001
Loss function Cross-Entropy
Table 2. Complementary information about the TL model

Model evaluation criteria

Sensitivity (Recall): This criterion measures how well a model can detect positive instances; in mathematical terms, it can be calculated using the formula:

Sensitivity (Recall)=TPTP+FN(1)

Where TP is the number of instances that are truly predicted as positive, and FN is the number of instances that are falsely predicted as negative.

Specificity: This criterion measures the model’s ability to predict true negatives in each of the available categories. In mathematical terms, it can be calculated using the formula:

Specificity =TNTN+FP(2)

where TN is the number of instances that are truly predicted as negative, and FP is the number of instances that are falsely predicted as positive.

Precision: This criterion measures the ratio of the number of instances that are predicted as true positives to the total number of instances predicted as positive. In mathematical terms, it can be calculated using the formula:

Precision =TPTP+FP(3)

F1 score: The F1 score is calculated by taking the harmonic average of recall and precision. In mathematical terms, we have:

F1 score =2×Precision×RecallPrecision+Recalls(4)

If either precision or recall is zero, then the F1 score will be zero, but the arithmetic average of precision and recall will be a number greater than zero.

Accuracy: This criterion measures the ratio of the number of true predictions made by the model to the total number of predictions. In mathematical terms, we have:

Accuracy =i=1n(TPi)i=1n(TPi+FPi)(5)

Where n is the number of classes; in this study, n is 10. During model training, this criterion was calculated after each epoch (there are 30 epochs during model training in this study), and then accuracy and loss values were charted against the corresponding epoch number. These charts can be used to be sure about the number of epochs for model training; in other words, if the curve of accuracy or loss versus epoch number remains horizontal for a few epochs, it is an indication for the completion of the model’s training phase.

Confusion matrix: To obtain a complete understanding of where a false prediction has taken place, and with which group the prediction has been confused, a confusion matrix will be used. In this paper, a 10×10 confusion matrix was developed to show the location of false tomato disease predictions. In a confusion matrix, the greater the concentration of large numbers in the cells of the main diagonal of the matrix (the more zeros or small numbers in the other cells of the matrix), the better. The values of TP, FP, FN, and TN can be obtained from the confusion matrix. The values of the cells located on the main diagonal of the matrix comprise the TP values. If the TP value of each class is subtracted from the sum of cells for the corresponding column, the FP value for that class will result. On the other hand, if the TP value of each class is subtracted from the sum of the cells for the corresponding row, the FN value of that class will be obtained. Finally, the TN values can be obtained by subtracting the sum of the TP, FP, and FN values from the number of pictures in the test dataset.

Results and Discussion

Accuracy values versus corresponding epoch numbers:Figure 1 shows the train and test accuracies, as well as the losses of the model versus the corresponding epoch numbers.

Fig. 1. Train and test losses and accuracies versus corresponding epoch number

The first point inferred from Figure 1 is that because the curves of train and test accuracies have been approximately horizontal for epoch numbers greater than 20, the model has learned well, and increasing the epoch number cannot further increase model accuracy. Numerically, by recording values of model accuracies and losses in the training and testing phases for epoch numbers greater than 20, the worst coefficient of variation for these four cases was 7%. Another point that can be obtained from this chart is that since the distance between train and test accuracies is about 10%, and this situation has taken place for train accuracies near 95%, therefore, the model shows neither signs of under fitting nor over fitting.

Confusion matrix of the test instances:Figure 2 shows the confusion matrix obtained for the 86 images in the test dataset.

Fig. 2. Confusion matrix obtained in this study

This picture presents a matrix of real (ground truth) labels versus predicted ones. As shown, the elements along the primary diagonal of the matrix are filled with larger values compared to those in the other cells. The values of the primary diagonal of the matrix comprise the number of images in each disease's category that were predicted truly as positive; in other words, these values are the TP values of classes. The FP, TN, and FN values can be obtained from this matrix, too. Table 3 shows TP, FP, TN, and FN values of each category of tomato diseases considered in this study:

Disease category TP FP FN TN
Anthracnose 7 1 4 74
Bacterial Speck 6 2 0 78
Blossom_End_Rot 13 4 0 69
Buckeye Rot 3 0 4 79
Damping_Off 8 0 1 77
Gray Wall 4 1 1 80
Healthy Tomato 10 1 0 75
Leaf_Mold 10 1 1 74
Southern Blight 3 0 1 82
Tomato_Pith_Necrosis 9 3 1 73
Table 3.Suitable data obtained from the confusion matrix

Calculation of sensitivity (recall), specificity, precision, F1 score, and accuracy of the model: The values presented in Table 3 can be used to obtain sensitivity (recall), specificity, precision, F1 score, and accuracy of the model. Table 4 shows the calculated values of the above-mentioned criteria.

Disease category Sensitivity (recall) Specificity Precision F1 score
Anthracnose 0.64 0.99 0.88 0.74
Bacterial Speck 1 0.98 0.75 0.86
Blossom_End_Rot1 0.95 0.76 0.86
Buckeye Rot 0.43 1 1 0.6
Damping_Off 0.89 1 1 0.94
Gray Wall 0.8 0.99 0.8 0.8
Healthy Tomato 1 0.99 0.91 0.95
Leaf_Mold 0.91 0.99 0.91 0.91
Southern Blight 0.75 1 1 0.86
Tomato_Pith_Necrosis 0.9 0.96 0.75 0.82
Table 4. Calculated values of sensitivity (recall), specificity, precision, and F1 score

The criteria values shown in Table 4 were calculated for each category of tomato diseases. To obtain corresponding criteria for the model, regular or weighted averaging can be carried out. Table 5 shows the sensitivity (recall), specificity, precision, and F1 score of the model.

Average Sensitivity (recall) Specificity Precision F1 score
Regular 0.832 0.985 0.876 0.834
Weighted 0.85 0.982 0.868 0.841
Table 5. Sensitivity (recall), specificity, precision, and F1 score of the model calculated from regular and weighted averaging

The accuracy of the model was obtained from the formula of accuracy =i=110(TPi)i=110(TPi+FPi)=7386=0.85

To assess the performance of the model visually, model predictions on some tomato images were considered. Figure 3 shows the predictions of the model on twenty randomly selected images in the test dataset.

Three acronyms are displayed on top of each image: Pred, Prob, and RPD. Pred is the acronym for prediction and shows the predicted group of the image. RPD is the acronym for real parent directory and shows the correct directory that the image belongs to. Prob is the acronym for probability and presents the probability value that the image belongs to the predicted group. In other words, the classifying algorithm calculates ten probabilities for each image that represent the belonging probabilities of the image to each of the tomato disease groups, and declares the tomato disease group with the highest probability value as the image’s predicted group. As shown in Fig. 3, 3 out of 20 predictions were incorrect, which indicates the error rate of 15% (i.e. the accuracy of 0.85). On the other hand, there is a trade-off between the performance of a machine learning method and the time spent or computational resources devoted to training the model. Although the time spent training the model in this study was about 4.5 hours, which is high, the model was trained on a computer without a GPU. Additionally, it took just 16 seconds to classify 86 images from the test dataset during the model's validation phase.

Fig. 3. Predictions of the model on some random images of tomato plants selected from the test dataset

This means that the model performed well during validation, achieving an image classification rate of about 5 frames per second (fps). Furthermore, the model's accuracy was comparable to some of the findings made by other researchers (Burhan et al., 2020; Batool et al., 2020); however, in some similar studies, higher accuracies were obtained (Jasim and Al-Tuwaijari, 2020; Guerrero-Ibanez and Reyes-Munoz, 2023; Ahmed and Yadav, 2023; Zhao, Peng, Liu, and Wu, 2021). To explain the observed differences, it should be noted that in the studies conducted by Jasim and Al-Tuwaijari (2020) and Guerrero-Ibanez and Reyes-Munoz (2023), they reached accuracies higher than 98% by training complete CNN models, instead of transferring the weights of a pre-trained model to a TL model and only training the classifier section of the model. On the other hand, in the studies conducted by Zhao et al. (2021), and Ahmed and Yadav (2023), more images capturing only the leaves of plants were used to train the model. This differs from the proportion of images examined in this study. Therefore, it is necessary to consider all the conditions surrounding a model and not focus on a single criterion in order to have a fair judgment about the model’s performance.

Conclusion

In conclusion, in this study, a computationally inexpensive TL model trained on a dataset containing a mixture of images such as leaf, fruit, and stem was used to discriminate between healthy tomatoes and nine groups of diseased plants. According to the obtained results, the model's overall performance metrics are: sensitivity 85%, specificity 98%, precision 86%, F1-score 84%, and accuracy 85%, which is acceptable.

Conflict of Interest: The author declares no competing interests.

References

  1. Agarwal, M., Singh, A., Arjaria, S., Sinha, A., and Gupta S. T. (2020). Tomato leaf disease detection using convolution neural network. Procedia Computer Science, 167, 293-301.DOI
  2. Ahmed, I., and Yadav, P. K. (2023). A systematic analysis of machine learning and deep learning based approaches for identifying and diagnosing plant diseases. Sustainable Operations and Computers, 4, 96-104.DOI
  3. Ali, M. M., Bachik, N. A., Muhadi, N. A., Tuan Yusof, T. N., and Gomes, C. (2019). Nondestructive techniques of detecting plant diseases: A review. Physiological and Molecular Plant Pathology, 108, 101426.DOI
  4. Anjna, Sood, M., and Singh, P. K. (2020). Hybrid system for detection and classification of plant disease using qualitative texture features analysis. Procedia Computer Science, 167, 1056-1065.DOI
  5. Balaji, V., Anushkannan, N. K., Narahari, Sujatha Canavoy, Rattan, Punam, Verma, Devvret, Awasthi, Deepak Kumar, Pandian, A. Anbarasa, Veeramanickam, M. R. M., Mulat, and Molla Bayih (2023). Deep transfer learning technique for multimodal disease classification in plant images. Contrast Media and Molecular Imaging, 5644727.DOI
  6. Batool, A., Hyder, S. B., Rahim, A., Waheed, N., and Asghar, M.A. (2020). Classification and identification of tomato leaf disease using deep neural network. International Conference on Engineering and Emerging Technologies (ICEET).DOI
  7. Burhan, S. A., Minhas, D. S., Tariq, D. A., and Nabeel, H. M. (2020). Comparative study of deep learning algorithms for disease and pest detection in rice crops. 12th International Conference on Electronics, Computers and Artificial Intelligence (ECAI).DOI
  8. Genaev, M. A., Skolotneva, E. S., Gultyaeva, E. I., Orlova, E. A., Bechtold, N. P., and Afonnikov, D. A. (2021). Image-based wheat fungi diseases identification by deep learning. Plants, 10(8), 1-21.DOI
  9. Guerrero-Ibanez, A., and Reyes-Munoz, A. (2023). Monitoring tomato leaf disease through convolutional neural networks. Electron, 12(1), 1-15.DOI
  10. Bharali, P., Bhuyan, C., and Boruah, A. (2019). Plant Disease Detection by Leaf Image Classification Using Convolutional Neural Network. In: Gani, A., Das, P., Kharb, L., Chahal, D. (eds) Information, Communication and Computing Technology. ICICCT 2019. Communications in Computer and Information Science, vol 1025. Springer, Singapore.DOI
  11. Huang, Z., Su, L., Wu, J., and Chen, Y. (2023). Rock Image Classification Based on EfficientNet and Triplet Attention Mechanism. Applied Science Letters, 13, 3180.DOI
  12. Jasim, M. A., and Al-Tuwaijari, J. M. (2020). Plant leaf diseases detection and classification using image processing and deep learning techniques. International Conference on Computer Science and Software Engineering.DOI
  13. Jena, L., Sethy, P. K., and Behera, S. K. (2021). Identification of wheat grain using geometrical feature and machine learning. In: 2nd international conference for emerging technology (INCET) (pp. 1_6).
  14. Khan, R. U., Khan, K., Albattah, W., and Qamar, A.M. (2021). Image-based detection of plant diseases: from classical machine learning to deep learning journey. Wireless Communications and Mobile Computing, 1-13.DOI
  15. Kirola, M., Joshi, K., Chaudhary, S., Singh, N., Anandaram, H., and Gupta, A. (2022). Plants diseases prediction framework: a imagebased system using deep learning. Proc IEEE World Conf Appl Intell Comput.DOI
  16. Liu, J., and Wang, X. (2021). Plant diseases and pests detection based on deep learning: a review. Plant Methods, 17(1), 1-18.DOI
  17. Shah, J. P., Harshadkumar, B., Prajapati, V. K., and Dabhi. (2016). A survey on detection and classification of rice plant diseases. In: IEEE international conference on current trends in advanced computing (ICCTAC).DOI
  18. Upadhyay, S. K., and Kumar, A. (2022). A novel approach for rice plant diseases classification with deep convolutional neural network. International Journal of Information Technology, 14(1):185-99.DOI
  19. Zhao, S., Peng, Y., Liu, J., and Wu, S. (2021). Tomato leaf disease diagnosis based on improved convolution neural network by attention module. Agriculture,DOI

©2025 The author(s). This is an open access article distributed under Creative Commons Attribution 4.0 International License (CC BY 4.0)

CAPTCHA Image