You are on page 1of 58

Automatic Leaf Disease Classifier

VISVESVARAYA TECHNOLOGICAL UNIVERSITY


JNANA SANGAMA, BELAGAVI – 590018

A Project Report on

“Automatic Leaf Disease Classifier”

Submitted in partial fulfillment for the award of degree of

Bachelor of Engineering
In

Electronics And Communication


Submitted By

Anand T – 1NH17EC006
Under the guidance of
Ms. S Gayathri,
Assistant Professor,
Dept. of ECE,
NHCE, Bengaluru

DEPARTMENT OF ELECTRONICS AND COMMUNICATION

OUTER RING ROAD, KADUBISANAHALLI,PANATHUR POST, BENGALURU – 560103.


2020- 2021

Department of Electronics and Communication Engineering/NHCE Page 1


Automatic Leaf Disease Classifier

Department Of Electronics And Communication Engineering

Certificate
Certified that the Final-project entitled “Automatic Leaf Disease Classifier” is carried out by
Mr. Anand T bearing USN : 1NH17EC006 bonafide students of NHCE, Bengaluru, in partial
fulfilment for the award of Bachelor of Engineering in Electronics and Communication of the
Visvesvaraya Technological University, Belagavi during the year 2020-2021. It is certified
that all corrections/suggestions indicated for Assessment have been incorporated in the
report deposited in the department library. The Final-project report has been approved as it
satisfies the academic requirements in respect of the Final- project work prescribed for the
said degree.

____________________ ____________________

Signature Of Guide Signature Of HOD

Ms. S Gayathri Dr. Sanjeev Sharma


Assistant Professor Prof. & HoD
Dept. of ECE Dept. of ECE
NHCE, Bengaluru. NHCE, Bengaluru

EXTERNAL VIVA

Name of the Examiners Signature with Date

1. 1.

2. 2.

Department of Electronics and Communication Engineering/NHCE Page 2


Automatic Leaf Disease Classifier

ACKNOWLEDGEMENT
The satisfaction and euphoria that accompany the successful completion of my project would
be impossible without the set of people, whose guidance and encouragement crowned our
effort with success.

I have great pleasure in expressing my deep sense of gratitude to Dr. Mohan Manghnani,
Chairman of New Horizon Education Institution for providing us with the necessary
infrastructure and pleasant environment.

I take this opportunity to express my profound gratitude to Dr. Manjunatha, Principal of


New Horizon College of Engineering, for his constant support and encouragement.

I am grateful to Dr. Prashanth C S R, Dean Academics for providing us with suggestions


and solutions in the course of my project work.

I would like to thank Dr. Sanjeev Sharma, HOD, Department of Electronics and
Communication Engineering, for his abundant support and encouragement.

I would like to thank Ms. S Gayathri, our project guide, Department of Electronics and
Communication Engineering, for constantly monitoring the development of the project and
setting up precise deadline. Her valuable suggestions were the key factors in the completion
of project.

I would also like to thank the teaching and non-teaching staff of Department of Electronics
and Communication Engineering, for their extreme support and my friends, who always
supported me during the course of my project.

Finally I would like to thank God for keeping us safe during the course of completing this
project and making this project a successful one.

Anand T -1NH17EC006

Department of Electronics and Communication Engineering/NHCE Page 3


Automatic Leaf Disease Classifier

DECLARATION
I hereby declare that the project work entitled “Automatic Leaf Disease Classifier”
submitted by me to the Department of Electronics and Communication Engineering, NHCE
Bengaluru, is a record bonfide project work carried by me under the guidance Ms. Gayathri,
NHCE. This project work is submitted in the partial fulfillment of the requirements for the
award of the degree Bachelor of Engineering in Electronics and Communication.

I further declare that the work reported in this project has not been submitted and will not be
submitted, either in parts or in full, for the award of any degree in this institute or any other
institute or university.

Anand T -1NH17EC006

Department of Electronics and Communication Engineering/NHCE Page 4


Automatic Leaf Disease Classifier

Abstract
Agriculture is a key source of livelihood. Agriculture provides employment opportunities for
village people on large scale in developing country like India. India's agriculture is composed
of many crops and according to survey nearly 70% population is depends on agriculture.
Most of Indian farmers are adopting manual cultivation due to lagging of technical
knowledge. Farmers are unaware of what kind of crops that grows well on their land. When
plants are affected by heterogeneous diseases through their leaves that will effects on
production of agriculture and profitable loss. Also reduction in both quality and amount of
agricultural production. Leaves are important for fast growing of plant and to increase
production of crops. Identifying diseases in plants leave is challenging for farmers also for
researchers. Currently farmers are spraying pesticides to the plants but it effects human
directly or indirectly by health or also economically. To detect these plant diseases many
fast techniques need to be adopt. In this paper, we have done survey on different plants
disease and various advance techniques to detect these diseases.

Department of Electronics and Communication Engineering/NHCE Page 5


Automatic Leaf Disease Classifier

Content
Abstract 5

1. Introduction 10

1.1 Statistical Analysis 11

1.2 Problem Statement 11

1.3 Key issues and challenges in process of disease analysis 11

1.4 Existing System 12

1.5 Proposed System 12

2. Literature Survey 14

3. Requirement Specifications 18

3.1 Software Requirements 18

3.1.1 Why Python 18

3.1.2 Keras 19

3.1.3 Numpy 20

3.1.4 Anaconda Spyder 21

3.2 Functional Requirements 21

3.3 Non-functional Requirements 22

4. Methodology 23

4.1 Different phases in testing and training 25

4.2 Detailed Explanation 28

4.2.1 Python 28

4.2.2 Numpy 28

4.3 Image processing 29

4.3.1 Different image processing algorithms 30

4.3.1.1 Morphological Image processing 30

4.3.1.2 Gaussian Image processing 32

Department of Electronics and Communication Engineering/NHCE Page 6


Automatic Leaf Disease Classifier

4.3.1.3 Fourier Transform in image processing 34

4.3.1.4 Edge Detection in Image processing 35

4.3.1.5 Wavelet Image processing 36

4.4 Image processing using Neural networks 37

5. Testing 40

5.1 Most common types of leaf diseases 42

5.1.1 Black Spot 42

5.1.2 Leaf Spot 42

5.1.3 Rust 42

5.1.4 Powdery Mildew 43

5.1.5 BOTRYTIS BLIGHT 43


6. Results 45
7. Conclusion 48
8. Future Scope 49
9. Appendix 50
10. References 57

Department of Electronics and Communication Engineering/NHCE Page 7


Automatic Leaf Disease Classifier

LIST OF FIGURES

3.1 Applications of Python 19

3.2 Why learn Keras 20

4.1 Leaf damaged due to leaf miner insect 23

4.2 Image processing to detect the disease 24

4.3 Flowchart of the methodology 25

4.4 Image pre-processing 27

4.5 How image is classified as pixels 30

4.6 RGB image representation 30

4.7 Probing of an image with structuring elements 31

4.8 Examples of simple structuring elements 32

4.9 Dilation 32

4.10 Erosion 32

4.11 Gaussian image processing 33

4.12 Edge detection in image processing 36

4.13 Wavelet image processing 36

