Abstract

In agriculture farming, pests and other plant diseases are the most imperative factor that causes significant hindrance to cucumber production and its quality. Farmers around the globe are currently facing difficulty in recognizing various cucumber leaf diseases, which is imperative to preventing leaf diseases effectively. Manual techniques to diagnose cucumber diseases are often time-consuming, subjective, and laborious. To address this issue, this paper proposes a tuned convolutional neural network (CNN) algorithm to recognise five cucumber diseases and healthy leaves that comprises image enhancement, feature extraction, and classification. Data augmentation methods were utilized as a preprocessing step to enlarge the datasets, and it was also to decrease the chance of overfitting. Automatically features are extracted by using CNN layers. Finally, five cucumber leaf diseases and one healthy leaf are classified. Furthermore, to overcome the lack of a public dataset, a new dataset of cucumber leaf diseases has been constructed that includes spider, leaf miner, downy mildew, powdery mildew, one viral disease, and healthy class leaves. The dataset has a total of 4868 cucumber leaf images. In order to prove the authenticity of the proposed CNN, comparative experiments were conducted using pretrained models (AlexNet, Inception-V3, and ResNet-50). The proposed CNN achieves a recognition accuracy of 98.19% with the augmented dataset and 100% with the publicly plant disease dataset. The experimental results confirm that the proposed CNN algorithm was efficient for recognizing the cucumber leaf diseases compared with other algorithms.

1. Introduction

The agricultural sector is considered one of the strongest pillars and has a crucial role in the economic development of many countries; developed and developing countries’ economies are particularly dependent on the profitability of agricultural production. This sector will provide employment opportunities to many employers in rural areas and provide breathable oxygen, contribute to producing food, and be used in medicine and industry.

Due to several factors in the agriculture field, farmers cannot simply control the weather and other environmental conditions that are affecting agricultural crops. Plant diseases are one of the principal serious and longstanding problem factors that have to be considered in the case of farming practices. It has a devastating effect on interrupting normal plant growth, production quality, quantity, and economic loss.

Nowadays, one of the widely used plant spices is cucumber. The cucumber is a broadly cultivated plant in the gourd family, Cucurbitaceae, and the most globally nutritious and favourite vegetable in the world, which is quick and easy to grow in a short period of time and easily grows in temperate regions. Cucumbers are seriously affected by diseases due to nonbiological factors, the impact of various factors, and a bad ecological environment. This has a major economic impact on farmers, yield production, and quality. It has a property to be suffered from high disease occurrence, frequent and fast infection. The leaf, fruit, stem, and root are parts of the cucumber plant that are affected by different kinds of diseases. Leaves are considered the best part to be used for disease diagnosis because of the appropriate macroenvironment [1], the symptoms of diseases are visually apparent on them [2], and the disease affection could be apparent on leaves due to size, shape, and color [3].

Plant pathogens (bacteria, fungi, and virus diseases), deficiency, plant nutrition (lack of microelements), pests, and insect feeding (sucking insect pests) are causing leaf batches [4]. Cucumber diseases are diagnosed through visual analysis by experts (naked eye observation) and biological inspection. This technique is time-consuming, inefficient, expensive [5], and not the best way to recognise diseases [6]. Chemical methods are also used to diagnose leaf injuries, which are not real-time diagnoses because of necessitating a lot of experiments [7]. Those lead to affect agricultural production in terms of increasing the danger of toxic residue levels and cost because of excessive use of pesticides for the treatment of plant disease in case of incorrect disease identification. In the meantime, early discovery of diseases, immediate attention, early diagnosis and detection, and avoiding infection are the most major efforts that have to be carried out by farmers to reduce damages and increase their income.

In order to address the issues, this requires an efficient and accurate plant disease recognition model. Researchers have been carrying out an effort that may have the benefit of monitoring large crop fields and detecting disease symptoms using different computer-based algorithms for the purpose of designing an accurate recognition system that would be available for the majority of farmers. In this context, an accurate and timely computer-based diagnosis algorithm for cucumber diseases is essential that would be capable of disease recognition in a better, more reliable, and faster way.

With the development of technology and artificial intelligence in agriculture, computer vision and machine learning have become significant tools in terms of diagnosis, detection, and recognition of cucumber diseases. Additionally, intelligent systems based on computer vision have been increasing and are used in agriculture for the purpose of achieving efficiency and increasing productivity [8]. Hence, in the agriculture field, computer vision technology with hardware development such as graphics processing units (GPUs) are applied on the crop growth state monitoring, agricultural products quality examination and categorization, plant disease and insect pest identification [5, 8].

In recent years, as state-of-art machine learning, deep learning-based algorithms have been widely used in many different fields in terms of recognition and classification. Deep learning as a new area of machine learning has become well known in plant disease recognition. It is possible to offer promising results and be efficient for learning and processing from the composite input data, which includes feature extraction and classification at the same time. The convolutional neural network (CNN) is one of the best-performing techniques of deep learning algorithms for image recognition in the machine learning field. This technique automatically acquires requisite features from the input image during the learning process which is the most important advantage of deep learning compared with traditional machine learning algorithms [9]. Despite reducing the complicated handcraft engineering processes, CNN is used to obtain a good performance of classification accuracy [10]. CNN has a good performance in terms of cucumber disease diagnosis, general image categorization, and leaf classification [11], as well as in flower recognition [12]. In [9], we realized that deep CNN in plant disease recognition is remarkably higher than the traditional algorithms. Additionally, in [13], the authors found that deep learning performed better than other machine learning methods to classify normal and diseased cells. In [14], long short-term memory (LSTM) is also used as a classification method to gear fault diagnosis.

