1 Introduction

The scientific study of plant disease is known as pathology or phytopathology which is caused by pathogens. The pathogen is an infectious organism that starts disease in plants. Fungi, bacteria, viruses, viroid, and parasitic plants, etc. are organisms that start disease in plants. Plants are also affected through the eating of plants by insects, vertebrates, mites, and other pests. Bacteria found in plants do not harm the plant itself but in many or approximately hundreds of species of bacteria can cause disease in plants. Most of the bacteria found in plants are saprotrophic and do not harm the plant. Spiroplasmas and Phytoplasmas are bacteria and they cause disease in plants.

From the beginning of agribusiness, plant infections cause considerable financial, social, and ecological losses. Prophylactic activities are not enough to prevent epidemics. For early detection and prevention of disease, monitoring is not considered enough. Traditional checking of plants by the sight of people is not a suitable way to prevent the disease from spreading because some peoples are suffering from a visual disorder or they are facing illusions. This approach is subject to psychological and cognitive phenomena that may lead to bias, optical illusions, and ultimately to error [4]. The Asian countries’ economy is mostly dependent on the agriculture business. Around 65% of Asian people do farming for their survival. Detection and classification of plant disease is a challenging task for them. An automated system to detect plant diseases timely can provide facilitation.

Deep Learning-based neural network models are considered as state-of-the-art models in multiple research fields like bioinformatics, drug design, and computer vision [14]. The major reason behind this performance is the use of raw data directly as a whole instead of getting hand-crafted features [20]. The researchers sum up the success of the deep learning network model for two big reasons, the first reason is the deep learning model makes use of high power computation-based graphical processing units(GPUs) which helps a lot in the smooth training process of learning classifiers. Secondly, make use of raw data as a whole and extracting significant features itself helps the deep learning model a lot in the training process. The model trains itself on all significant features and gives promising results.

This study uses a Convolutional Neural Network (CNN) as a powerful deep learning tool. CNN models complex process and perform pattern recognition in large sized data and mostly used in image based data. A CNN-based automated system to recognize leaves from its images was presented by [17]. In [19] performed a comparison of two methods and proposed a CNN model to identify 26 diseases of plants using leaves images of fourteen plants and achieved promising results. But the main limitation of their work was that the dataset used in their study included laboratory images of leaves, not from the fields in a real environment. In [28] also used similar leaves images to identify 13 diseases from five different plants. Afterward, [22] performed different experiments and compared the performance of CNN with traditional pattern recognition methods using 3 images based databases of entire plants. Experimental results revealed that CNN outperformed other traditional methods.

Automated identification of diseased leaves of plants can reduce the burden of farmers and ultimately will improve crop yield. This study makes use of a plant-village benchmark dataset, which consists of leaf images captured in the field. Furthermore in this research, the proposed optimized-CNN model is trained and analyzed, by applying image preprocessing technique, to generate an automated system for the detection and classification of plant leaves as healthy or diseased. To summarize, the proposed approach makes the following contributions.

  • An optimized CNN based model is proposed that can accurately classify the bacterial and healthy pepper bell plants from the leaf images.

  • Image preprocessing steps are applied that help in accurate edge detection and segmentation of the infected area and thus increase the accuracy of the proposed model. To prove the effectiveness of preprocessing, results of the proposed approach is compared with and without preprocessing steps.

  • An open PlantVillage dataset of plant leaves is utilized to evaluate the performance of the proposed model.

  • The proposed model is compared with the state-of-the-art approaches from the previous literature and proves its superiority.

The structure of this research work is organized as follows. Section 2 represents the previous work of the researchers and authors who contributed in the related domains. Section 3 presents data description and preprocessing steps that were used in this study for the experimental and implementation phase. Section 4 demonstrates the proposed methodology. Section 5 presents the experimental results and discussion used that evaluate this study in scientific manners. Section 6 is the conclusion of the proposed study.

2 Related work

Deep learning applications are widely used around the world in multiple domains such as visual data processing [32], health care [8], audio and speech processing [23] and social network analysis [29]. In the comparison of the previously employed machine learning algorithms that are able to improve performance with the several feature extraction techniques whereas the deep learning model can extract features automatically and perform training according to these features expressed in the hierarchical architectures [1]. The deep learning algorithms applied as a strong mechanism in the process of disease identification based on medical images in particular biomedical domain [6, 31]. The application of deep learning has further continued to be examined in the domain of agriculture and detect the diseased plants [12] to enhance the essence of crop management [18]. Losses in employment in the agrarian division can influence the economy of nations that rely essentially on that industry [26]. Several circumstances may generate those losses; certain factors that can influence largely such as biotic or abiotic [16, 21].