4.14 Basic neural network 37

4.15 Operation on a single neuron 39

5.1 Few images of the dataset 40

5.2 Few images of the dataset 41

5.3 Folder of the dataset collected and stored in the laptop 41

5.4 Black spot disease 42

Department of Electronics and Communication Engineering/NHCE Page 8


Automatic Leaf Disease Classifier

5.5 Leaf spot disease 42

5.6 Rust disease of leaves 43

5.7 Powdery Mildew disease 43

5.8 Botrytis Blight 44

6.1 Picture of a healthy corn leaf 45

6.2 Picture of a diseased corn leaf 45

6.3 Picture of a healthy potato leaf 46

6.4 Picture of a diseased potato leaf 46

6.5 Picture of a healthy tomato leaf 46

6.6 Picture of a diseased tomato leaf 46

Department of Electronics and Communication Engineering/NHCE Page 9


Automatic Leaf Disease Classifier

Chapter-01

Introduction

The primary occupation of India is agriculture. India ranks second in the agricultural
output worldwide. The economy of India is predominantly dependent on the agricultural
productivity. About 70% of the villages and many other rural areas depend on agriculture
only. Agriculture provides employment to about 60% of the population and pays about 17%
of the total GDP (Gross Domestic Product). Therefore it is very important to detect the
diseases that affect the plants for a better agricultural activity. In olden days the farmers
were very well versed in agriculture and could identify the diseases by just looking at the
plants. But now due to the unpredictable climatic conditions and the highly polluted
environment, the plants are getting affected by many new diseases that the farmers are not
able to identify and finally incur loss in their business which ultimately affects the Indian
economy. The most predominantly grown crops in India are rice, wheat, jowar, pulses,
cotton, coffee, rubber etc. All these crops grow based on the strength of their leaves and
roots. The existing methodology of detection of plant diseases through the naked eyes
which requires more man labour, equipped laboratories, expensive diseases are not that
accurate and my lead to wrong usage of the pesticides and insecticides that can cause long
term resistance of the pathogens, reducing the ability of the crops to fight back. It can also
cause the soil to loose its strength and it will take many years to get back to normal state.
Hence, accurate detection of diseases is required in order to strengthen the field of
agriculture and out economy. Most types of diseases affect the leaves of the plants which
the farmers get more difficulties in identifying them and are not able to provide the
precaution to those plants due to the lack of knowledge about those diseases. In current
day among this field, the image processing method is suitable, efficient and reliable in the
field of disease detection. With the help of the leaf images the automatic leaf disease
classifier can identify the colour, spots etc on the leaf and determine the type of disease
that has affected the plant. Hence, this can be a fast process and the farmers can save a lot
of time. The first implementation of plant disease detection using image processing was
done by Shen WeizhegWuyachun Chen Zhanliang and Wi Hangda.

Department of Electronics and Communication Engineering/NHCE Page 10


Automatic Leaf Disease Classifier

1.1 Statistical Analysis


Agriculture is the world’s largest industry which employs more than 1 billion people
and gives an outcome of over 1.3 trillion dollars worth of food annually. The
croplands and farms occupy about 50% of the Earth’s habitable land and provides
living to many species. An analysis in 2016 had found that 65% of the poor working
people made their living through agriculture. In 2018, agriculture accounted for 4%
of the global GDP and in some developing countries it accounted for more than 25%
of GDP.
In India, agriculture is the primary source of livelihood for about 58% of the
population. The Gross Value Added (GVA) by agriculture, forestry and fishing was
estimated to be Rs.19.48 lakh crore which is approximately US$276.37 billion in
FY20. The food industry in India is poised for huge growth, increasing its contribution
to world food trade every year due to its immense potential for value addition,
particularly within the food processing industry. The Indian food and grocery market
is the world’s 6th largest, with retail contributing 70% of the sales. Indian food
processing industry accounts for 32% of the country’s total food market which is
one of the largest industries in India and is ranked fifth in terms of production,
consumption, export and expected growth.

1.2 Problem Statement


To design a device that can classify the disease that the plant is affected in a very
quick, reliable and cost-efficient manner by image processing in which the images of
the image of the leaf is captured and is compared with the existing database. We are
using Python as our working platform.

1.3 Key Issues and Challenges in the process of Disease Analysis


Many researches have been done in order to identify the diseases that affect the
plants. Keeping that in mind, the key challenges in the process of disease analysis
are:
 Quality of the leaf’s image
 Dataset should be in large amount

Department of Electronics and Communication Engineering/NHCE Page 11


Automatic Leaf Disease Classifier

 The captured images are affected by background data and noise


 Segmentation of the exact spots on the leaves into meaningful diseases.
 Preparing the training and testing samples from the input image
 Colour, size and texture of the leaf changes with climatic changes
 Regular observation is needed in some particular plants
 Rectifying the diseases for different plant leaves is challenging

Keeping all these points in mind we have done the project to overcome most of the
challenges that are listed.

1.4 Existing System


The already existing system of plant disease detection is simply through naked eye
observation by experts by which identification and detection of plant diseases is
done. In order to do this, a big team of experts as well as continuous monitoring of
the plants is needed, which is a costly process when it comes to inspection of large
farms. In some places, the farmers do not have proper facilities or even knowledge
that they can contact the experts due to which the counselling experts charge very
high price and also it is a time consuming process. In this condition the suggested
technique proves to be beneficial in monitoring large fields of crops. Automatic leaf
disease classification by just rectifying it from the plant makes it easier as well as
cheaper.

1.5 Proposed Solution


 Image acquisition is the very initial step that needs capturing an image with the help of
a digital camera.
 Pre-processing of input image to improve the quality of image and to remove the
undesired distortion from the image. Clipping of the leaf image is performed to get the
interested image region and then image smoothing is done using the smoothing filter.
To increase the contrast Image enhancement is also done.
 Mostly green coloured pixels, in this step, are masked. In this, we computed a
threshold value that is used for these pixels. Then in the following way mostly green
pixels are masked: if pixel intensity of the green component is less than the pre-

Department of Electronics and Communication Engineering/NHCE Page 12


Automatic Leaf Disease Classifier

computed threshold value, then zero value is assigned to the red, green and blue
components of the this pixel.
 In the infected clusters, inside the boundaries, remove the masked cells.
 Obtain the useful segments to classify the leaf diseases. Segment the components
using genetic algorithm

Department of Electronics and Communication Engineering/NHCE Page 13


Automatic Leaf Disease Classifier

Chapter-02