However, none of the existing literature has considered ResNet-50, Inception-V3, and two combined CNN architectures for cucumber leaf disease recognition. In other words, none of the studies have worked on spider cucumber disease types that are related to pest types. On the other hand, CNN has a drawback in terms of using a huge amount of data, whereas available datasets do not have sufficient image data needed to do the proper recognition [15]. In the area of cucumber disease recognition, there is a lack of adequate standard public datasets for research purposes, and this considerably affects the efficiency of the classification process. To address those issues, two different cucumber disease datasets have been used to compute the experimental results: the locally constructed dataset and the cucumber plant diseases achieved online which is publicly available. In such circumstances, cucumber disease diagnosis in terms of accuracy, low cost, and speed are in great demand, and still, it is challenging for the agricultural industry and farmers.

In this paper, state-of-the-art based deep learning algorithms have been applied for cucumber disease and pest recognition using leaf disease symptoms. An appropriate cucumber disease diagnosis system has been proposed based on a constructed leaf image dataset that includes five unhealthy leaf classes, i.e., two pest diseases (spider and leaf miner), two diseases (downy mildew and powdery mildew), one viral disease cucumber yellow stunting disorder virus (CYSDV), and healthy leaf class. Additionally, it includes an extended publicly available dataset. More concretely, in this study, CNN and two combined CNNs from scratch with two pretrained models such as ResNet-50 and Inception-V3 have been used. The system is developed using CNN to diagnose diseases accurately without a segmentation process because the leaf has been situated in the center of images and it has been focused on disease leaf symptoms. The system will help farmers detect diseases in their early stages and to reduce the burden on experts and farmers. Timely and early disease detection helps to provide the remedies that would be useful to control the spreading of cucumber diseases.

The contributions of this study can be summarized as follows:(i)We construct a new structured cucumber leaf disease image dataset, which was not addressed in the previous studies. Images have been collected from farms in the Kurdistan region. It will be available as a standard public dataset for the research community.(ii)We propose a state-of-the art deep learning model such as CNN from scratch to improve accuracy results, which provides fast results, making it adequate for realtime application.(iii)We applied pretrained deep learning models and compared with the proposed CNN algorithm.

This paper begins with an introduction; the rest of the paper is organized as follows: in Section 2, various related research techniques with their working procedure have been discussed. Section 3 addressed the material and methodology; also experiment setup is described. In Section 4, the performance evaluation and result experiments are discussed. Finally, the research work is concluded in Section 5.

In recent years, various techniques have been applied and developed by researchers in the field of agriculture for the purpose of plant disease recognition and detection based on image processing and pattern recognition methods. Cucumber leaf disease symptom identification and diagnosis have made great progress, based on machine learning algorithms and computer vision. In the agricultural field, inspection systems based on computer vision have played a significant role as a tool, and their uses have greatly increased. Tian et al. concluded that combining computer vision with artificial intelligence approaches would improve an agricultural automation system in terms of general performance, economic performance, robust performance, and coordination performance [8].

Many image-processing concepts have been applied to plant disease recognition by researchers. Segmentation and feature extraction in traditional machine learning have a vital role in having an accurate classification system. The image segmentation technique has an important role in analysing images and identifying disease regions that are used to segment images with significant information. In an attempt, the authors in [2] used K-means clustering for the segmentation process. In particular, this is the method used to segment the image into three clusters [16]. Sannakki et al. used K-means to segment images into six groups [6]. Further, Otsu’s method and K-means clustering are used in [17] to segment diseased leaves to detect normal and faulty leaf regions. In addition, the leaf region was segmented using Otsu’s technique; then, the disease spot regions were segmented using Sobel operator to examine disease spot edges [5]. Moreover, segmenting cucumber leaf spots are applied using the fuzzy clustering algorithm (FCM) [18]. The watershed algorithm was used to segment spots of cucumber diseased leaves [19]. Moreover, several methods are used such as the Sharif saliency-based (SHSB) method based on color features, harmonic mean (HM), mean deviation (MD), chi-square distance, and fusion of active contour segmentation [20].

Following the trend of existing solutions, deep learning algorithms have been used in the segmentation process. The CNN model based on the U-net architecture has been proposed for semantic segmentation of powdery mildew disease on cucumber leaves, and their model outperformed as compared with K-means, random forest, and GBDT segmentation techniques on 20 test image samples according to three metrics. The results showed an accuracy of 72.11%, 83.45%, and 96.08% on intersection over union (IU), dice, and pixel, respectively [21].

In field of image processing, feature plays a vital role for the classification process that includes important information of the infected diseased region. Feature extraction is the essential step for getting significant information. Color, shape, geometric features, and texture are features that are extracted from images to determine diseased crops. It has an advantage of reducing the number of features in an image. Texture and color are most important features that are considered in the agricultural domain, due to the range of differences in image samples [20]. In [16], the histogram of gradient (HOG) is used to extract features from segmented leaf images. Gray level co-occurrence matrix (GLCM) is used in [6] to extract texture features from diseased portions. In addition, GLCM is used to extract texture features such as entropy, correlation, homogeneity, energy, mean, contrast, skewness, standard deviation, and kurtosis [22]. Three features, HOG, features from the accelerated segmented test (FAST), and binary robust invariant scalable key points (BRISK) features, are extracted and fused, and then the Manhattan distance controlled entropy (MDCE) technique is used to select strong features Kianat [23]. Both global and local singular value decomposition features are extracted from spot leaf images [19]. Despite that, in [2], color and shape features are extracted. According to review papers, features are manually inverted in selecting features to be processed in traditional machine learning algorithms.