Disease diagnosis in plants starts with the image acquisition step in which images of healthy and diseased leaves are captured for analysis. Then preprocessing is applied to these captured images to get better images. Preprocessing steps involve image segmentation, filtering, color space conversion, resizing, and image augmentation. Segmentation has been widely used to get the area of interest and image boundaries. After that, classification is performed by applying different classification algorithms such as the k-mean clustering model [30].

A significant problem that is faced by most researchers is the determination of the region of interest (ROI) based on the segmentation is resolved by applying deep learning models. Amara et al. [2] have applied the CNN model to classify banana plant disease classification. Their model based on LeNet architecture and performed well in challenging conditions such as different resolutions, illuminations, sizes, and backgrounds. In [7] applied neural network for classification and identification of fungal diseases in plants. The authors applied region growing and optimization techniques to improve classification accuracy. They achieved 0.87 specificity and 0.85 sensitivity in segmentation and achieved 0.87 sensitivity in the identification of leaf disease. They also highlighted the multiple diseases on a single plant as a major challenge. Their work focused on fungal diseases only. In [9] built a dataset of plants grown in a controlled environmental setting. They identified viral diseases in cucumber leaves. They also highlighted the key areas of infected parts. Their proposed model achieved 93.6% average accuracy.

Deep learning models have a tendency to solve complex problems relating to the real-time detection of plant diseases. Authors in [3] proposed a CNN-based architecture named as GoogleNet to detect apple plant diseases on the village-based dataset and achieved 98% accuracy. Authors in [27] applied two CNN models, one was trained using full-plant leaf images and the other was trained on the segmented portion of the leaf. Experimental results proved that the later model showed higher accuracy and confidence results. According to the recent literature, the classification accuracy of models depends upon how the region of interest is identified. Boulent et al. [5] discussed many techniques relating to finding regions of interest such as segmentation and their influence on performance. Review of previous literature reveals that segmentation has been used as first step in identifying plant leaf diseases by many researchers. Some limitations of segmentation are that it did not perform well in other backgrounds and lead to low accuracy. Furthermore, some symptom are not so much clear and edges of the leaves get mix with the healthy tissues. While manual feature extraction such as shape and texture of the leaf has been used in many research tasks. Manual feature engineering depends upon the expert knowledge and became an expensive solution when dealing with a large amount of data. In order to deal with this problem, this study utilizes four preprocessing steps to get edges and better images of the infected areas. The proposed Optimized-CNN model learns features from the preprocessed images directly. The proposed model is then successfully classifies healthy and bacterial diseased leaves.

3 Data description and preprocessing steps

3.1 Data description

The plant leaf diseased based dataset is collected from the kaggle that is the one most popular sources of datasets for research purposes. The diseased plant leaf dataset consists of 2475 images related to pepper bell leaves that is divided into two different types that are used as true labels such as bacteria and healthy leaves. The almost 1478 number of images data from the dataset is related to the class healthy. The remaining data is related to second classes that is 979 images for the training of the deep learning models.

The Figs. 1 and 2 present some healthy and infected leaves from the dataset respectively. The Fig. 1 presents the leaves that illustrates how a completely healthy pepper bell leaves looks like. The Fig. 2 presents the different diseased pepper bell plant leaves.

Fig. 1
figure 1

Representation of the dataset consists of healthy leaves

Fig. 2
figure 2

Representation of the dataset consists of bacterial leaves

3.2 Preprocessing steps

The Optimized-CNN model consists of neural network based layers that contain a large number of neurons which requires the huge amount of data to train on. The technique used to increase the number of images is called Image Augmentation that is applied to the plant leaf dataset. The present dataset is in RGB colors that contain noisy values in the images. To extract the exact diseased regions and make it more clear for the model to classify it and train itself more efficiently, the color conversions in four steps are applied to the images as shown in Fig. 3. Preprocessing steps performed before feeding to the Optimized-CNN model are following:

  1. 1.

    All the leaf images of different sizes are shown in Fig. 3(a). In the first step, all leaf images have been changed to same dimensions that are: 120 × 120 before feeding to the model as shown in Fig. 3(b).

  2. 2.

    Secondly different filters are applied for edge detection. Detection of leaf images can be observed in Fig. 3(c).

  3. 3.

    After that, in third step RGB leaf images are converted into YUV to keep Y at full resolution that is luminance in the image. Converted images are presented in Fig. 3(d)

  4. 4.

    Finaly, to equalize intensity values YUV leaf images are converted back to RGB leaf images as presented in Fig. 3(e).