Literature Survey
Yan-cheng zang Han-Ping Mao, Bo Hu, Ming-xi Li in paper titled Feature
Selection of Cotton Disease Leaves Image Based on Fuzzy Feature Selection
Techniques[1] proposed the fuzzy feature selection approach -fuzzy curves (FC) and
surfaces (FS) – for cotton leaves disease image feature selection. This research is done
in two steps .Firstly to automatically and quickly isolate a small set of significant
features from a set of original features according to their significance and to eliminate
spurious features they make use of FC. Secondly to isolate the features dependent on
the significant features, utilize FS. This approach is useful for practical classification
applications which reduce the dimensionality of the feature space. The feature
selection technique has faster execution speed and higher classification success rate
because it does not suffer from the local minima problems inherent in the nonlinear
modeling techniques typically used in forward selection and backward elimination.
Ajay A. Gurjar, Viraj A. Gulhane describes Eigen feature regularization and
extraction technique by this detection of three diseases can be done. This system is
having more accuracy, than that of the other feature detection techniques. With this
method about 90% of detection of Red spot i.e. fungal disease is detected [2].
Dheeb Al Bashish & et al. proposed image processing based work is consists of
the following main steps : In the first step the acquired images are segmented using
the K-means techniques and then secondly the segmented images are passed through
a pre-trained neural network .The images of leaves taken from AlGhor area in Jordan.
Five diseases that are prevalent in leaves were selected for this research; they are:
Early scorch, Cottony mold, Ashen mold, late scorch, tiny whiteness. The experimental
result indicates that the neural network classifier that is based on statistical
classification support accurate and automatic detection of leaf diseases with a
precision of around 93% [3].
In [4], diagnosis system for grape leaf diseases is proposed. The proposed
system is composed of three main parts: Firstly grape leaf color extraction from

Department of Electronics and Communication Engineering/NHCE Page 14


Automatic Leaf Disease Classifier

complex background, secondly grape leaf disease color extraction and finally grape
leaf disease classification. In this analysis back-propagation neural network with a
self-organizing feature map together is utilize to recognize colors of grape leaf.
Further MSOFM and GA deployed for grape leaf disease segmentation and SVM for
classification. Finally filtration of resulting segmented image is done by Gabor
Wavelet and then SVM is again applied to classify the types of grape leaf diseases.
This system can classify the grape leaf diseases into three classes: Scab disease, rust
disease and no disease. Even though there are some limitations of extracting
ambiguous color pixels from the background of the image. The system demonstrates
very promising performance for any agricultural product analysis.
In [5] “Extraction of the Rice leaf disease image based on BP neural network “
by Libo Liu & et al proposed a system for classifying the healthy and diseased part of
rice leaves using BP neural network as classifier. In this study rice brown spot was
select as a research object. The images of rice leaves were acquired from the
northern part of Ningxia Hui autonomous region. Here the color features of diseases
and healthy region were served as input values to BP neural network. The result
shows that this method is also suitable to identify the other diseases.
In [6], Tushar H Jaware & et al. developed a Fast and accurate method for
detection and classification of plant diseases. The proposed algorithm is tested on
main five diseases on the plants; they are: Early Scorch, Cottony mold, Ashen Mold,
Late scorch, tiny whiteness. Initially the RGB image is acquired then a color
transformation structure for the acquired RGB leaf image is created. After that color
values in RGB converted to the space specified in the color transformation structure.
In the next step, the segmentation is done by using Kmeans clustering technique.
After that the mostly green pixels are masked. Further the pixels with zero green, red
and blue values and the pixels on the boundaries of the infected object were
completely removed. Then the infected cluster was converted into HIS format from
RGB format. In the next step, for each pixel map of the image for only HIS images the
SGDM matrices were generated. Finally the extracted feature was recognized through
a pre-trained neural network. The results show that the proposed system can
successfully detect and classify the diseases with a precision between 83% and 94%.
P. Revathi M. Hemalatha detected Cotton leaf spot diseases in [7] by using

Department of Electronics and Communication Engineering/NHCE Page 15


Automatic Leaf Disease Classifier

Homogenous Segmentation based Edge Detection Techniques. This system is


analyzed with eight types of cotton leaf diseases they are Fusarium wilt, Verticillium
wilt,Root rot,Boll rot,Grey mildew ,Leaf blight ,Bacterial blight,Leaf curl.In these work
symptoms of cotton leaf spot images are captured by mobile and classification is done
by using neural network
In this work a homogeneity operator can take the difference of the center
pixel and a pixel that is two or three pixels away. The main aim Research work is to
use Homogeneity-based edge detector segmentation, which takes the result of any
edge detector and divides it by the average value of the area. This work has been
implemented in the real time software and produces best results. The software is very
fast and time intense, low cost, automatically identify the diseases and pest
recommendation to farmers through a mobile phone.
H. Muhammad Asraf and others has proposed, Support Vector Machine (SVM)
as classifier with three different kernels namely linear kernel, polynomial kernel with
soft margin and polynomial kernel with hard margin [8]. Initial results show that the
recognition of oil palm leaves is possible to be performed by SVM classifier. Based on
the best performance result, polynomial kernel with soft margin is capable of
classifying nutrient diseases accurately in the oil palm leaves with accuracy of 95% of
correct classification. Polynomial kernel with soft margin produces the best
performance in average of 95% correct classification as compared to the other types
of Kernel function.
In paper titled Pixel-Based Classification Method for Detecting Unhealthy
Regions in Leaf Images Satish Madhogaria & et al. implemented an automatic
pixelbased classification method for detecting unhealthy regions in leaf images [9].
This proposed system is composed of three main steps .In First step segmentation to
divide the image into foreground and background. In the second step, support vector
machine (SVM) is applied to predict the class of each pixel belonging to the
foreground. And finally, further refinement by neighborhood-check to omit all
falselyclassified pixels from second step. The results presented in this work are based
on a model plant (Arabidobsis thaliana), which forms the ideal basis for the usage of
the proposed algorithm in biological researches concerning plant disease control
mechanisms. The proposed method is compared to the existing method and it is

Department of Electronics and Communication Engineering/NHCE Page 16


Automatic Leaf Disease Classifier

concluded that higher accuracy can be achieved with this method.


Paper [10] presents a method to monitor four main wheat plant diseases:
Powdery Mildew, leaf rust Puccinia triticina, leaf blight, Puccinia striiformis. This
proposed system by Yuan Tian & et al make use of stacked structure to combine the
results obtained from three support vector machines (SVMs)-based classifiers. The
three features obtained are color feature, texture feature, and shape feature which
further used as training sets for three corresponding classifiers. This system is mainly
divided into three main steps: data acquisition, feature extraction, and classifier
design. Multiple Classifier System (MCS) includes number of classifiers which can
provide higher classification accuracy.

Department of Electronics and Communication Engineering/NHCE Page 17


Automatic Leaf Disease Classifier

Chapter-03
Requirement Specifications

3.1 Software Requirements


 Operating system : Windows 7/ Windows 10
 Coding Language : Python
 Software Tool : Anaconda Spyder
 Numpy
 Library : Keras

3.1.1 Why Python


Images define the world, each image has its own story, it contains a lot of crucial
information that can be useful in many ways. This information can be obtained with the
help of the technique known as Image Processing.

It is the core part of computer vision which plays a crucial role in many real-world examples
like robotics, self-driving cars, and object detection. Image processing allows us to transform
and manipulate thousands of images at a time and extract useful insights from them. It has
a wide range of applications in almost every field. 

Python is one of the widely used programming languages for this purpose. Its amazing
libraries and tools help in achieving the task of image processing very efficiently. 

Department of Electronics and Communication Engineering/NHCE Page 18


Automatic Leaf Disease Classifier

Fig 3.1 Applications of python

3.1.2 Keras

