Plant Disease Diagnosis and Image Classification Using Deep Learning

Indian agriculture is striving to achieve sustainable intensification, the system aiming to increase agricultural yield per unit area without harming natural resources and the ecosystem. Modern farming employs technology to improve productivity. Early and accurate analysis and diagnosis of plant disease is very helpful in reducing plant diseases and improving plant health and food crop productivity. Plant disease experts are not available in remote areas thus there is a requirement of automatic low-cost, approachable and reliable solutions to identify the plant diseases without the laboratory inspection and expert’s opinion. Deep learning-based computer vision techniques like Convolutional Neural Network (CNN) and traditional machine learning-based image classification approaches are being applied to identify plant diseases. In this paper, the CNN model is proposed for the classification of rice and potato plant leaf diseases. Rice leaves are diagnosed with bacterial blight, blast, brown spot and tungro diseases. Potato leaf images are classified into three classes: healthy leaves, early blight and late blight diseases. Rice leaf datasetwith 5932 images and 1500 potato leaf images are used in the study. The proposed CNN model was able to learn hidden patterns from the raw images and classify rice images with 99.58% accuracy and potato leaves with 97.66% accuracy. The results demonstrate that the proposed CNN model performed better when compared with other machine learning image classifiers such as Support VectorMachine (SVM),K-Nearest Neighbors (KNN),Decision Tree and Random Forest.


Introduction
In India, the agriculture sector employed a 50% workforce and contributed 19.9% of India's GDP in 2020-21. To ensure the high yield agriculture sector needs to be supported by the latest technological advancements. Agriculture crops suffer heavy losses due to insect damage and plant diseases. The expected population of the world by 2050 is 9.2 billion and to meet the food requirements, food production should increase by about 70% [1]. Food crops suffer heavy losses due to strong winds, adverse weather conditions, drought, fungi, bacteria, viruses, etc. Worldwide out of the crop losses 70-80% of losses are caused by plant diseases. Efforts should be made to reduce crop losses due to plant diseases. Early diagnosis of plant diseases can help farmers in developing defense mechanisms resulting in healthy and productive food crops. Detecting and getting rid of the diseases will aid in increasing productivity. Potato (Solanum tuberosum) is an important cash food crop. Worldwide more than 300 million metric tons of potato are produced in more than 100 different countries. In the year 2018-19, India produced about 53 million tonnes of potato. China is a top producer of potatoes followed by India, Russia, Ukraine and the USA. Potato is a root vegetable with more than 1000 different varieties is an essential staple food source and is a major vegetable crop based on its production and consumption worldwide. It is carbohydrate-rich and has good nutritional quality. The potato crop is a major source of income for farmers. Different diseases of potato are early blight caused by fungus Alternaria Solani [2], late blight fungus, Potato virus Y which is a pathogenic virus, bacterial wilt, black scurf [3] common scab, fusarium dry rot, black dot, silver scurf, pink rot, brown center, hollow heart, etc. Potato blight disease can destroy food crops. Traditionally Paddy or rice has been very important and demanding crops in South Asia [4] and with the growing population, the demand is ever increasing. More than 50% of the world's population consumes rice as their staple food. Mass loss of rice crops can be prevented if correct diagnoses of the diseases are done during the initial stage. Rice plant suffers from different biotic diseases like rice leaf blast, neck blast, steath blight, steath rot, bakanae, tungro, bacterial leaf blight, brown spot, narrow brown spot, stunt, leaf streak, [5] etc. In this paper, 4 different major rice leaf diseases including bacterial blight, blast, brown spot and tungro [6] are diagnosed. Preventive measures must be taken at an initial stage to stop the epidemic. If the disease is treated from the leaves at an early stage disease will not spread to the stem and food crop can be saved from damages. Early diagnosis and adopting preventive measures to curb these diseases can help in producing healthy tuber and increased potato and paddy yield. Computer vision techniques can be used for the diagnosis of diseases by inspecting leaf images. Computer Vision by using digital image processing can be used for plant disease image classification tasks [7]. A deep learning approach employing a CNN for image classification is presented in this paper. The developed approach for image classification shows very promising results. This paper is organized into 6 sections. Section 1 introduces the plant diseases and the need for timely detection of plant diseases, Section 2 presents a literature review, Section 3 presents the datasets used for the study and proposes the CNN model, Section 4 discusses the implementation and performance of the proposed classifier. Activation maps outputted by the CNN model layers are discussed. Section 5 compares different performance parameters of the proposed approach with 4 other image classification algorithms. Finally, we have concluded our paper in Section 6.