Fig. 3
figure 3

Four steps of pepper bell leaf image preprocessing

4 Proposed methodology

4.1 Overview

Leaf disease is one of the most disastrous causes in the world that produces a huge impact on the agriculture domain (Figs. 4 and 5). The proposed methodology of classification of the bacterial and healthy leaf is presented in Fig. 6. These diseases spread from one location to another slowly and it affects the other leaves and then covers the whole plant in a specific period of time. The farmer or agriculturist also needs years of experience and practice to identify the type of the disease that will help them to treat the plants with accurate medicinal treatment and save the plants. The proposed approach helps the farmers as well as the plants to recognize bacterial plants in their initial stages and farmers can give the proper treatment in meantime. The implementation of the proposed approach as an experimental prototype is carried out in this study. The classification of the plants from visual images based on deep learning models such as an Optimized-CNN model has been proposed. The plant leaf visual images dataset consists of 2475 thousand images and after image augmentation is applied on it through image generator the images turned into 20,000 images. Then the dataset is divided into training and testing data with the ratio of 70% and 30%. After extracting the features from the image, each neuron extracts the values through its own receptive field and performs training by calculating the weights and producing the output feature map.

Fig. 4
figure 4

Proposed CNN layered Architecture

Fig. 5
figure 5

Receptive fields covers the visual field and pass the extracted data to fully connected neurons through weighted links

Fig. 6
figure 6

Representation the methodology of classification of bacterial and healthy leafs

We used Optimized-CNN model to avoid manual feature extraction. Most of the previous researchers utilized segmentation as a first step in identifying plant leaf diseases. But they faced some limitations as segmentation performed well in the black background but it did not perform well in other backgrounds and lead to poor results. While some symptom does not show well-presented edges and get mix with the healthy leaf tissues. Some researchers rely on manual feature extraction such as histogram, shape, and texture of the leaf. That process totally depends upon the expert knowledge and expensive solution when dealing with a large amount of data. In order to deal with such problems, we applied preprocessing steps to get edges from the images. Then we applied Optimized-CNN model after fine-tuning. Hyperparameter tuning details are presented in Table 1. We utilized varied filter sizes to get the required region of interest. 5-layered Optimized-CNN model classified healthy and diseased paper bell leaves in an effective way and proves as an effective diagnostic tool for paper bell leaf bacterial disease identification.

4.2 Proposed optimized-convolutional neural network (CNN)

The Convolutional Neural Network (CNN) [13] has been applied by many researchers for the classification of the images. The CNN structure built on convolutional layers which can control the data in the form of 2-D or 3-D more effectively and efficiently. A CNN model is employed to investigate the images in the form of visual RGB colors-based data. CNN presents another version of multi-layer perceptron based on regularization. The multilayer of the perceptron depends on the number of neurons that are connected to each layer by layer by using the weighted links. The neurons of the layers are connected in the way that each neuron of the one layer is connected with the neurons of the next upcoming layer. One layer learns features by using the weighted links that extract the patterns and calculated weights that give to the neurons of the next layer. Neural networks is motivated by the structure of the biological neurons which are connected to each other through the number of links that contain further weights. The CNN deep learning model assumes common means to regularize the hyper-parameters. The dimensions of the magnitude of the function of loss are combined with the techniques of regularization that support the CNN model to extract the efficient pattern and features from the data and get trained with effective weights, hierarchically and also extracts the information from the patterns that extracts from the small-sized datasets and less complex in structure. This is the reason that the performance of the CNN model is improved. The CNN applications are used in the following domains of video and image classification, visual text extraction from the images based on natural language processing, image classification, image recognition, analysis of medical images, image segmentation, and financial analysis through time series. Convolutional Neural Network defines itself that the CNN model is dependent on the convolutional mathematical operations. CNN is the set of different layers but it is necessary to have at least one convolutional layer because CNN is based on convolutional multiplication method instead of matrix multiplication. The CNN consists of input, output and the numbers of hidden layers. The hidden layers containing the multiple convolutional layers that convolve at the input feature map and produce the output feature map for the next layer by performing the dot product or multiplication. After this the activation function named as a ReLU layer, masked the input and the output of the additional layer with the convolutional layer such as pooling layers in which max pooling, global average pooling and normalization layers are involved with the fully connected layers that depends on dense or softmax layers. These are referred to as hidden layers of the CNN model.