Keras is an open-source software library that provides a Python interface for artificial


neural networks. Keras acts as an interface for the TensorFlow library.

Keras contains numerous implementations of commonly used neural-network


building blocks such as layers, objectives, activation functions, optimizers, and a host of
tools to make working with image and text data easier to simplify the coding necessary for
writing deep neural network code. The code is hosted on GitHub, and community support
forums include the GitHub issues page, and a Slack channel.

In addition to standard neural networks, Keras has support


for convolutional and recurrent neural networks. It supports other common utility layers
like dropout, batch normalization, and pooling.

Keras allows users to productize deep models on smartphones (iOS and Android), on


the web, or on the Java Virtual Machine.  It also allows use of distributed training of deep-
learning models on clusters of Graphics processing units (GPU) and tensor processing units

Department of Electronics and Communication Engineering/NHCE Page 19


Automatic Leaf Disease Classifier

Fig 3.2 Why learn Keras

3.1.3 Numpy
With this library you can also perform simple image techniques, such as flipping
images, extracting features, and analyzing them. Images can be represented by numpy
multi-dimensional arrays and so their type is NdArrays. A color image is a numpy array with
3 dimensions. By slicing the multi-dimensional array the RGB channels can be separated. 

Below are some of the operations that can be performed using NumPy on the image (image
is loaded in a variable named test_img using imread).

 To flip the image in a vertical direction, use np.flipud(test_img).

 To flip the image in a horizontal direction, use np.fliplr(test_img).

 To reverse the image, use test_img[::-1]  (the image after storing it as the numpy
array is named as <img_name>).

 To add filter to the image you can do this: 

Department of Electronics and Communication Engineering/NHCE Page 20


Automatic Leaf Disease Classifier

Example: np.where(test_img > 150, 255, 0), this says that in this picture if you find
anything with 150, then replace it with 255, else 0.

 You can also display the RGB channels separately. It can be done using this code
snippet:
To obtain a red channel, do test_img[:,:,0], to obtain a green channel,
do test_img[:,:,1] and to obtain a blue channel, do test_img[:,:,2].

3.1.4 Anaconda Spyder


Spyder is a powerful scientific environment written in Python, for Python, and
designed by and for scientists, engineers and data analysts. It features a unique
combination of the advanced editing, analysis, debugging and profiling functionality
of a comprehensive development tool with the data exploration, interactive
execution, deep inspection and beautiful visualization capabilities of a scientific
package.n Furthermore, Spyder offers built-in integration with many popular
scientific packages, including NumPy, SciPy, Pandas, IPython, QtConsole, Matplotlib,
SymPy, and more.n Beyond its many built-in features, Spyder can be extended even
further via third-party plugins.n Spyder can also be used as a PyQt5 extension library,
allowing you to build upon its functionality and embed its components, such as the
interactive console or advanced editor, in your own software.

Anaconda distribution comes with over 250 packages automatically installed, and


over 7,500 additional open-source packages can be installed from PyPI as well as
the conda package and virtual environment manager. It also includes a
GUI, Anaconda Navigator, as a graphical alternative to the command line interface
(CLI).

3.5 Functional Requirements:


 The Software must be able to detect disease in leaf.
 It should be able to extract texture features of the leaves.
 It should display disease name

Department of Electronics and Communication Engineering/NHCE Page 21


Automatic Leaf Disease Classifier

3.6 Non Functional Requirements


 Detection of Disease must be accurate
 The detection process should be done effectively and efficiently
 The software should never fail in middle of the operation

Department of Electronics and Communication Engineering/NHCE Page 22


Automatic Leaf Disease Classifier

Chapter-04

Methodology

We can minimize the attack of pests by using appropriate pesticides and


remedies. We can decrease the size of the images by appropriate size reduction
techniques and see to it that the quality is not compromised to a great extent. We
can expand the projects of the earlier mentioned authors such that the appropriate
pesticide to the disease is also shown by the system. The main aim is to identify the
plant diseases using image processing. It also identifies the insects and pests
responsible for epidemic. It completes each of the process sequentially and hence
achieving each of the output.

Leaf miners are the insect family at larval stage. They feed between upper and
lower part of the leaf.

Leaf miner disease

Fig 4.1 Leaf damaged due to leaf miner insect

Due to insect on very much amount in plant, it is severely damaged. On a single


leaf the number of maggots can be six. Therefore, it can severely damage the leaf of
plant. It can restrict plant growth, leads to reduced yields.

Department of Electronics and Communication Engineering/NHCE Page 23


Automatic Leaf Disease Classifier

Fig 4.2 Image processing to detect the disease

Hence we can develop a robot, using image processing to detect the disease, to
classify it. This will avoid human interference and hence lead to précised
unprejudiced decision.

Generally, whatever our observation about the disease is just used for the
decision of the disease. A symptom of plant disease is a visible effect of disease on
the plant. Symptoms can be change in color, change in the shape or functional
changes of the plant as per its response to the pathogens, insects etc. Leaf wilting is a
characteristic symptom of verticilium wilt. It is caused due to the fungal plant
pathogens V. dahliaeand Verticillium albo-atrum. General common bacterial disease
symptoms are brown, necrotic lesions which get surrounded by a bright light yellow
halo at the edge of the leaf of the plant or at inner part of the leaf on the bean plants.
You are not actually seeing the disease pathogen, but rather a symptom that is being
caused by the pathogen.

Department of Electronics and Communication Engineering/NHCE Page 24


Automatic Leaf Disease Classifier

Fig 4.3 Flowchart of methodology

In order to build a machine leaning model it consists of two phase namely testing
and training phase were the model is first trained and an input is given to test the
model which is called the test data. The model consists of several image processing
steps such as image acquisition, image pre-processing,segmentation, feature
extraction and SVM classifier to classify the diseases.

4.1 Different phases in testing and training

The different processes are explained below :

Image acquisition:
The diseased leaf image is acquired using the camera, the image is
acquired from a certain uniform distance with sufficient lighting for learning and
classification. The sample images of the diseased leaves are collected and are

Department of Electronics and Communication Engineering/NHCE Page 25


Automatic Leaf Disease Classifier

used in training the system. To train and to test the system, diseased leaf images
and fewer healthy images are taken. The images will be stored in some standard
format.The image background should provide a proper contrast to the leaf color.
Leaf disease dataset is prepared with both black and white background, based
on the comparative study black background image provides better results and
hence it is used for the disease identification leaf.

Image pre-processing:

Image acquired using the digital camera is pre-processed using the noise
removal with averaging filter, color transformation and histogram equalization.
The color transformation step converts the RGB image to I (Hue, Saturation and
intensity) representation as this color space is based on human perception. Hue
refers to the dominant color attribute in the same way as perceived by a human
observer. Saturation refers to the amount of brightness or white light added to
the hue. Intensity refers to the amplitude of light. After the RGB to I conversion,
Hue part of the image is considered for the analysis as this provides only the
required information. S and I component are ignored as it does not give any
significant information.