Literature Review
Plant pathologists analyze different parts of the plants like root, kernel, stem and leaf for the classification of plant diseases. Ferentinos [8] presented a paper implementing different plant disease classification CNN model architectures diseases with high accuracy. Brahimi et al. [9] investigated 14828 images of tomato leaves infected by nine different diseases. By using localized diseased regions of the leaf, and the availability of a sufficient dataset the CNN model was able to provide 99.18% of accuracy. Plant pests had harm crops and can cause serious losses to farmers. Dawei et al. [10] in his research paper used transfer learning to improve the accuracy to indent the pests and showed promising results. Singh et al. [11]. The proposed classifier achieved 96.46% accuracy and performed better than other machine learning algorithms like (SVM, Decision Tree, Logistic Regression and KNN) as well as transfer learning approaches [12] (AlexNet, ResNet, VGG16, Inception V3). Hasan et al. [13] used a region-based CNN model for estimating the wheat yield and achieved the average accuracy ranging from 88% to 94%. The model was applied for estimating the yield production of different wheat varieties. Patil and Bodhe for plant disease detection extracted shape features of leaves of sugarcane. They used threshold segmentation and triangle segmentation for determining the leaf and lesioning area and achieved 98.6% accuracy [14]. Oppenheim et al. [15] presented a research paper titled "Using deep learning for image-based potato tuber disease detection" used computer vision for potato disease classification using a CNN model. Oppenheim et al. [16] used the CNN model to classify tubers into five different classes. Barbedo, Jiang et al. (2016) presented a research paper that identified image processing research requirements to automatically identify the diseases in the plants. The real-time apple leaf disease classification approach was proposed by Jiang et al. [17] using the VGG-Inception model and rainbow concatenation. The proposed approach when tested with the apple leaf dataset performed with a test accuracy of 97.14%. The proposed approach outperformed other well-known pre-trained models. Atole et al. [18] presented a research paper using a pretrained AlexNet deep network for the classification of rice plants into three classes and achieved an accuracy of 91.23%. A. P. Singh presented a research paper illustrating feature selection using artificial bee colony to determine the optimal feature set required for the identification of diseases of grape plant images using a support vector machine classifier. The proposed algorithm achieved 92.14% accuracy [19]. Zhu et al. [20] applied Inception V2 with batch normalization and achieved higher accuracy when compared to Faster RCNN for plant species classification task. Zhang [21] proposed a classification framework and named it diverse region-based CNN capable of encoding context-aware representation and obtaining features. Nanehkaran et al. [22] proposed a two-step method for plant leaf disease identification namely image segmentation and image classification. An image segmentation approach based on hue, saturation and intensity was proposed. The segmented images were classified using the CNN model to achieve higher accuracy. W. Shaohua and S. Goudos (2020) demonstrated accurate and faster object detection using the deep learning model R-CNN [23]. A deep learning-based plant species identification approach (D-Leaf) was presented by Rani et al. [24]. Pre-trained models were used for feature extraction and image classification task was performed by machine learning techniques. D-leaf model with ANN classifier was able to achieve an accuracy of 94.88%.
Image classification approach for optimizing the hyper-parameters of the Support Vector Machine (SVM) model with an improved artificial bee colony nature-inspired optimization algorithm was proposed by Zhao et al. [25]. For comparative study Genetic algorithm (GA)-SVM and Particle swarm optimization PSO-SVM approaches were studied. The proposed approach for the classification of hyperspectral images performed better than other comparative methods with an accuracy of 98.28%. Nature-inspired algorithms make use of real-world optimization approaches. Popular nature-inspired optimization algorithms are genetic optimization, three-parent genetic optimization [26], parallel 3-parent genetic algorithm [27], artificial bee colony, particle swarm optimization, cuckoo search, ant colony optimization, big bang big crunch, parallel big bang big crunch [28] etc. Deep learning methods are successfully applied in different fields. ID-NET an intrusion detection system using improved mask R-CNN was proposed by Gao et al. [29] for surveillance of the power grid. The proposed model was trained for small object detection and the model performed better than the other state-of-the-art object detection models. Bhattacharya et al. [30] proposed an approach to classify bacterial blight, rice blast and brown mark disease images (total of 1500 images) with 94% accuracy. In this paper, we have proposed deep learningbased approach whose hyper-parameters can be optimized by using nature-inspired optimization algorithms.