In recent years, deep learning methods have been used to extract features using convolutional and pooling layers, whereas the process of extracting features and classification have been conducted automatically. CNN architecture is used to extract features automatically from the plant leaf that has been applied on the Flavia leaf dataset, which contains 32 different classes. The results utilized that CNN performed better and was efficient and accurate in extracting features compared with traditional machine learning methods. In the classification task, CNN also achieved higher accuracy results compared with ANN, which are 98.3% and 95.7%, respectively [24]. Additionally, pretrained models of VGG-19 and VGG-M were used to extract deep features, and then we fused them to get a robust feature selection based on local standard deviation, local interquartile range, and the local entropy method [20].

In the agriculture domain, a robust and accurate classification process is essential. Machine learning-based methods have been used for leaf disease recognition in some studies. For instance, in [16], cucumber leaf disease classification and severity measures had focused to help farmers in terms of early disease detection and discovered stages of affected leaf diseases. SVM is used as a classifier. In [19], SVM was used to improve recognition accuracy system to identify three cucumber disease types such as anthracnose, blight, and downy mildew, where each class includes 100 images. SVM was also used in [25] to cucumber leaf disease recognition, and it trained using various kinds of kernel function such as sigmoid, polynomial, and radial basis function (RBF) on both leaf spot disease and leaf as a sample. The experimental results utilized that SVM based on RBF achieved higher accuracy than others on 336 leaf spots samples. Three disease types are downy mildew, brown spot, and angular leaf spot. In addition, an automated cucumber leaf disease identification system was proposed in [23] based on feature fusion and select best features. In their study, six cucumber leaf diseases which are blight, powdery mildew, conrnespora, angular leaf spot, anthracnose, and downy mildew were used. Quadratic SVM (QSVM) achieved the highest accuracy result with 93.5% compared to decision tree (DT), logistics regression (LR), multiclass SVM (M-SVM), cubic SVM (C-SVM), Fine KNN, ensemble subspace discriminant analysis (ESDA), and neural network (NN) algorithms. The experimental results are utilized that M-SVM obtained a higher result compared with other methods which is 98.08% on five cucumber leaf diseases [20]. Additionally, directly feeding input and not scaling with data are the drawbacks of traditional machine learning algorithms, and these lead to decrease the accuracy results.

Other methods such as the back propagation neural network (BPNN) are used to classify grape leaf diseases; the accuracy result achieved is 100% on two classes that are downy mildew 33 images and powdery mildew 29 images [6]. Also, the cucumber crop disease had been classified using ANN in [22], it also gives preventive measures and remedies as a treatment, and the result accuracy obtained is 80.45% on three classes such as healthy, downy mildew, and powdery mildew diseases. Decision tree (DT), logistics regression (LR), multiclass SVM (M-SVM), cubic SVM (C-SVM), fine KNN, ensemble subspace discriminant analysis (ESDA), and neural network (NN) algorithms were used for detecting and identifying cucumber leaf diseases. The experimental results are utilized so that M-SVM obtained a higher result compared with other methods which is 98.08% on five cucumber leaf diseases [20]. In [2], the sparse representation (SR) method was used for cucumber leaf disease recognition, and seven different kinds of diseases are used in their experiments. The recognition accuracy result obtained was 85.7% on 420 leaf images, which is higher than K-means-based segmentation followed by neural-network-based classification (KMSNN), SVM, plant leaf image (PLI), and texture feature (TF) classifiers. Despite disease diagnosis, cucumber chilling injury had been detected using the hyperspectral imaging system with feature selection methods such as mutual information feature selection (MIFS), max-relevance min-redundancy (MRMR), and sequential forward selection (SFS). SVM, naïve Bayes (NB), and KNN as a classifier were used for identifying three classes (normal, lightly chilling, and severely chilling) and two classes (normal and chilling). The best accuracy result was obtained using SFS with SVM, which are 100% and 90.5% for two and three classes, respectively [26].

Nowadays, deep learning-based CNN has been increasingly used to classify and detect cucumber diseases through their leaves with a promising result. For example, in [27], the authors proposed a CNN model for identifying eight types of cucumber disease. They used data augmentation and modification of ReLU activation function to elevate the accuracy result to 93.75%, with in [11], CNN was used to diagnose two viral diseases such as melon yellow spot virus (MYSV) and zucchini yellow mosaic virus (ZYMV) and one healthy cucumber leaf, and the obtained accuracy result was 94.9% on 800 training leaf images. The lesion of leaf disease images is acquired using one two-stage segmentation, by extracting the leaf disease spots such as color, texture, and border features. Data augmentation using activation reconstruction generative adversarial networks (AR-GANs) was applied to lesion leaf images. Dilated and inception convolutional neural network (DICNN) was used for classification. In their study, the obtained accuracy on raw diseased leaf and lesion images was 90.67% and 96.11%, respectively. In agriculture farms, IoTs are a technique used for disease identification in a timely manner [9]. Symptom-wise of cucumber disease recognition system proposed in [28] to identify anthracnose, downy mildew, powdery mildew, and target leaf spot diseases. In their study, the disease symptom segmentation technique was used to segment symptom images by combining a comprehensive color feature with region growing. Augmentation methods such as flip horizontally, vertically, and rotate were used for data augmentation. The best accuracy result as 93.4% was obtained using DCNN compared with random forest and SVM classifiers on the unbalanced augmented data. A practical cucumber disease diagnosis system proposed in [10], a new dataset, has been constructed that includes seven viral diseases, healthy and downy mildew. They build the CNN model from scratch and pretrained VGG-net with fine-tuned, and then both methods have been applied on 9000 images. The experimental results showed that VGG-net attained higher result accuracy than CNN, which are 93.6% and 86.6%, respectively. In their study also, Grad-CAM was applied to capture important regions of diagnosis downy mildew. Fujita et al. proposed a diagnostic cucumber leaf disease system, and CNN was used to classify seven viral diseases and healthy images. The obtained accuracy is 82.3% on 7520 cucumber leaf images, which is collected on good and bad conditions [29].