Masking green pixels: Since most of the green colored pixels refer to the
healthy leaf and it does not add any value to the disease identification
techniques, the green pixels of the leaf are removed by a certain masking
technique, this method significantly reduces processing time. The masking of
green pixels is achieved by computing the intensity value of the green pixels, if
the intensity is less than a predefined threshold value, RGB component of that
particular pixel is assigned with a value of zero. The green pixel masking is an
optional step in our disease identification technique as the diseased part of the
leaf is able to be completely isolated in the segmentation process.

Department of Electronics and Communication Engineering/NHCE Page 26


Automatic Leaf Disease Classifier

Fig 4.4 Image pre-processing

Segmentation:

There are different image segmentation techniques like threshold based,


edge based, cluster based and neural network based. One of the most efficient
methods is the clustering method which again has multiple subtypes, kmeans
clustering, Fuzzy C-means clustering, subtractive clustering method etc. One of
most used clustering algorithm is k- means clustering. K-means clustering is
simple and computationally faster than other clustering techniques and it also
works for large number of variables. But it produces different cluster result for
different number of number of cluster and different initial centroid values. So it
is required to initialize the proper number of number of cluster k and proper
initial centroid.K-means is an general purpose methods that is being used at
many domains to different problems.
In this project, k-means is a clustering method used to get the clusters of k
numbers which matches the specified characters like to segment the leaf.

Feature Extraction:

From the input images, the features are to be extracted. To do so, instead
of choosing the whole set of pixels we can choose only which are necessary and
sufficient to describe the whole of the segment. The segmented image is first
selected by manual interference. The affected area of the image can be found
from calculating the area connecting the components. First, the connected

Department of Electronics and Communication Engineering/NHCE Page 27


Automatic Leaf Disease Classifier

components with 6 neighborhood pixels are found. Later the basic region
properties of the input binary image are found. The interest here is only with the
area. The affected area is found out. The percent area covered in this segment
says about the quality of the result. The histogram of an entity or image provides
information about the frequency of occurrence of certain value in the whole of
the data/image. It is an important tool for frequency analysis. The co-occurrence
takes this analysis to next level wherein the intensity occurrences of two pixels
together are noted in the matrix, making the co-occurrence a tremendous tool
for analysis. From gray-co-matrix, the features such as Contrast, Correlation,
Energy, Homogeneity' are extracted. The following table lists the formulas of the
features.

4.2 Detailed Explanation:

4.2.1 Python
Python coding language is a very easy to learn and at the same time powerful
programming language. It has efficient high-level data structures and a simple but
effective approach to object-oriented programming. Python’s elegant syntax and
dynamic typing, together with its interpreted nature, make it an apt language for
scripting and rapid application development in many areas on most platforms. The
Python interpreter is easily extended with new functions and data types
implemented in C or C++ (or other languages callable from C). Python is also suitable
as an extension language for customizable applications.

4.2.2 Numpy
Python is slower compared to other languages like C/C++. But another significant
feature of Python is that it can be easily extended with C/C++. This feature helps us to
write computationally intensive codes in C/C++ and create a Python wrapper for it so
that we can use these wrappers as Python modules. This gives us two benefits : first,
our code is as rapid as original C/C++ code (since it is the actual C++ code working in
background) and second, it is a cake walk to code in Python. This is how OpenCV-

Department of Electronics and Communication Engineering/NHCE Page 28


Automatic Leaf Disease Classifier

Python works, it is a Python wrapper around original C++ implementation. And the
support of Numpy makes the task more easier. Numpy is a highly optimized library
for numerical operations. It gives a MATLAB style syntax. All the OpenCV array
structures are modified to-and-from Numpy arrays. So whichever operations you can
do in Numpy, you can combine it with OpenCV, which multiplies number of weapons
in your arsenal. Along with that, several other libraries like SciPy, Matplotlib which
supports Numpy can be used with this. So OpenCV-Python is an apt tool for fast
prototyping of computer vision problems.

4.3 Image Processing


Images define the Universe. Each image has its own meaning, it contains a lot of
important information that can be useful in many ways. These informations can
be obtained with the help of a technique called Image Processing.
As the name suggests, image processing means processing the image and this may
indulge many various technologies until we reach our goal.

The end result can be either in the form of an image or a corresponding feature of
that image. This can be used for further analysis and decision making.

An image can be denoted as a 2D function F(x,y) where x and y are spatial


coordinates. The amplitude of F at a particular value of x,y is known as the intensity of
an image at that point. If x,y, and the amplitude value is finite then we call it a digital
image. It is an array of pixels arranged in columns and rows. Pixels are the core
elements of an image that contain information about intensity and color. An image
can also be denoted in 3D where x,y, and z are the spatial coordinates. Pixels are
arranged in the form of a matrix. This is known as an RGB image.

Department of Electronics and Communication Engineering/NHCE Page 29


Automatic Leaf Disease Classifier

Fig 4.5 How image is classified as pixels Fig 4.6 RGB image representation

4.3.1 Different image processing algorithms

4.3.1.1 Morphological Image Processing

Morphological image processing aims to neutralize the imperfections from the


binary images because binary regions produced by simple thresholding can be disturbed by
noise. It also tries to smoothen the image using opening and closing operations.

Morphological operations can be extended to grey scale images. It consists of non-


linear operations related to the structure of features of an image. It depends on the related
ordering of pixels but on their numerical values. This technique analyzes an image using a
small template known as structuring element which is placed on different possible locations
in the image and is compared with the corresponding neighbourhood pixels. A structuring
element is a small matrix with 0 and 1 values.

Let’s see the two fundamental operations of morphological image processing, Dilation and
Erosion:

 dilation operation adds pixels to the boundaries of the object in an image

Department of Electronics and Communication Engineering/NHCE Page 30


Automatic Leaf Disease Classifier

 erosion operation removes the pixels from the object boundaries. 


The number of pixels removed or added to the original image depends on the size of the
structuring element. 

At this point you may be thinking “what is a structuring element?” Let me explain:

Structuring element is a matrix consisting of only 0’s and 1’s that can have any
arbitrary shape and size. It is positioned at all possible locations in the image and it is
compared with the corresponding neighbourhood of pixels.

Fig 4.7 Probing of an image with a structuring element

The square structuring element ‘A’ fits in the object we want to select, the ‘B’
intersects the object and ‘C’ is out of the object.

The zero-one pattern defines the configuration of the structuring element. It’s
according to the shape of the object we want to select. The center of the structuring
element identifies the pixel being processed.

Department of Electronics and Communication Engineering/NHCE Page 31


Automatic Leaf Disease Classifier

Fig 4.8 Examples of simple structuring elements

Fig 4.9 Dilation

Fig 4.10 Erosion

4.3.1.2 Gaussian Image Processing

Gaussian blur which is also known as gaussian smoothing, is the result of blurring
an image by a Gaussian function.

Department of Electronics and Communication Engineering/NHCE Page 32


Automatic Leaf Disease Classifier

It is used to reduce image noise and reduce details. The visual effect of this blurring
technique is similar to looking at an image through the translucent screen. It is sometimes
used in computer vision for image enhancement at different scales or as a data
augmentation technique in deep learning.

The basic gaussian function looks like:

In practice, it is best to take advantage of the Gaussian blur’s separable property by