Image Classification Machine Learning Algorithms
For Image classification using Support Vector Machine (SVM), K-Nearest Neighbors (KNN), Decision Tree and Random Forest algorithms models are trained using both rice and potato datasets for comparative analysis. Image classification models were evaluated to predict the rice and potato plant leaf diseases. The proposed CNN model showed higher performance and most suited for plant disease classification when compared with other image classification techniques. SVM is a supervised machine learning capable of inferring the output label and performs well even with small datasets. SVM outputs a hyperplane maximizing the margins. SVM employs the kernel method for classifying non-linear data. The equation of the class separator line hyperplane is y = mx + c. Assuming that there are n data points and k indexes in the dataset defined by (x i , y i ) where i = 1,2,...,n x i ∈ R k and y i ∈ {−1, 1}. The hyperplane with weight w and bias b is given by (w, x) + b = 0. The distance D i from the input sample x i to be classified from the hyperplane is given by D i = |wxi+b| ||w|| SVM aims to maximize the classification distance D i and can be achieved by minimizing For hyperparameter tuning is done by passing the values of c, kernel and gamma to the grid search algorithm [32][33][34]. Hyperparameters with the best cross-validation score are selected. Using the K-Nearest neighbors algorithm uses Euclidean distance of input image to every other point and uses majority voting from K minimum distance points to classify the image [35][36][37]. The generalized equation for calculating the distance is given below d(p 1 , p 2 ) = (x 1 − x 2 ) 2 + (y 1 − y 2 ) 2 where p 1 = (x 1 , y 1 ) and p 2 = (x 2 , y 2 ) Random forest algorithm makes use of an ensemble learning technique with multiple decision trees to classify input images [38,39].

Data Acquisition
In this paper, rice and potato datasets are used. Datasets are split into 80:20 configurations where 80% of the images is used for training and 20% of the images is used for testing for both rice and potato datasets. The Rice dataset contains a total of 5932 images including 4 varieties of rice leaf diseases including Bacterial blight, Blast, Brown Spot and Tungro [40]. With 80:20 test train split for training 3785 images and for testing 947 images were used. The rice dataset sample images are shown in Fig. 1.
A potato leaf dataset containing a total of 1500 images is used in the study. 1200 images were used for training and validation and 300 images were used for testing. Dataset has images belonging to three different classes (early blight, late blight, healthy) of potato leaves. The sample of the potato leaves is shown in Fig. 2. Tab. 1 represents the number of training and testing images of the datasets.   During preprocessing stage, all the images are resized to 128 X 128 pixels. Resized images of the potato dataset are shown in Fig. 3.

Proposed Convolution Neural Network
A deep learning-based CNN model is proposed in this paper for reliable image classification. The proposed classifiers efficiently identify the diseased and healthy potato and rice plant leaves. A comparative study of traditional machine learning techniques along with CNN is presented in this paper. Computer vision problems dealing with images have high memory and computational requirements. For an image of height 128 pixels, width 128 pixels and 3 channels the input feature dimension is 49152. For images of a larger size, the input data becomes even substantial. Inputting this huge data to the neural network will require high computational power. CNN also known as ConvNet is a powerful deep learning technique that was designed from the biological driven models similar to how a human perceives an image into the brain using different layers. CNN captures the spatial and temporal dependencies in an image through the application of filters at different layers. Feature extraction using CNN reduces the image into a form that requires fewer computations and at the same time preserves the features needed for making the prediction [41]. CNN model makes use of layered architecture and is composed of a convolutional layer, the ReLU layer, the pooling layer, the drop out layers and fully connected layers. Convolution layers extract high-level features (detect hidden patterns) by application of a set of filters that extract useful information from an image. After the application of filters/kernels, the data is passed from the ReLU layer. ReLU sets all negative values of the convolved matrix to zero and retains positive values by using the max(a, 0) function. The processed data is inputted into another layer called the pooling layer. The pooling layer reduces the size of the inputs and speeds up processing. Different hyper-parameters at the pooling layer of the CNN model are filter size, stride, max, or average pooling. There can be n number of convolution and pooling layers in a CNN model. Fully connected layers are present at the end of a CNN model. Each node is connected to every node in the previous layer is fully connected layers. Fully connected layers are heavy data-driven layers of the CNN model. A fully connected layer performs the task of classification of the image into different classes in the output layer. The fully connected layers are also called dense layers of the CNN model to perform the task of image classification. The dropout layer is used to prevent the neural network from overfitting. Dropout is a powerful regularization [42] technique for neural networks. The softmax activation function is used at the output layer which produces a vector that represents the probability distribution of the possible output classes.