In addition, all mentioned studies had worked on a single disease that infected the cucumber leaf. But in terms of classifying multiple diseases on the cucumber leaf, Tani et al. developed a CNN architecture based on a tunable threshold with sigmoid activation function on each output layer node instead of SoftMax function. An original on-site cucumber leaf dataset was constructed including leaves infected with any of 11 kinds of diseases and leaves infected with multiple diseases. A CNN-based classifier achieved an accuracy performance result, with 95.5% on average, on both single and multiple infections [30]. Applications of automated cucumber diagnosis based on deep learning have been studied. For instance, a practical end-to-end plant disease diagnosis system for wide-angle images proposed. The system composes an efficient leaf detection with a robust diagnosis system using transfer learning VGG-16. The achieved accuracy result was 73.9% from leaf detection and 68.1% from detection and diagnosis on 13,601 images [31].

The literature review, as shown in Table 1, utilized that several algorithms had been carried out for plant leaf disease diagnosis. Some researchers worked on segmentation, extracting features, and classification using traditional machine learning. Others studied deep learning algorithms for the same purpose. In addition, the reviews have suggested that the existing systems have not provided pretrained models such as AlexNet, ResNet-50, and Inception-v3. Furthermore, they did not use two combined CNN models in parallel. Besides, they did not consider an important type of pest named spider that affects the whole cucumber surface leaf. For this purpose, the proposed study constructed a new cucumber leaf disease dataset, images were collected in the Kurdistan region of Iraq, and the dataset included five types of diseases such as spider, leaf miner, powdery mildew, downy mildew, cucumber yellow stunting disorder virus (CYSDV), and the healthy one. In addition, a tuned CNN algorithm was proposed to identify cucumber leaf healthy and unhealthy to get a better recognition result. It also has two combined CNN algorithms proposed.

3. Materials and Methods

3.1. Plant Disease Image Datasets

The datasets used in this paper include the descriptions of the leaves before and after the diseases affecting them. The data comprises tables and images of the leaves that are taken in the fields. The data are analysed and classified in a way that is easy for the readers to understand. There are a few publicly available datasets that are used by researchers in terms of the plant disease diagnosis system. In the cucumber disease recognition area, there is a lack of large public datasets that causes a major drop in the performance of classification. Most of the recent experimental studies are experimented on the PlantVillage dataset, which include 38 classes of healthy and diseases of 14 different crop spices that contain 54323 images in total. An accurate disease diagnosis system is in need for good training that depends on data collection. To address those issues, in this study, two different cucumber disease datasets are used for experimental setup.

Dataset 1. A new structured dataset was constructed that includes healthy and infected cucumber leaves with single infection. The data are collected from natural scenes in the Kurdistan region. It contains five cucumber disease classes that comprise two pest diseases (spider and leaf miner), two diseases (downy mildew and powdery mildew), one viral disease cucumber yellow stunting disorder virus (CYSDV), and healthy leaves. Total images of the dataset are 4869 images, each class having a sample image number in the range of 350–1500. Sample images of Dataset 1 are shown in Figure 1. In addition, spider as one type of pest cucumber was added to Dataset 1 that was not mentioned previously. All images are taken in field conditions at the green house of cucumber farms; six different farms are used to collect and create the dataset. Disease type names are labelled according to pathologies’ advice, agriculture experts, farmers’ experience, and Internet guidelines. The name and the number of images in each class are shown in Table 2.
Images have been taken from different weather conditions inside the green house (morning, middays, and evening), angles (top and level angles), various aspect ratios, orientation, and size (3024 × 4032, 1968 × 4160, 1801 × 1762, 1280 × 1280, 960 × 1280, and 606 × 1280) pixel spatial resolution during various daytime intensities. Images are different in orientations and sizes, with some images that have a misshapen and shadows due to an order of magnitude, illumination, and distance changes. All sample images have been captured using the smartphone device (iPhone XS-Max, full HD, 12MP), optical and digital zoom are not used, and flash is always off. All samples are collected and captured between 7:00 AM and 6:00 PM during 4 months on (August 22 and November 30, 2021). In some healthy images, a white background has been designed manually to highlight a leaf disease object only using a white paper that is fixed to the cucumber leaf background, and the leaf is considered to be fixed in the image center. All other healthy and diseases’ images have a complex and an inconsistent background. They contains more than one leaf, stem, cucumber fruits, etc. Finally, images are resized to 224 × 224 × 3 for the purpose of reducing computational time, cost, and improving efficiency processing.