dividing the process into two passes. In the first pass, a one-dimensional kernel is used to
blur the image in only the horizontal or vertical direction. In the second pass, the same one-
dimensional kernel is used to blur in the remaining direction. The resulting effect is the same
as convolving with a two-dimensional kernel in a single pass. Let’s see an example to
understand what gaussian filters do to an image.

If we have a filter which is normally distributed, and when its applied to an image,
the results look like this:

Original Filter Result


Fig 4.11 Gaussian Image processing

Department of Electronics and Communication Engineering/NHCE Page 33


Automatic Leaf Disease Classifier

You can see that some of the edges have little less detail. The filter is giving more
weight to the pixels at the center than the pixels away from the center. Gaussian filters are
low-pass filters i.e. weakens the high frequencies. It is commonly used in edge detection.

4.3.1.3 Fourier Transform in image processing

Fourier transform breaks down an image into sine and cosine components. 

It has multiple applications like image reconstruction, image compression, or image


filtering. 

Since we are talking about images, we will take discrete fourier transform into
consideration.

Let’s consider a sinusoid, it comprises of three things:

 Magnitude – related to contrast 

 Spatial frequency – related to brightness

 Phase – related to color information

The formula for 2D discrete fourier transform is:

In the above formula, f(x,y) denotes the image.

The inverse fourier transform converts the transform back to image. The formula for
2D inverse discrete fourier transform is:

Department of Electronics and Communication Engineering/NHCE Page 34


Automatic Leaf Disease Classifier

4.3.1.4 Edge Detection in image processing

Edge detection is an image processing technique for finding the boundaries of


objects within images. It works by detecting discontinuities in brightness.

This could be very beneficial in extracting useful information from the image because
most of the shape information is enclosed in the edges. Classic edge detection methods
work by detecting discontinuities in the brightness. 

It can rapidly react if some noise is detected in the image while detecting the
variations of grey levels. Edges are defined as the local maxima of the gradient. 

The most common edge detection algorithm is sobel edge detection algorithm.
Sobel detection operator is made up of 3*3 convolutional kernels. A simple kernel Gx and a
90 degree rotated kernel Gy. Separate measurements are made by applying both the kernel
separately to the image.

And,

 * denotes the 2D signal processing convolution operation.

Resulting gradient can be calculated as:

Department of Electronics and Communication Engineering/NHCE Page 35


Automatic Leaf Disease Classifier

Fig 4.12 Edge detection in image processing

4.3.1.5 Wavelet Image Processing

We saw a Fourier transform but it is only limited to the frequency. Wavelets take
both time and frequency into the consideration. This transform is apt for non-stationary
signals. 

We know that edges are one of the important parts of the image, while applying the
traditional filters it’s been noticed that noise gets removed but image gets blurry. The
wavelet transform is designed in such a way that we get good frequency resolution for low
frequency components. Below is the 2D wavelet transform example:

Fig 4.13 Wavelet image processing

Department of Electronics and Communication Engineering/NHCE Page 36


Automatic Leaf Disease Classifier

4.4 Image processing using Neural Networks

Neural Networks are multi-layered networks consisting of neurons or nodes. These


neurons are the core processing units of the neural network. They are designed to act like
human brains. They take in data, train themselves to recognize the patterns in the data and
then predict the output.

A basic neural network has three layers:

 Input layer
 Hidden layer
 Output layer

Fig 4.14 Basic neural network


The input layers receive the input, the output layer predicts the output and the
hidden layers do most of the calculations. The number of hidden layers can be modified
according to the requirements. There should be atleast one hidden layer in a neural
network.

The basic working of the neural network is as follows:

Department of Electronics and Communication Engineering/NHCE Page 37


Automatic Leaf Disease Classifier

 Let’s consider an image, each pixel is fed as input to each neuron of the first layer,
neurons of one layer are connected to neurons of the next layer through channels. 
 Each of these channels is assigned a numerical value known as weight. 
 The inputs are multiplied by the corresponding weights and this weighted sum is
then fed as input to the hidden layers. 
 The output from the hidden layers is passed through an activation function which
will determine whether the particular neuron will be activated or not. 
 The activated neurons transmits data to the next hidden layers. In this manner, data
is propagated through the network, this is known as Forward Propagation. 
 In the output layer, the neuron with the highest value predicts the output. These
outputs are the probability values.
 The predicted output is compared with the actual output to obtain the error. This
information is then transferred back through the network, the process is known as
Back propagation.
 Based on this information, the weights are adjusted. This cycle of forward and
backward propagation is done several times on multiple inputs until the network
predicts the output correctly in most of the cases.
 This ends the training process of the neural network. The time taken to train the
neural network may get high in some cases.
 In the below image, ai’s is the set of inputs, wi’s are the weights, z is the output
and g is any activation function.

Department of Electronics and Communication Engineering/NHCE Page 38


Automatic Leaf Disease Classifier

Fig 4.15 Operations in a single neuron

Here are some guidelines to prepare data for image processing. 

 More data needs to be fed to the model to get the better results.
 Image dataset should be of high quality to get more clear information, but to process
them you may require deeper neural networks.
 In many cases RGB images are converted to grayscale before feeding them into a neural
network.

Department of Electronics and Communication Engineering/NHCE Page 39


Automatic Leaf Disease Classifier

Chapter-05

Testing

For the testing of our project, we had collected many pictures of many varieties of
leaves out of which we collected the pictures of leaves affected by diseases also. All these
were collected and a dataset was created and kept.

For the testing, first the image of any leaf is selected from the collected dataset.
Then by running the code the process of image acquisition, image pre-processing, image
segmentation, feature extraction such as colour, texture, size is done and is compared with
the trained dataset.

Based on the comparison the appropriate disease is detected and displayed on the
screen. So, this is the testing phase of the project.

Fig 5.1 Few images of the dataset

Department of Electronics and Communication Engineering/NHCE Page 40


Automatic Leaf Disease Classifier

Fig 5.2 Few images of the dataset

Fig 5.3 Folders of the dataset collected and stored in laptop

Department of Electronics and Communication Engineering/NHCE Page 41


Automatic Leaf Disease Classifier

5.1 Most common types of leaf diseases

Some of the most commonly affected diseases in the crops of India are:
5.1.1 Black Spot:
Symptoms of Black spots are:
i) The yellowish color on leaf
ii) Drop of Leaf in premature stage
iii) Decline in growth of leaf

Fig 5.4 Black spot disease


5.1.2 LEAF SPOT
Spots on the leaf are generally brown but depending on the type of fungus spots
colour may vary concentric rings and dark circles may find

Fig 5.5 Leaf spot disease


5.1.3 Rust
Symptoms of rust disease are:
Defoliation of leaves of plants
i) Rust is generally brownish-yellow colour
ii) Dieback of branches
iii) Stunted growth of plant

Department of Electronics and Communication Engineering/NHCE Page 42


Automatic Leaf Disease Classifier

Fig 5.6 Rust Disease on leaves

5.1.4 POWDERY MILDEW


This disease throws the needed nutrients away from
the plants. Symptoms of POWDERY MILDEW are:
i) White or grey layer on leaf and stem of plant
ii) Yellowing of leaf
iii) Premature leaf withering

Fig 5.7 Powdery Mildew disease