Implementation, Performance and Discussion
To apply and evaluate the proposed approach along with other well-known state-of-the-art machine learning image classifiers for plant disease prediction we have used the python 3.7.10. The experiment was performed on Linux-5.4.109+-x86_64-with-Ubuntu-18.04-bionic using Google Colab and was accelerated by GPU Tesla P100-PCIE-16GB.
These models are trained for rice and potato datasets differently and then the model performance parameters are analyzed and compared. The proposed CNN model performed better than other classifiers for both rice as well as potato datasets. Tab. 2 presents the hyper-parameters configurations of the CNN model architecture is shown in Figs. 4 and 5.  In Deep Neural network makes accurate predictions by extracting useful features of the input image. Activation maps or feature maps are obtained by applying filters to the input image by each layer of the CNN model. Analysis of each layer's output activation maps will develop an understanding of the features extracted for a given image. Both filters and activation maps can be visualized to get an insight into the internal representation of the model for a specific input at a given layer. For a given input potato image, each layer of the model extracts features/activation maps as shown in Fig. 6.
As seen in Fig. 6 the first layer retains the full shape of the leaf retaining almost all the information or features of the initial inputted picture. Activations become less visually (by the human eye) interpretable as we analyze deeper layers. Deeper layers extract the features such as single borders, corners and angels. As a result, the deeper layers can extract more relevant information that is useful for image classification. The proposed CNN model is trained and validated. Adam optimizer of Keras with learning rate 0.0001, loss function = 'sparse_categorical_crossentropy' and metrics = 'accuracy' is used.

Training Graphs (Accuracy & Loss) of the Proposed CNN Model
The training-progress graphs for the designed CNN models trained using rice and potato datasets are shown in Figs. 7 and 8 respectively. Each graph represents model accuracy and loss for the respective models. For the Training CNN model with potato dataset 1200 images are used and a test set comprising of 300 images with 100 images per class for testing. Visualization of the output layer of the model trained on the potato dataset is shown in Fig. 9.

Performance Evaluation of Image Classification Techniques
In this study performance of different image classification models for rice and potato leaf disease datasets is analyzed. We have studied and measured the performance of these models in terms of accuracy, precision, recall and F1 score as shown in Tabs. 3 and 4. The confusion matrix is a table that gives information about how the test dataset performs on the trained model. Fig. 10 shows the confusion matrix of different classifiers applied for predicting rice diseases. Various performance measures like accuracy, precision, recall, or sensitivity and specificity of the model [43] can be calculated using the confusion matrix.  The diagonal values of the confusion matrix represent True positives (TP). For obtaining false negatives we have to add the values in the corresponding row items ignoring the true positive values. The total number of testing samples belonging to a given class can be calculated by the sum of all items of rows corresponding to that class (TP + FN). Similarly, the number of false positives (FP) for a class is obtained by adding the values of the corresponding column ignoring true positives TP for that class. The total number of true negative TN for a certain class will be the sum of all columns and rows values ignoring that class's column and row. Accuracy is defined and the sum of correct classifications divided by the total number of classifications. Sum of all diagonal elements divided by the sum of all items in the confusion metrics. Accuracy gives the overall correctness of the predicted model. Using the confusion matrix shown in Fig. 10 performance measures can be calculated using the equations from (1)    Tree and Random Forest based on different performance parameters. Performance measures like accuracy, precision, F1 score, recall etc. were used for comparative study.
For future work, the hyper-parameters of the proposed CNN model like the number of the epoch, batch size, number of filters in each convolution layer, size of the filters, number of convolution layers, activation function for convolution layer, pooling after each convolution layer, number of fully connected layers, neurons per layer, etc. can be optimized using nature-inspired search and optimization algorithms. Optimized selection of these hyper-parameters can further increase the performance of the model.

Conflicts of Interest:
The authors declare that they have no conflicts of interest to report regarding the present study.