Dataset 2. It is a public dataset entitled as cucumber plant disease dataset downloaded from Kaggle website [32]. It contains two different cucumber classes healthy and diseased. Total images of the dataset are 695 images, each class having a small number of samples, which are 343 and 352 images.

3.2. Dataset Enhancement Method

In order to illustrate the effect of number sample images of each class on the performance of model results, Dataset 1 has augmented according to the maximum image number of class samples. For these experiments, the training sample number of powdery mildew has been chosen because it contains the maximum sample number of 1493 images. All other training classes are increased in range (1320–1418) images. Likewise, the number of test class images increased in range (265–285) images. All training and testing classes have nearly the same number of images. For this purpose, five different augmentation methods have been applied on each training image such as rotate the image by 40-degree, shear by 0.2 degree, zoom by 0.2 degree, flip horizontally, and brightness of the image light between 0.5 and 1.5. The new augmented dataset includes 9927 images, and among them, 6574 images were used for training, 1643 images for validation, and 1660 images for testing, as shown in Table 2.

In addition, to address the issue of small sample number of Dataset 2 images, the data augmentation process had been performed on training to enlarge data samples and improve accuracy performance. Five different augmentation techniques have been applied on each training image such as rotate the image by 40-degree, shear by 0.2 degree, zoom by 0.2 degree, flip horizontally, and brightness of the image light between 0.5 and 1.5. The training images are increased by 6 times as shown in Table 3. Finally, images are resized to 224 × 224 × 3.

The datasets are divided into three parts: training, validation, and testing. The total images in both datasets are split into 60% for training, 20% for validation, and 20% for testing sets.

3.3. Challenges and Problems with the Dataset

The classification process was evaluated over the datasets that are publicly available. Several challenges and issues came up during the process of seeking the dataset that may have affected the process of detection and recognition. How data are organized and collected is one of the challenges. For instance, the PlantVillage dataset was collected from different fields, and it may contain some class diversity. So, it leads to how data could be shown and also misclassification. Converting data into graphical representation is another problem because some sensitive information has been shown in graphical form, and it also would be clear to understand. Another issue is that the dataset has not shown the entire data, and some classes were missed.

The other issue of the dataset is that it may not include information about the factors that affect the process of diagnosis and detection. It also would be complicated for people who have no idea of data statistical analysis. Finally, some existing datasets may not be allowed to perform on mobile devices because of image higher resolutions.

3.4. Proposed Method Architecture

This paper comprises two main parts: the first part is named dataset construction, and the second part is named classification. In the classification part, transfer learning models and CNN models from scratch have been implemented. In this paper, two CNN models 1-CNN and 2-CNN were proposed from scratch to diagnosis the cucumber diseased leaves. Both CNN models included an input layer, convolutional layers, batch normalizations layer, pooling layers, dropout layers, fully connected layers, and an output layer.

The proposed 1-CNN model has taken an input image with 224 × 224 × 3 pixel size. It consists of five convolutional layers with a different number of filters and window sizes. In each layer, the filter sizes are 7, 5, 5, 5, and 3, and also, the number of filters is 20, 32, 40, 64, and 96 with padding 2, 2, 2, 1, and 1, respectively. The complete feature maps are obtained by using several different kernels. Mathematically, the feature value at location (i, j) in the kth feature map of the lth layer, , is calculated as follows:where and are the weight vector and bias term of the kth filter of the lth layer, respectively, and is the input patch centered at location (i, j) of the lth layer. The dimension output of feature maps of each convolutional layer was calculated using the formula explained in equation (2).where Dout is the number of output feature map dimensions, K is the number of filters, Din is the dimension number of input image, Df is the dimension of convolutional filter size, P is the amount of convolutional padding used on the border, and S is the convolutional stride number. In the next step, batch normalization is used. An activation function ReLU is used for all layers which is calculated based on the following equation:where is the input of the activation function at location (i, j) on the kth channel. A rectified linear unit has output 0 if the input is less than 0, as explained in the following equation:

The pooling layer has followed in layers in different sizes 2, 3, 3, 3, and 2 with stride 2 to extract features automatically and reduce the number of parameters and computation in the network. The output dimension size of pooling calculated based on the formula defined in the following equation:where Pout is the pooling output dimension, K is the number of filters, Din is the dimension of input image, Pf is the dimension of pooling filter size, and S is the pooling stride number. The max pooling layer was used. The last three layers have used dropout to overcome the overfitting issue. During the training process, a few neurons are dropped out from the network to reduce the model size. In the fifth layer, after performing convolutional and pooling, the output has been fed into two fully connected layers for the classification task, which have 512 and 256 neurons with SoftMax function as the output layer that is used to calculate the estimated probability of the five kinds of cucumber diseases and healthy. The proposed 1-CNN architecture is shown in Figure 2.

Various sets of hyperparameters were used to execute the proposed 1-CNN model in terms of achieving the best accuracy result. Table 4 showed the hyperparameters that have been used for model implementation.