5.1.5 BOTRYTIS BLIGHT


This type of disease is mainly caused by fungi.
Symptoms of BOTRYTIS BLIGHT are:
i) Brown colour dots on leaf
ii) Withering of buds from plant

Department of Electronics and Communication Engineering/NHCE Page 43


Automatic Leaf Disease Classifier

Fig 5.8 Botrytis Blight

Department of Electronics and Communication Engineering/NHCE Page 44


Automatic Leaf Disease Classifier

Chapter-06

Results

After the code is executed, an image of the leaf is selected and tested. Upon testing,
predictions were very accurate and were detecting the diseases also correctly.

Few of the results were:

Fig 6.1 Picture of a healthy corn leaf Fig 6.2 Picture of a diseased corn leaf

In the above picture we can see that, after running the code and selecting the
picture of any leaf from the dataset stored in the laptop, it displays the appropriate disease
that the leaf is affected with. If the leaf is not affected by any disease then it will display that
the leaf is a healthy one. Fig 6.1 shows the image of the result of running the code by
selecting a leaf and it shows that the leaf is healthy which means the leaf is not infected by
any disease. Fig 6.2 shows the image of the result that the corn leaf is affected by a disease
called northern leaf blight.

Department of Electronics and Communication Engineering/NHCE Page 45


Automatic Leaf Disease Classifier

Fig 6.3 Picture of a healthy potato leaf Fig 6.4 Picture of a diseased potato leaf

In the above image we can see the screenshot of the result of leaf detection of a potato leaf
done by our leaf disease classifier. Fig 6.3 shows the result of testing a potato leaf and the
output shows that it is a healthy leaf. Fig 6.4 shows the result of testing a potato leaf that it
is affected by a disease called early blight.

Fig 6.5 Picture of a healthy tomato leaf Fig 6.6 Picture of a diseased tomato leaf

Department of Electronics and Communication Engineering/NHCE Page 46


Automatic Leaf Disease Classifier

In the above image we can see the screenshot of the result of leaf detection of a tomato leaf
done by our leaf disease classifier. Fig 6.5 shows the result of testing a tomato leaf and the
output shows that it is a healthy leaf. Fig 6.6 shows the result of testing a tomato leaf that it
is affected by a disease called tomato yellow leaf curl virus.

Department of Electronics and Communication Engineering/NHCE Page 47


Automatic Leaf Disease Classifier

Chapter-07
Conclusion
Our project explains the survey on different diseases classification techniques used for plant
leaf disease detection and an algorithm for image segmentation technique that can be used
for automatic detection as well as classification of plant leaf diseases later. Banana, beans,
jackfruit, lemon, mango, potato, tomato, and sapota are some of those ten species on which
proposed algorithm is tested. Therefore, related diseases for these plants were taken for
identification. With very less computational efforts the optimum results were obtained,
which also shows the efficiency of proposed algorithm in recognition and classification of
the leaf diseases. Another advantage of using this method is that the plant diseases can be
identified at early stage or the initial stage. The images are fed to our application for the
identification of diseases. It provides a good choice for agriculture community particularly in
remote villages. It acts as an efficient system in terms of reducing clustering time and the
area of infected region. Feature extraction technique helps to extract the infected leaf and
also to classify the plant diseases. The embedded voice navigation system helps to guide us
throughout the process. To improve recognition rate in classification process Artificial
Neural Network, Bayes classifier, Fuzzy Logic and hybrid algorithms can also be used.

Department of Electronics and Communication Engineering/NHCE Page 48


Automatic Leaf Disease Classifier

Chapter-08

Future Scope
In this project, we had demonstrated only a few diseases that were very commonly caused
in plants. So, it can be extended to more diseases in the future. Here the disease is only
detected, but in future we can develop a robot to automatically detect and sent to spray the
appropriate pesticide without human interaction. These robots can also check the quality of
the soil if it is capable of growing that particular crop also. The project can be enhanced to
develop the open multimedia (Audio/Video) about the disease and their solutions once the
disease is detected.

Department of Electronics and Communication Engineering/NHCE Page 49


Automatic Leaf Disease Classifier

Chapter-09

Appendix
Program Code :

# Building CNN based on AlexNet Architecture

# Importing Keras libraries and packages

from keras.models import Sequential

from keras.layers import Convolution2D, MaxPooling2D, Flatten, Dense, Dropout

from keras.layers.normalization import BatchNormalization

from keras import optimizers

from keras.preprocessing.image import ImageDataGenerator

from keras.callbacks import ModelCheckpoint

# Initializing the CNN

classifier = Sequential()

# Convolution Step 1

classifier.add(Convolution2D(96, 11, strides = (4, 4), padding = 'valid', input_shape=(224,


224, 3), activation = 'relu'))

# Max Pooling Step 1

Department of Electronics and Communication Engineering/NHCE Page 50


Automatic Leaf Disease Classifier

classifier.add(MaxPooling2D(pool_size = (2, 2), strides = (2, 2), padding = 'valid'))

classifier.add(BatchNormalization())

# Convolution Step 2

classifier.add(Convolution2D(256, 11, strides = (1, 1), padding='valid', activation = 'relu'))

# Max Pooling Step 2

classifier.add(MaxPooling2D(pool_size = (2, 2), strides = (2, 2), padding='valid'))

classifier.add(BatchNormalization())

# Convolution Step 3

classifier.add(Convolution2D(384, 3, strides = (1, 1), padding='valid', activation = 'relu'))

classifier.add(BatchNormalization())

# Convolution Step 4

classifier.add(Convolution2D(384, 3, strides = (1, 1), padding='valid', activation = 'relu'))

classifier.add(BatchNormalization())

# Convolution Step 5

classifier.add(Convolution2D(256, 3, strides=(1,1), padding='valid', activation = 'relu'))

# Max Pooling Step 3

Department of Electronics and Communication Engineering/NHCE Page 51


Automatic Leaf Disease Classifier

classifier.add(MaxPooling2D(pool_size = (2, 2), strides = (2, 2), padding = 'valid'))

classifier.add(BatchNormalization())

# Flattening Step

classifier.add(Flatten())

# Full Connection Step

classifier.add(Dense(units = 4096, activation = 'relu'))

classifier.add(Dropout(0.4))

classifier.add(BatchNormalization())

classifier.add(Dense(units = 4096, activation = 'relu'))

classifier.add(Dropout(0.4))

classifier.add(BatchNormalization())

classifier.add(Dense(units = 1000, activation = 'relu'))

classifier.add(Dropout(0.2))

classifier.add(BatchNormalization())

classifier.add(Dense(units = 3, activation = 'softmax'))

classifier.summary()

# Compiling the CNN

# classifier.compile(optimizer='adam',

Department of Electronics and Communication Engineering/NHCE Page 52


Automatic Leaf Disease Classifier

# loss='categorical_crossentropy',

# metrics=['accuracy'])

# Compiling the CNN

classifier.compile(optimizer=optimizers.SGD(lr=0.001, momentum=0.9, decay=0.005),

loss='categorical_crossentropy',

metrics=['accuracy'])

# image preprocessing

