Crop Disease Detection System
Crop Disease Detection System
Farmers find difficulties in identifying and detecting as well as treating the plant diseases and its
cause. And Fruits are more prone to diseases depending on the season and environmental
conditions they grow during cultivation also they get more infections. The early and traditional
method of predicting the disease in fruits and plants is very difficult. Using the proposed model
one can make a huge dataset of different types of fruits and its diseases with huge number of
images stored in different folders for processing the data set. Each data set Is categorized with
type of disease and fruit. This system is trained and tested easily Artificial Neural Networking is
used to learn and classify categorize the fruits and diseases. Proposed model can detect accurate
disease and get preventive measures and some suggestions to the farmers. This system will
benefit the farmers across the world.
Introduction
Fruits are vulnerable to infections during the period of their cultivation. The factors favoring
such diseases is unknown to the farmers either, this cause the decrease in the production of fruits.
The application accommodates a variety of plant categories in its learned model to identify from.
The user can scan the suspicious plant for disease identification from the application camera. The
goal of such an application is to facilitate expert decision on the plant health as per specified by
the botanical community. It is a dire task to identify plant diseases for the uneducated farmers in
real life. A brief description of each disease is mentioned, along with a reasonable solution and
all the help needed. The application has the option of adding new learned models on different
plants or new disease developed with the help of botanist or any other agriculture or plantation
associations.
The main cause for the fruit disease is virus or the bacteria’s. Application includes identifying
the diseases in fruit that cause loss in production and quality showed up in reaping.
Distinguishing and grouping of diseases of fruit is important to recognize what are the control
factors must be taken one year from now to stay away from losses in the production. Fruit types
and their respective disease are as follows.
Apple
Apple fruits are susceptible for number of viral and bacterial diseases, namingly
a. Apple Scab
b. Black Rot Canker
c. Powdery mildew
d. Sooty blotch and fly speck
Banana
The disease attacks banana plants at all phases of development. Few of the disease that
attacks banana are as follows
a. Moko Disease
b. Crown Rot
c. Cigar End Tip
The proposed model uses CNN algorithm, technically CNN works on model train and
test the application main works with TensorFlow and Mobile net as well mobilnet in cnn
is a efficient and portable CNN architecture.
Model is basically consists steps like training the huge datasets with different type of
diseases of different fruits and then testing them with input image, algorithm follows
many steps like image acquisition, assigning importance, weights and biases to various
objects in the image.
Background
The main goal of this dissertation is to develop a system to enable farmers to accurately identify
different crop diseases using images taken from smartphone cameras. Over recent years deep
learning has proven to offer great opportunities for image classification and object recognition
capabilities[5].
It involves training a neural network using a dataset of images collected from actual crop leaves
affected by a disease[6]. After the model has been trained it can be integrated into a mobile
application or deployed on a cloud server for use as a crop disease detector.
Traditional computer vision was mainly based on image processing algorithms and methods. It
was mainly used for extracting the features of the image which includes detecting the corners,
edges, and color of objects. The main challenge with this approach used in traditional computer
vision for a classification task is that you must choose which features to look for in each given
image.
It becomes hard to cope up when the number of features of classes becomes high. The
introduction of deep learning DL has pushed the limits of what was possible in image
classification. There is no longer need of manually choosing the features. Simply put if you want
a deep learning network to classify objects, you do not explicitly tell it which features to look for
in an image. You just show it thousands of images and it will train itself to classify the given
images for you without writing any code.
Motivation of Work
We have explored many researches done on image processing and machine learning in
agriculture domain. Machine learning techniques such as neural network, CNN are applied for
different purpose such as classification; feature extraction etc. even this kind of research is
helpful to Farmer, Agriculture based system, Bio farm and researcher. After all observation we
have decided to work on orange fruit diseases detection and which disease using Image
Processing and Machine Learning Techniques. We are going to Problem statement is to detect
the diseases of fruits using CNN.
Objective
Objective of our work is to collect, detect and classify the orange fruit diseases. Use machine
learning algorithm and Image Processing to detect and classify the orange fruit disease. Compute
the accuracy. Scope of our work is, automatically classify and detect the orange fruit diseases
Agriculture Overview
Agriculture is practice of cultivating plants. Agriculture was the key development within the rise
of sedentary human civilization, where by farming of domesticated species created food
surpluses that enabled people to live in cities. Plants were independently cultivated in a
minimum of 11 regions of the planet. Industrial agriculture supported large-scale monoculture
within the 12th century came to dominate agricultural output, though about 2 billion people still
trusted subsistence agriculture. The major agricultural products are often broadly grouped into
food and fiber. Food classes include grains, vegetables, fruits etc. Over 1/3rd of the world's
workers is employed in agriculture, 2 nd only to the service sector, although in recent decades,
the worldwide trend of a decreasing number of agricultural workers continues, especially in
developing countries where small holding is being overtaken by industrial agriculture and
mechanization that brings a massive crop yield increase. Plant breeding, agrochemicals like
pesticides and fertilizers, and technological developments have sharply increased crop yields, but
causing ecological and environmental damage. Environmental issues include contributions to
heating, depletion of aquifers, deforestation, antibiotic resistance, and growth hormones in
industrial meat production. Agriculture is explanation and sensitive to environmental
degradation, like biodiversity loss, desertification, soil degradation and heating, all of which may
cause decreases in crop yield. Genetically modified organisms are widely used, although some
are banned in certain countries.
Fruit Disease
Fruit diseases are the disease that infects the fruit. Infection may occur in the mother tree itself
but symptom expression may be in mother tree during harvesting or storage. Since fruits are the
final product of the plant any infection in plant directly affects the income of farmer. Examples
of fruit diseases are rot, greening, black spot, scab, mold, Anthrancose, Melanose, canker etc.
The period between the point of infection and point of symptom expression are known as latent
period. To minimize the infection pre harvest spraying with fungicides in tree itself is important
and also avoid mechanical injury during harvesting and handling and cold storage are important.
For our approach we have decided to go with orange fruit and diseases selected for primary
experiment is rot, scab, greening and canker.
Literature Review
1. Yudong Zhang and Lenan Wu et al. adopted the model called split and merge
algorithm it is based on quadree partition of an image. This method starts at the root of
the tree that represents the whole image. If it is found inhomogeneous, then it is split into
four son-squares (the splitting process), and so on so forth. Conversely, if four son-
squares are homogeneous, they can be merged as several connected components (the
merging process). The node in the tree is a segmented node. This process continues
recursively until no further splits or merges are possible.
2. Sukhvir kaur et al. they devised a rule based semi-automatic system using concepts of
k-means and support vector machines to detect healthy leaves from diseased leaves. The
best performing feature set for soya bean leaf disease detection.
3. Neha Mundokar et al. they have used K-means clustering to perform image
segmentation. The segmented images are labelled by maintaining a catalogue. Artificial
Neural Network for pattern matching and disease classification. Diseases are categorized
based on feature vectors, colour, morphology, texture.
4. V Puja Rahul Dar et al. propose K-means clustering for image segmentation by using
Otsu's method for setting the threshold. Thesholding is used to create gray-scale image
from color images. They use Support Vector machines to classify the disease. The
disadvantage in this proposal is that user to manually select the region of interest.
5. Mohammad Wannous et al. they propose image processing using convolution neural
network and use Transfer learning technique of machine learning for classification. They
retrain the existing Googlenet Inception V3 model on a publicly available dataset.
Tensorflow is used to retrain the Inception Model.
6. Akanksha Rastogi et al. the image is processed to identify the plant using the features of
the leaf using artificial neural network. The leaves are then subjected to disease
classification using K-Means and artificial neural network.
Analysis Table
Proposed Methodology
There are several steps to be followed in the system to predict the disease of the fruit or
the leaf of the fruit plant those are basically starting from camera capture to training,
segmentation, processing calculating weights and mapping with datasets and then
predicting the disease that is present and also giving suggestion to overcome the problem.
Figure – 1 – Methodology Process
As mentioned before, the top-level use cases are here more appropriate to describe the user
communication with the system. This is because they provide information not only about the
system behavior, but also about the sequence of interactions that the farmers usually performs in
order to achieve a goal Once the farmer has some items scanned in his android phone, the next
step is to navigate to the remedy page. Here the user can remove or modify his diseased part that
has been scanned until the scan is clear to start the prediction process. Users can scan the same
plant species multiple number of time. There, after entering all plant and required information,
the system will confirm the disease and the system will display the remedies. The customer can
choose an option between other scan and detailed analysis on the same problem. Once the farmer
has some items scanned in his android phone, the next step is to navigate to the remedy page.
Here the user can remove or modify his diseased part that has been scanned until the scan is clear
to start the prediction process. Users can scan the same plant species multiple number of time.
There, after entering all plant and required information, the system will confirm the disease and
the system will display the remedies. The customer can choose an option between other scan and
detailed analysis on the same problem.
Deep learning (DL) is a technique for implementing machine learning (ML) in artificial
intelligence (AI). It was inspired by our understanding of the human brain which uses
interconnections between neurons to learn hence the name Neural Networks (NN) [7]. Neural
Networks have a variety of applications in computer vision such as image classification, speech
recognition, face recognition and analysis of big of data. Increase of computational power and
availability of more training data has caused deep learning networks to become very successful.
For these reasons, researcher have been able to develop and train neural networks more
efficiently.
Convolutional neural networks (CNN)
Convolutional neural networks are currently one of the most prominent algorithms for deep
learning with image data. They have proven to deliver outstanding results in several application
most notably in image related tasks. CNNs consist of multiple layers of connected neurons which
can learn feature automatically from datasets. CNNs uses raw images as input to learn certain
features and consist of an input layer, several hidden layers and an output layer.
Figure 2:1 shows a CNN where the red input layer consisting of an image is
transformed into a 3D arrangement. The height and width of the hidden layer are the
dimensions of the image and the depth consists of the three RGB channels.
Convolution Neural Network consists of various types of principle layers as shown in Figure 2:2.
The main building blocks are as follows:
1. Convolutional layer
3. Pooling Layer
Figure 2:2: CNN architecture that classifies input images. Source Matlab [8]
Convolutional layer
The name “Convolutional Neural Network” indicates that the networks makes use of convolution
operations. The primary purpose of this layer is to extract features from the input image. Figure 2:3
show an example of how convolution works in this layer. Consider an image of dimensions 5 x 5
whose pixel values can be either 0 or 1. A filter or kernel or feature detector of dimensions 3 x 3 is
slid over the image and along the way we multiply the values in the filter with the original pixel
values of the image.
Figure 2:3:Convolving an image with a filter, Source Stanford University [9]
After sliding the filter over the image, the result of the computation will be a 3 x 3 matrix called
the activation map or feature map.
Stride
The stride S denotes the number of pixels by which the filter window moves over the
input matrix operation. It controls how the filter convolves for example, when the stride
is 1 then we move the filters to 1 pixel at a time and so on.
Padding
Padding involves symmetrically adding any number to the input image matrix to preserve the feature. The
most common type of padding is zero padding. It works by adding zeroes to the input matrix to allows the
size of the input to be adjusted to your requirement.
Figure 2:4 Zero Padding
Figure 2:4 shows an input matrix of 32 x 32 x 3 with two boarders of zero padding applied
around it to gives us a 36 x 36 x 3 output matrix.
Rectified linear unit layer is an additional operation that is carried out after the convolutional
layer to replace all negative pixel values in the feature map by zero and if it receives a positive
value, the function will return the same positive value. It is graphically shown in Figure 2:5 and
mathematically defined as below
This layer is used to reduce the spatial dimensions of the feature map generated by the
convolutional layer. Less spatial information means that you gain computational performance
and less parameters reduces the chances of over fitting in a model. This makes the model more
robust because of translation invariance in the position of the features in the input image
Figure 2:6 show most common approach used in pooling is max pooling. The operation simply
involves sliding a window over the feature map and taking the max value in the window.
After all the features have been detected from the combination of previous different layers, the
fully connected layer is attached at the end of the network. It uses the detected features to classify
the input images into various classes based on the training dataset. The output of the previous
layers is flattened into a single vector of values. These values represent a probability that a certain
feature belongs to a certain class. In the case of crop disease identification, the fully connected
layer will then show you the probability that an input leaf image is affected by a which disease. An
activation function is used at the end to get likelihood value between zero and one for each
possible classification.
Possible challenges with deep learning
Overfitting and underfitting are the main challenges in deep learning. A good model is one that
can generalize new and unseen data and not only test data. This is a measure of how well a model
performs on unseen data[11]. Overfitting occurs when the model fits the training data too well or
effectively memorizes the existing data as shown in Figure 2:7 to cause high variance[12].
Underfitting occurs we have less data to train our model but quite high amount of features which
causes it to not perform well even on the training set as shown in Figure 2:7. Therefore, there is
need for a tradeoff between underfitting and overfitting.
Addressing Overfitting
To overcome the effects of overfitting and underfitting, techniques have been developed to
improve the performance of the model. These techniques are called regularization techniques and
as follows[13]:
A larger training set helps your model to give you a better approximation and avoid underfitting.
2. Early stopping
In this method training data is split into validation set and test set then during training when we
see that the performance on the validation set is getting worse compared to test set, we
immediately stop the training on the model as show in Figure 2:8.
3. Dropout
This is the most frequently used regularization technique in the field of deep learning. Dropout
involves ignoring neurons during the training phase of certain set of neurons which is chosen at
random[14].
4. Data augmentation
This consists of the transformation of the geometry or intensity of the original images to make
them seem like new images. The operations include rotation, zooming, mirroring, cropping,
adjusting contrast and brightness values as well as simulating new backgrounds.
Hyperparameter tuning
In order to enhance the model performance there are a set of hyperparameters that need tuning. A
hyperparameter can be any configurable variable that is a pre-determined before starting the
training. Tuning these hyperparameters can effectively lead to a massive improvement in the
accuracy of the model[15]. Below, we briefly survey the hyperparameters.
1. Learning rate
Learning rate controls how much to update the weight at the end of each batch in the
optimization algorithm.
2. Number of epochs
Number of epochs is the number of times that the learning network will go through the entire
training dataset. This number is increased until the validation and training error from the model
has been sufficiently minimized.
3. Batch size
The entire dataset cannot be passed into the deep learning network all at once, so the dataset is
divided into a number of batches or sets. The number of samples in each set is what is called a
batch size.
Adding more layers in a model has been proven to generally improve accuracy to a certain
degree depending on the problem[16].
5. Weight initialization
It is necessary to that initial weights are set for the first feed forward pass. Two techniques are
generally practiced initializing parameters which are zero initialization and random initialization.
6. Regularization
The appropriate regularization technique should be chosen to avoid overfitting in deep neural
networks. As discussed in the previous section dropout is a preferable regularization method which
involves ignoring certain neuron during the training phase.
Validation in deep learning
Model validation or testing is a process used to estimate the performance or accuracy of deep
learning models[15]. This process is conducted after training has been completed to know how
well the model will perform in real world. It is not a good practice to test the model on the same
dataset used for training. So, to know the actual performance of the model, it should be tested on
unseen dataset which is usually referred to as test set.
1. Holdout Validation
This is a simple approach in which the entire dataset is divided into three parts (training
validation and testing dataset). The model is then trained on training data, fine-tuned using
validation data and tested using the test set
This method is mainly used when we only have one model to evaluate.
In this method we keep only one instance of the data as a testing data and train the model on the
rest of the data. This process is applied once for each data point. For example, if you have 500
instances of data it will iterate 500 times. One instance is allocated for testing and the rest for
training as shown in Figure 2:10.
K-fold cross validation is an improvement of the holdout validation method. The data set is
divided into k number of subsets and the process is as follows:
1. Split the entire dataset randomly into k number of subsets or folds ash shown in Figure 2:11
2. Train the model on (k-1) subsets of the dataset and then test the model on the kth subset
3. Repeat the process until each of the k-folds has been used as a test set
4. Take the average of your k subsets accuracy to get the model performance metric. This also
called the cross-validation accuracy
Figure 2:11 K-Fold cross validation
The main advantage of this method is that It covers all the data instances and learns everything
therefore the bias will be very low.
This is the most sophisticated method of all the validation methods. It consists of a series of test
subsets and the corresponding training subset contains only observations that occurred prior to
the test set as shown in Figure 2:13.
Figure 2:13 Cross validation for Time series
LeNet
In 1994, one of the very first convolutional neural network architecture was proposed by Yann
LeCun and was name LeNet5[17]. This architecture is made up of seven layers, which are three
convolutional layers, two pooling layers and one fully connected layer followed by an output
layer.
AlexNet
In 2012, Alex Krizhevsky and team released an architecture called AlexNet which was a an
advanced version of the LeNet architecture[18]. It consists of consists of 5 convolutional layers
and 3 fully connected layers.
In that same year, AlexNet won the ImageNet competition by a large margin. It achieved this
state-of-the-art performance in this competition because it used the novel ReLU activation, data
augmentation, dropout to reduce overfitting and local response normalization.
GoogleNet or Inception v1
In 2014 Christian Szegedy from Google published a network known as GoogLeNet [19] which
became the winner of the ImageNet Large Scale Visual Recognition Competition 2014, an image
classification competition. It was able to outperform the other models because of the introduction
of a concept called inception modules, so as a result the model runs very fast, has 12 times less
parameters and more accurate. Also, it has lower power and memory use.
Figure 2:16 GoogleNet Architecture [20]
GoogleNet has 22 layers in total as show in Figure 2:16. and is also called Inception v1. In the
same paper, Christian Szegedy and the team at Google also proposed several upgrades to the
GoogleNet or Inception v1 model which increased accuracy and reduced computational
complexity. This led to improved version namely Inception v2, Inception v3 and Inception v4.
VGGnet
VGGnet architecture was proposed by Simonyan and Zisserman from University of Oxford in
2014 [20]. This architecture was the 1st runner-up of the ImageNet Large Scale Visual Recognition
Competition 2014 with a 7.3% error rate. VGGnet performed way better than AlexNet by
replacing the large kernel filters in AlexNet with multiple 3x3 kernel sized filters.
ResNet
In 2015 Microsoft published its own neural network known as ResNet [22]. ResNet was the
winner of the ImageNet Large Scale Visual Recognition Competition 2015 with an error rate of
3.57%.
Resent was designed to allow hundreds or thousands of convolutional layers. Other deep learning
architectures drop off in effectiveness because of additional layers. This architecture can add many
layers with strong performance. It was able to achieve high performance because of using different
identity mappings building blocks which has several different paths of stacked identity layers with
their outputs merged via addition.
Comparison
Transfer Learning
In recent years, most applications of deep learning rely on transfer learning. Rarely do
researchers train an entire deep learning network from ground up. This is because obtaining
many images for a given class of diseases can be complicated especially in an agricultural
context. A concept known as transfer learning is very useful in cases where you have insufficient
data for a new domain to be implemented by a deep learning network.
Transfer learning is a machine learning method of using the knowledge of an already trained
model to a different but related problem[24]. For example you might only have 600 images of a
crop disease, but by leveraging on the knowledge of an existing model such as GoogleNet which
has been trained on over million images, you can use the model as an either as an initialization or
a feature extractor for the task of interest. Furthermore, training a deep learning network from
scratch generally require multiple GPU’s and the process is time-consuming process which can
take up to 3 weeks[25]. This makes transfer learning an even easier and practical approach to
consider.
There are different strategies and techniques for transfer learning usage patterns [26] as follows:
Classifier - The pre-trained model is used directly to classify new images.
Related work
Crop disease detection is still an active area of research. Several techniques have been
implemented to detect crop diseases. The most common and simplest method used for detection of
plant diseases is visual plant disease inspection by humans[27]. This traditional method is based on
characteristic plant disease symptoms like blights, wilts, rots and lesions. Other techniques are
performed by experts using different methods including visible light imaging, thermal imaging and
chlorophyll florescence imaging[28]. Traditional methods are not reliable for detecting disease in
crops because of lack of uniformity and the need for expertise and experience in the procedure.
Also differentiating closely related strains may be difficult with traditional methods.
The science of crop disease diagnosis evolved from visual inspection to other better techniques
which are based on the analysis of near-infrared reflectance on crop leaf[29]. They make use of
highly sensitive sensors to measure reflectance, temperature, biomass and fluorescence of crops
within different regions of the electromagnetic spectrum. The classification accuracies of these
methods are very low. Although these methods are much more reliable and accurate than visual
inspection, they have some limitations that block the effective use of these techniques for the
detection of diseases in crops. The main limitations include deployment costs, availability,
processing speed and real-time diagnostic capabilities.
Therefore, looking for less expensive, accurate and fast methods to automatically detect the
diseases from the symptoms that appear on the plant leaf is of great significance Techniques
capable of overcoming these challenges are needed to allow for the automation of diseases
identification in crops. Computer vision and image processing solutions offer great opportunities
for the automatic recognition of crop diseases[30]. These technologies play a big role in
developing a monitoring tool for pests and diseases and for warning the communities of possible
outbreaks.
Rothe, P. R and R. V. Kshirsagar [31] developed a system to identify and classify diseases in
leaves using pattern recognition. The system was able to identify and classify three leaf diseases
which are Alternaria, Bacterial leaf blight and Myrothecium with an accuracy of 85 percent. The
technique involved image preprocessing and segmentation to isolate the leaf spots from the
background. Hu's moments are then extracted as features for use in training of the adaptive neuro-
fuzzy inference system.
Computing enrichment on image using image edge is also another technique that has been
proposed for crop disease identification specifically for [32]. The images undergo enrichment
process first using image edge detection segmentation techniques followed by R, G, B color
feature image segmentation which is carried out to get target disease spots. To recognize diseases,
the image features such as boundary, shape, color and texture are extracted for the disease spots.
Another author also developed a system for diagnosis and classification of plant diseases using
K-means clustering for image segmentation and neural network for classification[33]. The K-
means clustering is used for classification of image pixels based on a set of features into K
number of classes. K-Means clustering is mainly used to minimize the sum of squared distances
between all points and the cluster center.
2. Each pixel in the image is assigned to the cluster that minimizes the distance between the pixel
and the cluster center.
3. Repeat computation of cluster centers by taking an average of all the pixels in the cluster.
The efficiency of this algorithm is high but due to the need to determine the number of clusters
K, it brings certain difficulties for automated calculations.
Neural networks represent a huge breakthrough in pattern recognition and classification of images.
Deep learning techniques have obtained significant success in several plant disease detection
studies. Bouaziz B, Amara J and Algergawy [30] proposed a deep learning-based approach that
automated the process of classifying banana leaves diseases. They made use of the LeNet
architecture as a deep neural network to classify between healthy and diseased banana leaves. The
researchers obtained encouraging results which proved that the proposed method can significantly
be used to accurately detect leaf diseases with little computational effort.
Fuentes A, Yoon S, Kim SC and Park DS[35] also developed a new approach but based on deep
learning networks. They incorporated VGG net and Residual Network (ResNet) with three families
of detectors which are Faster Region-based Convolutional Neural Network (Faster R- CNN),
Region-based Fully Convolutional Network (R-FCN), and Single Shot Multibox Detector (SSD) to
recognized nine different tomato diseases and pests. The model was trained on a large Tomato
Diseases and Pests dataset and experimental results showed that the proposed system could
effectively recognize nine different types of diseases and pests with high accuracy.
Fujita E, Kawasaki Y, Uga H, Kagiwada S and Iyatomi H[36]. developed a new practical
cucumber disease detection system that used CNNs consists of an input layer, convolution
layers, pooling, local response normalization operations and an output layer. The system based
on CNNs attained an average of 82.3% accuracy under the 4-fold cross validation strategy.
Mohanty SP, Hughes DP and Salathé M [37] evaluated AlexNet[18] and GoogleNet[19] deep
learning models applicability for for the classification problem. They analyzed the performance of
deep learning architecture on the PlantVillage dataset by training the model from scratch in one
case, and then by leveraging on already trained models using transfer learning. The overall
accuracy obtained on this dataset by training from scatch was 85.53% and 99.34% in case of
transfer learning. This approach also showed showing strong promise of the deep learning
approach for similar prediction problems.
From the literature survey conducted in this section, we can conclude that convolutional neural
networks (CNNs) has achieved impressive results in the field of image classification. Hence, in
this dissertation, we will investigate the application of deep learning-based approach to detect
diseases in crops. In the next sections, we will explain in detail the proposed method as
applied to cop leaves.
Methodology
This chapter describes entire procedure of developing the model for crop disease recognition
using deep learning. This includes the design specifics and the entire process in detail. The
proposed solution and assumptions are thoroughly developed staring with dataset collection.
Research procedure
Alternaria leaf spot is a common fungal disease in [38]. Main symptoms include small, circular,
brown spots with purple margins varying in size from 1 to 10 mm in diameter as shown in Figure
3:2. The spots gradually turn grayish as the plant grows producing irregular dead spots areas on
the leaf.
Figure 3:2 leaves affected by Alternaria leaf spot, Source: PlantVillage[34]
These symptoms are caused a fungus called Alternaria macrospora which survices on residues.
This pathogen is an air-borne disease and can also be spread by water splashing on to healthy
plants.
2. Bacterial blight
It is the most devastating crop disease. bacterial blight is caused by a bacterial called
Xanthomonas citri subsp malvacearum which survives in infected crop debris and seeds. It starts
out as angular, waxy and water-soaked leaf spot with a red to brown border on leaves, stems and
bolls. As the plant grows, the spots gradually turn into brown necrotic areas as shown in Figure
3:3.
If these diseases are left untreated, they will kill the plant. However, if they are diagnosed early,
they can be treated, and the crop can be saved.
The third category of classification is healthy leaves to allow the model to tell the
difference between a health and diseased leaf.
Dataset Annotation
After collecting the images various leaf images there is need to organize the images and associate
a label to each image. It involves removing duplicated images and identifying diseases on the
leaves and organizing the images into folders corresponding to the different classes (i.e. Bacterial
blight, Alternaria leaf spot and Healthy Leaves). This is a repetitive, time-consuming and
necessary step in building up a dataset.
Dataset Division
For the purposes of training and testing the model, three separate datasets are required. In this
process we are subdivided the dataset put together in the previous section into the following sets:
1. Training set
This is the actual set used to train the model to learn its hidden parameters such as weights and
biases.
2. Validation set
The validation set is used to evaluate the model. This accomplished by manually fine-tuning
model hyperparameters allowing the training process to be monitored and to detect overfitting.
These include among others the learning rate, batch size and number of epochs.
3. Test set
This set is used when the training phase has been completed to evaluate the performance and
accuracy of the final trained model.
Images
Image Processing
The next stage after building the dataset was preprocessing of the images. This process is very
important in the deep learning pipeline to make sure the training data is standard before being feed
into a model for training. For example, images must be resized to match the size required by the
network, 227 × 227 for AlexNet, 224 × 224 for DenseNet, ResNet, and VGG, and 299 × 299 for
Inception.
Data Augmentation
To enrich the dataset, several techniques were used to increase the number and diversity of the
available images in the datasets. More augmented images increase the chance of the network to
learn more features and to be able to accurately distinguish one class from the other [21]. The
image transformations included resizing, cropping, flipping, rotations, color, contrast and
brightness enhancements.
Having acquired the images and preprocessed them, the next step was to design a model and
train it on those images.
Practical Considerations
In order to start developing the model, there are design choices that need to be taken into
consideration. The main one being the architecture choice of the model. As discussed in the
previous chapter it is now common practice to use a deep neural network that has been pretrained
on a very large dataset and then leverage its knowledge as an initialization for our task of interest.
We used the layers in the Inception v3 pre-trained model as a feature extraction component of
our new model. The inception model was loaded without the classifier part of the model and
added a new flatten layer, Dense layer, Dropout and Output layer altered for the requirements of
our new dataset to predict the probability for 3 classes.
Figure 3:5: Deep neural network Figure 3:5 shows the block diagram design of our model. The
block diagram was drawn using Deep Learning Studio[40].
Matplotlib was used to visualize the output of an image at every layer. For example, for the
image in Figure 3:7, the output image can be visualized after each layer.
Convolutional layer 1 output Figure 3:7 : Portion of a diseased cotton leaf
MaxPooling layer 1 output
import tensorflow as tf
converter = tf.lite.TFLiteConverter.from_keras_model_file('crop.h5')
tfmodel = converter.convert()
open ("output_model.tflite" , "wb") .write(tfmodel)
All code in this section was written in the Java programming language using Android Studio
software[43].
Figure 3:8 Mobile application flowchart
Application layout
The layout was developed using Extensible Markup Language (XML). The main
components of the layout are as follows:
Upload photo - This is a button to allow the user to open the device gallery and
select an image to classify.
Take photo - This is a button to allow the user to open up the device camera
and take a photograph of an image to be classified.
Image Display panel – This panel is to display the photograph take or the
image taken from the device gallery
Detect disease – This button is used to initiate the classification process
Android application is designed with UI where the farmer can register himself and login with
proper credentials and then login to the panel where he can capture and upload the picture for
testing against the model file trained with 1000 of diseased dataset images with different
fruits and categories.
The model is created with pre learned dataset which is appropriate for Tensor Flow
framework to predict the disease of the test file.
Tensor flow includes the details of the fruit and plant diseases and the model trained over the
dataset, Training and testing sets are divided into a ratio of 10:1 respectively. The clustering
algorithm is used to pre determine the tensor flow framework.
This is process of predicting the disease of the uploaded image from mobile capture it
includes identifying and giving helpful remedies.
STEP 5: Optimization
The model is optimized by using the optimization techniques in the tensorflow such as
model. Optimization, pruning, stemming. The display options are selected according the user
from regional language or as set by user during login. The predicted information is displayed
in this step and the remedies necessary is shown.
STEP 6: Prediction
The proposed model is been implemented in the computer device with 4GB RAM and 1TB
hard disk. An android application is developed using android studio and run in the cell
phones with 2GB RAM. The proposed system can identify the confidence level of the
healthiness of leaf. It can also produce the kind of disease if attacked.
The results of the development of the plant disease identification using tensorflow over the
traditional approaches are convenience to use, interactivity, large volume in prediction. As
shown in the Figure 6, the number of days is given on x-axis and the yield of the crops or the
health of plants mentioned on the y-axis. The Figure 3 displays the data of the machine
learning system for the same values as used in traditional disease identification. The
difference can be clearly observed. As sown in Figure3 the first blue line represents the data
of traditional methods and the second red line represents use of tensorflow and machine
learning data.
Rate of
Disease Name Samples Recognized Missed
recognition
Anthracnose 150 143 7 91.3%
Bacterial Blight 150 148 2 98%
Apple Scab 150 138 12 89%
Die Back 150 144 6 92.09%
Crown Rot 150 147 3 97.90%
Cigar End Top 150 150 0 100%
Bacterial Canker 100 89 11 89.00%
Software Requirements
Hardware Requirement
Processor : Intel ® i5
Hard Disk : 100GB
RAM : 8 GB
Support : GPU CUDA
By this Methodology, we can assure with managing all sorts of identification of problems such
as assembly line product identification, fruits or vegetables disease identification. It reduces the
number of plants dying due to improper identification of disease. The main aim was to learn and
design a machine learning application development inside an Android application. Providing
flexibility of implementation of tensorflow framework inside any environment. This helped in
creating our own android application which uses machine learning.
References
1. Savita N. Ghaiwat, Parul Arora, “Detectio and Classification of Plant Leaf Diseases Using
Image processing Techniques: A Review” 3, 2014.
2. Savita N. Ghaiwat, Parul Arora presents and K-nearest neighbor (KNN) method for
predicting the class of test example.
3. Renuka Rajendra Kajale, “Detection and Reorganization of Plant Leaf Disease Using
Image Processing and Android O.S.” March-April 2015.
5. Yeh, R.A., et al.: Semantic image inpainting with deep generative models. In: CVPR. pp.
5485–5493 (2017).
6. Sukhvir Kaur, Shreelekha Pandey and Shivani Goel, “Semi-automatic leaf disease
detection andclassification system for soybean culture”. IET Image Process., 2018, Vol. 12
Iss. 6, pp. 1038-1048
7. Neha Mundokar, Pratiksha Kale, Minal Bhalgat, Shalaka Koske, “Fruit Disease Detection
Using Color Analysis and ANN with E-Nose”, Imperial Journal of Interdisciplinary Research
(IJIR) Vol-3, Issue-5, 2017 ISSN: 2454-1362,pp-1919-1923.
10. AakankshaRastogi, Ritika Arora, and Shanu Sharma, proposed "Leaf Disease Detection
and Grading using Computer Vision Technology & Fuzzy Logic"2nd International
Conference on Signal Processing and Integrated Networks2015.
11. Rutu Gandhi ; Shubham Nimbalkar ; Nandita Yelamanchili ; Surabhi Ponkshe, “Plant
disease detection using CNNs and GANs as an augmentative approach”, IEEE International
Conference on Innovative Research and Development (ICIRD), 2018
12. Bhavini J. Samajpati ; Sheshang D. Degadwala, “Hybrid approach for apple fruit
diseases detection and classification using random forest classifier”, International Conference
on Communication and Signal Processing (ICCSP), 2019