The 2-CNN model has been designed in this paper based on two CNN models consisting of five convolutional layers with different numbers of filters and window sizes. The filter sizes are 7, 5, 5, 5, and 3 set to both models; also, the number of filters is (32, 20), (40, 32), (45, 40), (75, 64), and 96 with padding 2, 2, 2, 1, and 1, respectively. Batch normalization and ReLu activation function were used for all layers. The (3 × 3) size of the max pooling layer has been used with stride 2 to extract features automatically in both models. A dropout layer has been used in the last three layers to address or reduce the overfitting issue. It is used to dropout a few neurons from the network during the process of training to become reducing size of the models. The output of convolutional and pooling layers is fed into two fully connected layers for performing the task of classification. The probability of five kinds of cucumber diseases and healthy leaves are estimated using 512 and 256 nodes with SoftMax function as the output layer being used. Figure 3 showed the proposed 2-CNN architecture.

3.5. Evaluation of the CNN with Transfer Learning Models

This section details out the material and classification method used in this research. In this study, AlexNet, Inception-V3, and ResNet-50 have been used as transfer learning models for conventional recognition evaluation on two different datasets Datasets 1 and 2. In addition, they compared them with the proposed 1-CNN and 2-CNN models due to diagnostic performance. The performance of cucumber diseases and healthy recognition are compared between three pretrained and two proposed CNN models based on confusion matrix. In the process of the model criteria evaluation based on confusion matrix, precision, recall, F1-score, and accuracy were used. Accuracy is one metric used to evaluate the model classification rate; it is the rate at which our model correctly predicts. The following formula is the definition of accuracy:where TP = true positives, TN = true negatives, FP = false positives, and FN = false negatives.

While precision quantifies the number of positive class predictions that actually belong to the positive class, recall quantifies the number of positive class predictions made out of all positive classes in the dataset. They are defined in the following equations (7) and (8). F1-score also is a measure of model’s accuracy on a dataset. It combines the precision and recall metrics into one metric. The formula of F1-score is shown by the following equation:

In this paper, all images are resized into 227 × 227 × 3 as a preprocessing step, and image segmentation algorithms have not been used. Features are automatically extracted through convolutional and feature maps and then classified using the multi-layer perceptron (MLP). The best recognition results were achieved using 1-CNN, which are of 97.53% and 100% on Datasets 1 and 2, respectively. Its higher result was compared with AlexNet, 2-CNN, Inception-V3, and ResNet-50 using the Adam optimizer.

MATLAB has been used to implement the models. All experiments are tested and carried out using a computer that has a CPU Intel core i7 with speed 3.20 GHz, GPU NIVIDIA GeForce GTX 1160 (6 GB), and 32 GB RAM. Adam and Stochastic Gradient Descent with Momentum (SGDM) were used to optimize the network weights. The learning rate is initialized as 0.001. The dropout layers were used in the two last convolutional layers and fully connected layers. It also has a batch size of 32 which was used. The maximum epoch number reached 200 on proposed systems and 50 epochs on transfer learning models.

4. Results and Discussion

This section provides a comprehensive analysis and interpretation of the results that are empirically obtained from performing different experiments on proposed algorithms and pretrained algorithms.

4.1. Cucumber Disease Recognition

Numerous experimental tests have been conducted to diagnose cucumber diseases and healthy leaves using the best combination of parameters to produce the highest recognition accuracy. The number of layers, convolutional layer parameter values such as the filter size and window size, optimization techniques, and pooling window size were considered in the experiments. Two different scenarios have been performed on Dataset 1. Firstly, all classes are used with different class image numbers from 349 to 1493 (unbalanced data) to calculate model classification accuracy. The proposed 1-CNN performed better than other models on the unbalanced data. In particular, our model attains the average 97.53% of accuracy, which is much higher than other CNN algorithms with accuracy, whereas 97.13%, 97.44%, and 96.9% are achieved from F1-score, recall, and precision based on confusion matrix, respectively, as can be seen in Table 5. It also determines that most true values and predicted samples are matched.

According to the performance of each class, the best performance was obtained on the powdery mildew disease class with an F1-score of 99%. Out of 299 powdery mildew prediction images, 99.7% were correct. In addition, leaf miner and healthy classes observed similar recognition results, which are correctly classified as the images of 98.8% accuracy out of 177 and 167 predictions, respectively. In case of other disease classes such as spider, downy mildew and CYSDV achieved a predictive accuracy of 98.3%, 94.4%, and 91.4%, respectively. It can be seen in Table 5 that 1-CNN demonstrated higher results on the classes powdery mildew, leaf miner, and healthy; meanwhile, the number of images of these classes is larger than the others.

In order to ensure if the amount of data was an influence of factor to the proposed CNN, all experiments were performed on the proposed model with balanced data. For this experiment, the data augmentation scheme was performed on training and test Dataset 1, respectively, so that all classes contained the same number of images. An augmented Dataset 1 including 9877 leaf images was constructed. The number of images in the training and testing set were 8217 and 1660, respectively. Intuitively, the performance of the proposed 1-CNN model outperformed better on the accuracy compared to that with unbalanced data. The test results are shown in Table 6. From Table 6, it can be seen the 1-CNNalgorithm obtained average accuracy result with 98.19%, whereas 98.2%, 98.21%, and 98.21% were achieved from F1-score, Recall, and Precision, respectively. In essence, 1-CNN has achieved satisfactory accuracy results because of large data rather than balancing data. This result is in accordance with the experimental outcome of [25]. According to the performance of each class as shown in Table 6, the best performance was obtained on the downy mildew class with an F1-score of 99.09%. Out of 276 downy mildew prediction images, 98.2% were correct. In addition, healthy and leaf miner classes have similar recognition results, which are correctly classified images with 100% and 98.5% out of 271 and 284 predictions, respectively. Other disease classes, spider, powdery mildew, and CYSDV, achieved a predictive accuracy of 97.6%, 97.5%, and 97.4%, respectively. The recall value for each class was 100%, 98.6%, 95.1%, 98.9%, 98.9%, and 97.8%, respectively, and based on results, 1-CNN made more errors in predicting leaf miner and healthy classes. The reason of misclassification is due to similarity of color, shapes, veins, and disease symptoms of leaves. Leaf miner has most similarities with CYSDV and spider, and healthy leaves have similarities with downy mildew and CYSDV. In contrast, symptom images of class spider and downy mildew were correctly classified. The performance of all models was improved significantly. More precisely, 1-CNN accuracy was improved from 97.53% to 98.19%. According to the results, it is concluded that the amount of data in the input dataset was an influence of factor, which agreed with the conclusion that 1-CNN can attain satisfactory results with a large amount of data.