train_datagen = ImageDataGenerator(rescale=1./255,

shear_range=0.2,

zoom_range=0.2,

width_shift_range=0.2,

height_shift_range=0.2,

rotation_range=40,

horizontal_flip=True,

fill_mode='nearest')

test_datagen = ImageDataGenerator(rescale=1./255)

batch_size = 32

Department of Electronics and Communication Engineering/NHCE Page 53


Automatic Leaf Disease Classifier

train_data_dir = "" # directory of training data

test_data_dir = "" # directory of test data

training_set = train_datagen.flow_from_directory(train_data_dir,

target_size=(224, 224),

batch_size=batch_size,

class_mode='categorical')

test_set = test_datagen.flow_from_directory(test_data_dir,

target_size=(224, 224),

batch_size=batch_size,

class_mode='categorical')

print(training_set.class_indices)

# # checkpoint

# weightpath = "weights_1.hdf5"

# checkpoint = ModelCheckpoint(weightpath, monitor='val_acc', verbose=1,


save_best_only=True, mode='max')

# callbacks_list = [checkpoint]

# #fitting images to CNN

# history = classifier.fit_generator(training_set,

# steps_per_epoch=training_set.samples//batch_size,

Department of Electronics and Communication Engineering/NHCE Page 54


Automatic Leaf Disease Classifier

# validation_data=test_set,

# epochs=50,

# validation_steps=test_set.samples//batch_size,

# callbacks=callbacks_list)

#fitting images to CNN

history = classifier.fit_generator(training_set,

steps_per_epoch=training_set.samples//batch_size,

validation_data=test_set,

epochs=50,

validation_steps=test_set.samples//batch_size)

#saving model

filepath="model.hdf5"

classifier.save(filepath)

#plotting training values

import matplotlib.pyplot as plt

import seaborn as sns

sns.set()

acc = history.history['acc']

Department of Electronics and Communication Engineering/NHCE Page 55


Automatic Leaf Disease Classifier

val_acc = history.history['val_acc']

loss = history.history['loss']

val_loss = history.history['val_loss']

epochs = range(1, len(loss) + 1)

#accuracy plot

plt.plot(epochs, acc, color='green', label='Training Accuracy')

plt.plot(epochs, val_acc, color='blue', label='Validation Accuracy')

plt.title('Training and Validation Accuracy')

plt.ylabel('Accuracy')

plt.xlabel('Epoch')

plt.legend(['Train', 'Test'], loc='upper left')

Department of Electronics and Communication Engineering/NHCE Page 56


Automatic Leaf Disease Classifier

Chapter-10

References
[1] Yan Cheng Zhang, Han Ping Mao, Bo Hu, Ming Xili ,“features selection of Cotton disease
leaves image based on fuzzy feature selection techniques”, IEEE Proceedings of the 2007
International Conference on Wavelet Analysis and Pattern Recognition, Beijing, China, 2-4
Nov. 2007.
[2] Ajay A. Gurjar, Viraj A. Gulhane,” Disease Detection On Cotton Leaves by Eigenfeature
Regularization and Extraction Technique”, International Journal of Electronics,
Communication & Soft Computing Science and Engineering(IJECSCSE)Volume 1, Issue 1
[3] Dheeb Al Bashish, Malik Braik, and Sulieman Bani-Ahmad ,”A Framework for Detection
and Classification of Plant Leaf and Stem Diseases”, 2010 International Conference on Signal
and Image Processing.
[4] A.Meunkaewjinda, P. Kumsawat, K. Attakitmongcol and Sri kaew,”Grape leaf disease
detection from color imagery using hybrid intelligent system”,proceedings of ECTICON 2008.
[5] Libo Liu,Guomin Zhou,”Extraction of the Rice Leaf Disease Image Based on BP Neural
Network”,2009 IEEE.
[6] Tushar H Jaware, Ravindra D Badgujar and Prashant G Patil,” Crop disease detection
using image segmentation”, Proceedings of "Conference on Advances in Communication
and Computing (NCACC'12)”, April 21, 2012.
[7] P. Revathi M. Hemalatha,” Homogenous Segmentation based Edge Detection Techniques
for Proficient Identification of the Cotton Leaf Spot Diseases”, International Journal of
Computer Applications (0975 – 888)Volume 47– No.2, June 2012.
[8] H. Muhammad Asraf, M. T. Nooritawati, M.S.B. Shah Rizam,” A Comparative Study in
Kernel-Based Support Vector Machine of Oil”, Procedia Engineering 41 ( 2012 ) 1353 – 1359
[9] Satish Madhogaria, Marek Schikora, Wolfgang Koch, Daniel Cremers,” Pixel-Based
Classification Method for Detecting Unhealthy Regions in Leaf Images”, Informatik 2011 -
Informatik schafft Communities 41. Jahrestagung der Gesellschaft für Informatik , 4.-
7.10.2011, Berlin

Department of Electronics and Communication Engineering/NHCE Page 57


Automatic Leaf Disease Classifier

[10] Yuan Tian, Chunjiang Zhao,Shenglian Lu,and Xinyu Guo,”SVM- based Multiple Classifier
System for Recognition of Wheat Leaf Diseases”, Proceedings of 2010 Conference on
Dependable Computing (CDC’2010) November 20-22, 2010, Yichang, China.
[11] Sachin D. Khirade, A. B. Patil, “Plant Disease detection using Image Processing”, 2015
International Conference on Computing Communication Control and Automation.
[12] Prathibha S R1, Anupama Hongal 2, Jyothi M P3, “IOT based monitoring system in smart
agriculture”, 2017 International Conference on Recent Advances in Electronics and
Communication Technology.
[13] K.Lokesh Krishna, Omayo Silver, Wasswa Fahad Malende, K.Anuradha, “Internet of
Things application for Implementation of Smart Agriculture System”, International
conference on I-SMAC (IoT in Social, Mobile, Analytics and Cloud) (I-SMAC 2017).
[14] John A. Stankovic, Life Fellow, IEEE “Research Directions for the Internet of Things”,
IEEE Internet of Things Journal ( Volume: 1, Issue: 1, Feb. 2014 ).
[15] Lin xuefeng, Wu Shengliang, “Study on ntegrated development of modern agriculture
evaluation”, Business Management and Electronic Information (BMEI), 2011 International
Conference on 13-15 May 2011, Guangzhou, China.
[16] Jobin Francis, Anto Sahaya Dhas D, Anoop B K, “Identification of leaf diseases in pepper
plants using soft computing techniques”, Emerging Devices and Smart Systems (ICEDSS),
Conference on, 4-5 March 2016, Namakkal, India.
[17] Priyanka Soni, Rekha Chahar, “A Segmentation Improved Robust PNN Model for
Disease Identification in Different Leaf Images”, IEEE International Conference on
PowerElectronics, Intelligent Control and Energy Systems (ICPEICES-2016).
[18] R.P.Narmadha, G.Arulvadivu, “Detection And Measurement of Paddy Leaf Disease
Symptoms using Image Processing”, 2017 International Conference on Computer
Communication and Informatics (ICCCI - 2017), Jan. 05 – 07, 2017, Coimbatore, INDIA.

Department of Electronics and Communication Engineering/NHCE Page 58

You might also like