Table 1 Summary of the model and hyper-parameter values

The convolutional layer convolves the receptive field around the input image and extracts the feature map and then passes these results to the next layers as an input. Each neuron works as a receptor that holds the information of its receptive field. The neurons need a very high number of weights for the efficient learning and effective predictions. The convolutional layer is based on the hyper parameter such as padding, strides, and kernel size. The kernel is the size of the receptive field that convolves around the input field or image and perform multiplication operation and sum all the values and extract a single weighted value. After performing multiplication and summation operations, the kernel moves forward two steps known as strides. The padding is the number of zeros that are added around the feature map that helps to extract the features from the exact shape in which the input is.

The activation function first introduced by the Hahnloser et al. in 2000 [11] to the dynamical networks but it introduced for the better training of the deep learning networks in 2011 [10]. The Rectified linear Unit (ReLU) is a piece-wise linear function that transforms the summed up weighted input values from the nodes to the nodes of activation or output. It transforms the input values into positive numbers and if the value is less then zero or negative then it transforms this value into zero. Stochastic gradient descent is mostly used in deep learning models with the back propagation technique to train the model efficiently that the model can learn the complex relations in the data but an activation function is needed that can transform the complex input weighted values into the linear form. We applied ReLu as an activation function and it can be expressed as in (1) and (2).