In another way, to demonstrate the robustness of 1-CNN based on the number of classes, another dataset named Dataset 2 that includes 3309 images for training and 138 images for testing was used and augmented by the data augmentation scheme. For this experiment, 1-CNN and other models have also been tested and implemented on Dataset 2. As expected, the performance of 1-CNN outperformed better on the accuracy compared to that with large class numbers. The test results are shown in Table 7. It can be seen based on confusion matrix that the 1-CNN model achieved an accuracy of 100%. Additionally, the F1-score, recall, and precision have achieved the highest result which is 100%. Based on the test results, it is determined that the number of classes in the input dataset was an influence of factor, which agreed with the conclusion that 1-CNN can attain adequate results.

The test results were achieved from proposed and pretrained models. It concluded that the proposed 1-CNN model has the ability and better performance to diagnose cucumber diseases and healthy image leaves better than other models in terms of dataset size (number of classes and number of sample images), balanced, and unbalanced data.

4.2. Performance Evaluation of Cucumber Disease Diagnosis

The correct diagnosis of cucumber disease is significant to construct a robust and effective model for an automated cucumber disease and healthy recognition. The performance of AlexNet, Inception-V3, and ResNet-50 as pretrained models and also 1-CNN, 2-CNN as a model from scratch have been tested on both datasets (Datasets 1 and 2). Numerous calculations are performed based on confusion matrix such as accuracy, recall, precision, and the F-score as shown in Figures 46 and Tables 810. Based on the results shown in Figure 4, it can be identified easily that the proposed 1-CNN model performs better compared with other models AlexNet, Inception-V3, ResNet-50, and 2-CNN.

It can be seen in Table 8 that the proposed 1-CNN outperformed better on dataset-1 with unbalanced data than Inception-V3, Resnet-50, 2-CNN, and AlexNet. The test accuracy results were obtained as shown in Figure 4 and are 97.53%, 97.02%, 96.30%, 95.07%, and 94.24%, respectively, whereas the higher accuracy result which is 97.53% was achieved from the 1-CNN model.

What is more, the degree of misclassification is examined. From Table 8 and Figure 4, we can see a relatively large number of misclassifications that were found between models’ performance. It shows that 1-CNN has the lowest misclassification result that is 2.47% compared with other models AlexNet, Inception-V3, ResNet-50, and 2-CNN that are 2.98%, 3.70%, 4.93%, and 5.76%, respectively.

Furthermore, all models were experimented and tested on Dataset 1 with balanced data. The comparative results of the 1-CNN, Inception-V3, ResNet-50, 2-CNN, and AlexNet models have been shown in Figure 5. Values have clearly indicated that 1-CNN is more accurate compared with other models. From Figure 5, it can be obviously seen that how 1-CNN significantly improved the recognition accuracy for leaf disease recognition (from 97.53% to 98.19%). This improvement reflects data augmentation that was applied on Dataset 1 to enlarged and balanced data.

It was revealed in Table 9, the recognition accuracy was 98.19%, 97.77%, 97.53, 96.69%, and 96.14%, respectively on 1-CNN, Inception-V3, ResNet-50, 2-CNN, and AlexNet models. Compared to the conventional models, 1-CNN demonstrated superior results of recognition accuracy. Based on the results that have been shown in Figure 5 and Table 9, the recognition accuracy rate of the proposed model increased with increasing data samples.

In order to show the effectiveness of class numbers for the performance authenticity of the 1-CNN, test experiments based on 1-CNN using Dataset 2 were performed that are presented in Figure 6 and Table 10. Figure 6 shows that the AlexNet model obtained a lower result accuracy based on recall, precision, and F1-score.

From Figure 6, it can be obviously and clearly seen that how 1-CNN recognition accuracy was significantly improved for leaf disease and healthy recognition (from 98.19% to 100%). This improvement reflects to decrease the class number and image samples on Dataset 2. According to the results that are shown in Table 10, 1-CNN has an excellent performance and obtained the result 100%, while 2-CNN, Inception-V3, ResNet-50, and AlexNet have achieved 99.28%, 99.28, 98.55%, and 97.10%, respectively. From the achieved results in Figure 6 and Table 10, we can see a relatively large number of misclassifications that were found between model’s accuracy performance. 1-CNN has no misclassification result compared with other models. It also has the test results that indicate that the 1-CNN and 2-CNN models performed better in small class numbers and image samples.