$$ f(x) = x^{+} = \max(0 , x) $$
(1)
$$ f(x) = \max(0,x) = \left\{ \begin{array}{ll} x_{i}, if x_{i} \geq 0 \\ 0, if x_{i} < 0 \end{array}\right. $$
(2)

Where f(x) is the output activation of activation function and x shows the number of neurons.

5 Experimental results and discussion

The experiment of the proposed study is carried out by using tensor-flow and Keras libraries that provide the accessibility and open-source models to build the neural network models as well as pre-trained models. Anaconda tool is the platform and python programming language is used to implement the deep learning methods on the plant leaf images dataset because of the dataset the Dell Poweredge T430 graphical processing unit (GPU) is used. This computer consists of 32GB Random Access Memory (RAM), 8 core, and 16 logical processors. The deep learning approach Optimized-convolutional neural network with image augmentation method is proposed in this study to perform classification operation on plant leaf visual images to identify that the plants have bacteria or not. The proposed study needs to be evaluated through several scientific methods to measure the scope and worthiness. The evaluation measures are used such as Accuracy, Precision, Recall, and F1-score.

The plant leaf disease classification is proposed in this study by using the dataset of pepper bell leaves that consists of 2475 leaf images. The Optimized-CNN is used with the image augmentation technique. The image augmentation technique increases the number of images to 20000 which improves the efficiency of the CNN model and achieves the highest prediction accuracy. The experiments are carried out with the help of the DELL Power Edge T430 Graphical Processing Unit that consists of hardware specifications such as 32GB Random Access Memory (RAM), 8 cores, 16 logical processors, and 16 GB MSI Graphical Card. That took almost 1.7 hours to complete the training process of the Optimized CNN with 25 epochs. Hyper parameter tuning detail is presented in Table 1. The highest accuracy 99.99% has been achieved with 25 epochs. While the precision, recall, and F1-score are 99.99%, 99.99%, and 99.99% as shown in Table 2. The graphical representation of the results is shown in Fig. 7. The analysis of the performance of the proposed approach is carried out with different numbers of epochs such as 5, 10, 15, 20, and 25 epochs. As some of the leaf images contain small bacterial regions. It is difficult for the learning algorithms to accurately classify that image into a bacterial class. The Optimized-CNN model achieved promising results by using an extensive four preprocessing steps, different filter sizes, hyper-parameter optimization, and supporting max-pooling and dropout layers. In literature, many studies extracted features by using pre-trained CNN before classification [25] and others used customized CNN [24]. The Optimized-CNN approach outperformed in the classification of healthy and bacterial pepper bell leaf images. In our case, we identified optimal layers of CNN for feature extraction before classification for bacterial leaf detection. It accurately identifies bacterial portion in leaf images in terms of accuracy, precision, recall, and F1-score. We reduced noise in preprocessing to improve the image quality. Results proved that these activities improved the overall result. The accuracy is the correct prediction rate over the total number of predictions. The epochs are the number of iterations that were used by CNN models to train for efficient prediction. The 5 epochs show the very lowest prediction results with an accuracy of 70.98% but when due to an increase in the number of epochs the training efficiency is also increased. The highest accuracy achieved with 25 epochs that are 99.99%.

Table 2 Results for the performance of the proposed approach
Fig. 7
figure 7

Experimental analysis presented comparatively by using different number of epochs and evaluation parameters such as accuracy, precision, recall and F1-score

Fig. 8
figure 8

Experimental analyses presented in the terms of accuracy

Fig. 9
figure 9

Experimental analyses presented in the terms of model loss

Fig. 10
figure 10

Experimental analyses presented in the terms of model precision

Fig. 11
figure 11

Experimental analyses presented in the terms of model Recall

Figures 8 and 9 presents the CNN model training and testing validation results that present the model efficiency in terms of accuracy and loss. Figures 8 and 9 presents two different graphs such as model accuracy and model loss in terms of train and test. There is necessary for the effective and correct prediction results that the train and test results of the model training should be gradually increased together in terms of accuracy and gradually decreasing according to loss. The accuracy has to be in increasing order and loss has to be in decreasing order. That shows the model training is effective in predictions.

Figure 8 presents the training efficiency of the Optimized-CNN model with the training and testing. The improved efficiency shows the increasing results in both testing and training of the model with each epoch such as 5, 10, 15, 20, and 25. It is necessary to improve the efficiency of the model, which means the training and testing lines in Fig. 8 have to be in increasing order. If it goes in decreasing order it means the accuracy and efficiency of the model goes decreases and shows poor results.

Figure 9 presents the loss rate of the Optimized-CNN model performance that how much it gives the loss in the training process. The loss of the model presents the efficiency hazards to the prediction accuracy and performance of the model. Figure 9 presents the training and testing loss goes down in decreasing that shows the lowest loss approximately to zero. While the precision and recall training curve is shown in Figs. 10 and 11. All the training and validation graphs show that the proposed Optimized-CNN model is stable and novel in terms of image classification-based tasks.

Table 3 Performance of proposed CNN with and without preprocessing
Table 4 Performance evaluation with other models using leaf images for identification of plant leaf diseases in literature

Experimental results of our Optimized-CNN model are compared with and without performing preprocessing steps and comparison is presented in Table 3. There is a big difference in terms of all evaluation measures that are Accuracy, Precision, Recall and F1-score. Hence, results proved that four preprocessing steps remarkably improved performance of the Optimized-CNN model. The accuracy of the proposed Optimized-CNN model is compared with the state-of-the-art deep learning models from the literature [15] used for bell pepper leaf disease classification. The results presented in Table 4 prove that DenseNet has shown the highest performance with 98.7% which is still lower than the proposed model. DenseNet has shown comparable performance but is very complex and consists of 121 layers. Table 4 shows that the proposed Optimized-CNN model proves its superiority with 99.99% accuracy.

6 Conclusion and future work

The recognition of the plant leaf disease is the major issue for the initial detection by the farmer or the automated systems because the leaf color change and different infections look similar to the rottenness with very little difference in shape and size. The farmers and researchers also need years of expertise to classify the exact leaf disease during the examination of plants. The exact detection is the biggest issue in the field of agriculture because of inexperienced management. There are also different types of leaf diseases present that make it more difficult for the correct classification because each type contains different patterns and has to be treated in different manners with different medicinal sprays and treatments. That’s why to save the plants, the exact recognition of the disease in the initial stage is a necessary priority. The proposed Optimized-CNN disease detection system is based on the pepper bell plant leaves visual images and image augmentation techniques. The dataset consists of two classes such as bacterial and healthy.

The prediction and performance results are evaluated with the help of several evaluation parameters such as accuracy, precision, recall, and F1-score. The experiments are carried out with different numbers of epochs such as 05, 10, 15, 20, and 25. The highest accuracy is achieved with 25 epochs such as 99.99% accuracy, 99.99% precision, 99.99% recall, and 99.99% F1-Score. Furthermore, experimental results of the proposed Optimized-CNN model are compared with the state-of-the-art models from the literature and it proves its superiority in performance for leaf disease detection.