We note that the model is well fitting the training data, while the validation loss indicates how well the model fits with new data for both Datasets 1 and 2 as shown in Figures 7(a)7(c). Compared to other models, training and validation loss of 1-CNN performance are decreasing and improving over time. In Figure 7(b), the training and validation loss had improved due to data auguemntation compared to Figure 7(a). It also shows that data are trained well and loss function reduced compared with unbalanced data. In addition, the small class and image number reduced loss functions are shown in Figure 7(c). We can see that the training process is extremely fit and loss function is clearly fit with new data.

Despite that, 1-CNN has lower error and loss function, and also, the training time is less compared to other models. Efforts will be spent on deepening the convolutional network to obtain more accurate images without more time consumption. From the test experimental results on Dataset 2, we can see that the proposed 1-CNN model needs less time for training which is 438 minutes compared with other models which were 448, 698, 489, and 462.

According to the experimental results, the proposed 1-CNN model performed the best. Thus, it is suitable and robust to become a practical application of mobile devices for disease diagnosis. Moreover, it is shown as an excellent recognition result on a large dataset (i.e., more classes with a large sample of images) and a small dataset (less class number). Moreover, Inception-V3, ResNet-50, and AlexNet models have pretrained on the large amount of data.

In the last two decades, the problem related with automatic cucumber disease classification using visible range images has received considerable attention. Due to the method proposed so far, there will be some future problems such as multiple types of diseases in a single leaf and lack of cucumber leaf disease type dataset based on the class number and image samples.

In this study, the results showed that the proposed 1-CNN model achieved a good recognition performance in dealing with a dataset (large number of samples and classes) and a small class number dataset. It also indicated that the method had a good potential to be extended to field use by combining with mobile devices. The future work will be focusing on the cucumber diagnosis leaf disease system that would be a reliable tool for farmers and plant pathologies to help humans save their efforts and reduce plant pesticide usage. Recognizing multiple types of diseases will be another important extension. The dataset will be enlarged to cover as many variabilities occurred in practice as possible in order to detect and recognize the diseases at early stages.

4.3. Statistical Performance Analysis

The methods were presented in the past sections, and experiments were conducted for five different models of deep learning (1-CNN, 2-CNN, Inception-V3, ResNet-50, and Alex Net) on two different datasets (Datasets 1 and 2). As explained in sections 4.1 and 4.2, the proposed model attained a superior and highly accurate recognition result. In order to show the effectiveness of the proposed CNN performance, experiments on the models were conducted statistically using the chi-square test. It is a statistical test that is used to compare observed and expected results based on the formula defined in equation (9).where is the observed value and is the expected value.

The predicted test samples based on the adopted models have been compared using the chi-square test. A standard threshold α = 0.05 was used to show the significance differences of the proposed model compared with others models.

Based on the results shown in Table 11, the values of the test statistics of 1-CNN with Inception-V3, ResNet-50, 2-CNN, and AlexNet were 4545.520, 4389.209, 4418.237, and 4273.575, respectively. The value of all models were less than the chosen significance level α= 0.05. We can state that there was a significant difference between 1-CNN with other models on unbalanced Dataset 1 that included 973 test image samples.

In addition, 1660 test image samples were statistically experimented. From Table 12, we can see that the test statistical values were 8019.351, 7901.902, 7808.641, and 7722.563. The results conclude that there was a significant difference between 1-CNN and other models on unbalanced Dataset 1. The value of 1-CNN with other models was less than the chosen significance level α = 0.05.

On the other hand, all models on Dataset 2 that include 138 test image samples were statistically evaluated. Based on the results shown in Table 13, it indicated that there was a significant difference between 1-CNN and other models on Dataset 2. The value of 1-CNN with other models was less than the significance level α = 0.05.

According to the statistical value results and recognition results, the proposed 1-CNN outperformed better compared with other models.

5. Conclusion

In the domain of agriculture, diagnosing and classifying cucumber leaf disease is a critical task. In this study, an automated cucumber leaf disease recognition system was proposed. In addition, a cucumber leaf disease dataset was constructed that includes five cucumber diseases, i.e., spider, leaf miner, downy mildew, powdery mildew, CYSDV, and healthy leaf classes, which was then augmented by data augmentation methods to enlarge the dataset and decrease overfitting. Quantitative experiments verified that the CNN model achieved excellent recognition results. The accuracy of the proposed CNN model on the unbalanced and balanced datasets was 97.53% and 98.19%, respectively. In addition, another dataset was used to evaluate the proposed CNN performance, which includes only infected and healthy cucumber leaf classes. The accuracy result attained was 100%. Pretrained models (AlexNet, Inception-V3, ResNet-50, and two combined CNN from scratch) were investigated to evaluate the proposed CNN model. Comparative test results demonstrated that the proposed model outperformed better and superior than other models. Due to increasing sample images and reducing the number of classes, the proposed model observed the best result. In future work, this research would be enhanced to work on a real-time field. It would also be useful for farmers to detect and identify cucumber leaf diseases in the early stages.

Data Availability

No data were used to support the findings of this study.

Conflicts of Interest

The authors declare that they have no conflicts of interest.

Acknowledgments

The Authors would like to thank University of Raparin and Erbil Polytechnique University for their support during the preparation of the work. Many thanks for the reviewers for their valuable comments and suggestions on the manuscript which improved the performance of the paper. Special thanks should also be given to (Mr. Aso H. Hesamuddin, Assistant lecturer at university of Raparin) for his supports and assistance during collecting data of the work. This research was carried out at the Artificial Intelligent Research (AIR) Lab at the University of Raparin.