Sohai Arif
Sohai Arif
Sohai Arif
Submitted by
S. SOHAIL ARIF
(14011P0414)
Dr.L.Pratap Reddy
Professor
i
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
JNTUH College of Engineering
Hyderabad-500085
This is to certify that the dissertation work entitled "PLANT DISEASE DETECTION
USING CONVOLUTIONAL NEURAL NETWORKS", is being submitted by Mr.
S.SOHAIL ARIF bearing Roll No. 14011P0414 in partial fulfillment of the requirements for
the award of the Degree of MASTER OF TECHNOLOGY (IDP) in ELECTRONICS AND
COMMUNICATION ENGINEERING with specialization in “COMMUNICATIONS &
SIGNAL PROCESSING” from JNTUH-CEH (Autonomous) is a bona fide record of project
work carried out during the academic year 2018-19 under my guidance and supervision.
Project Supervisor
Dr.L.Pratap Reddy
Professor of ECE Department
JNTUH-College of Engineering
Hyderabad- 500085
ii
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
JNTUH College of Engineering
Hyderabad-500085
This is to certify that the dissertation work entitled "PLANT DISEASE DETECTION
USING CONVOLUTIONAL NEURAL NETWORKS", is being submitted by Mr.
S.SOHAIL ARIF bearing Roll No. 14011P0414 in partial fulfillment of the requirements for
the award of the Degree of MASTER OF TECHNOLOGY (IDP) in ELECTRONICS AND
COMMUNICATION ENGINEERING with specialization in “COMMUNICATIONS &
SIGNAL PROCESSING” from JNTUH-CEH (Autonomous) is a bona fide record of project
work carried out during the academic year 2018-19 .
iii
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
JNTUH College of Engineering
Hyderabad-500 085
S.SOHAIL ARIF
(14011P0414)
iv
ACKNOWLEDGMENT
It is my great fortune to have had the opportunity to work on this exciting and inspiring project
in this organization. The learning and experience I received here is of inexplicable value to me.
It gives me immense pleasure to express my paramount gratitude to each one of those who
made this possible.
Special thanks to express my gratitude towards Dr. K. Anitha Sheela, Professor & Head,
Department of ECE and also to our faculty and staff of department who directly or indirectly
helped me for the successful completion of this Project.
I am also highly indebted to my parents, friends and classmates who have extended their help
and co-operation during the execution of the project.
Regards
S.SOHAIL ARIF
(14011P0414)
ABSTRACT
I
CONTENTS
ABSTRACT I
LIST OF TABLES IV
CHAPTER 1: INTRODUCTION
1.1 Introduction 1
1.2 Background 3
2.1 Introduction 5
2.2 Data analysis 6
2.3 Proposed Models 6
CHAPTER 3: METHODOLOGY
3.1 Introduction 14
3.2 Proposed Methodology 14
3.3 Plant Diseases-A brief Introduction 17
3.4 Software Description 19
3.5 Convolutional Neural Networks 24
CHAPTER 5: CONCLUSION 42
REFERENCES 43
APPENDIX 1 44
II
LIST OF FIGURES
III
LIST OF TABLES
IV
CHAPTER 1
INTRODUCTION
1.1 Introduction
Agriculture has remained as a centrepiece of Indian economy. Though it is a main source of
livelihood for a majority of Indian population, it still stands as a technologically backward
sector. Despite its importance to the economy, little has been done to revive the sector. From
production challenges to financing inefficiencies, Indian agriculture is plagued by several
issues. Improper farm equipments, low access to fairly priced formal credit, distribution
challenges due to intermediaries between farm and fork are some of the challenges facing by
Indian farmers. Farmers are the sole risk bearers of all these challenges that arise in the farming
cycle. Be it lack of quality tools, erratic monsoons or pest outbreaks, farmers have to face it all
without any risk mitigation among other stakeholders.
Economy of a nation depends in Agricultural productivity. This is the one of the main reasons
that disease detection in plants plays a vital role in agriculture field,
as having disease in plants are quite natural. If proper care is not taken then it
causes serious effects on crops and due to which respective product quality, quantity or
productivity is affected.
Future crop disease management should aim to strengthen our food security, while
simultaneously safeguarding the health of associated ecosystems and reducing over
dependence on natural resources. For achieving these multiple functionalities, sustainable
plant disease management should take place and more importance for rational adaptation of
resistance, avoidance, elimination and remediation strategies.
1
The problem of efficient plant disease protection is closely related to the problems of
sustainable agriculture Inexperienced pesticide usage can cause the development of long-term
resistance of the pathogens, severely reducing the ability to fight back. Timely and accurate
diagnosis of plant diseases is one of the vital pillars of precision agriculture. It is crucial to
prevent unnecessary waste of financial and other resources, thus achieving healthier production
in this changing environment, appropriate and timely disease identification including early
prevention has never been more important. There are several ways to detect plant pathologies.
Some diseases do not have any visible symptoms, or the effect is noticeable when it’s too late
to act, and in those situations, a sophisticated analysis is obligatory. However, most diseases
generate some kind of manifestation in the visible spectrum, so the naked eye examination of
a trained professional is the prime technique adopted in practice for plant disease detection.
Visually observable patterns are difficult to decipher at a single glance, leading to many farmers
making inaccurate assumptions regarding the disease. Hence, prevention mechanisms taken by
the farmers are ineffective and sometimes harmful. Farmers usually come together and
implement common disease prevention mechanisms, as they lack expert advice on how to deal
with their crop infestation. There has been circumstances where due to inadequate knowledge
or misinterpretation regarding the intensity of the disease, over-dosage or under-dosage of the
pesticide has resulted in crop damage. This is the underlying motivation for the proposed
methodology that aims to accurately detect and classify diseases in the tomato crop.
Experts who can study and provide diagnosis for plant diseases are not easily available in all
parts of the country, especially in the rural regions where even basic amenities are hard to be
found. Thus, a need of an automated system has arisen which can perform the operations of
plant disease identification and provides efficient solutions, all by itself. Proper solutions
include precise diagnosis, providing information about the correct fertilizers and pesticides,
and information about the cost involved.
In recent times, server based and mobile based approach for disease identification has been
employed for disease identification. Several factors of these technologies being high resolution
camera, high performance processing and extensive built in accessories are the added
advantages resulting in automatic disease recognition. Modern approaches such as machine
learning and deep learning algorithm has been employed to increase the recognition rate and
the accuracy of the results. Various researches have taken place under the field of machine
learning for plant disease detection and diagnosis, such traditional machine learning approach
2
being random forest, artificial neural network, support vector machine(SVM), fuzzy logic, K-
means method, Convolutional neural networks etc.…
Advances in computer vision present an opportunity to expand and enhance the practice of
precise plant protection and extend the market of computer vision applications in the field of
precision agriculture.
The method described in this model is a new approach in detecting plant diseases using the
deep convolutional neural network trained and fine-tuned to fit accurately to the database of
plant leaves gathered independently for variety of plant diseases. The novelty of the developed
model lies in its simplicity, this model distinguishes between diseased leaves and healthy ones
or from the environment by using deep CNN.
CNNs use relatively little pre-processing compared to other image classification algorithm’s.
This means that the network learns through the filters that are present in traditional algorithms.
This independence from prior knowledge and human effort in feature design is a major
advantage. The efficacy of convolutional Neural Networks in image recognition is one of the
main reasons why the world has woken up to the efficacy of deep learning. They are powering
major advances in computer vision (CV), which has obvious applications for Image
Classification.
1.2 Background:
The main aim of this project is to provide an information support system to the farmers, While
aiming at a solution, a field study is conducted to understand the actual situation. To acquire
field level data from various aspects of farming which could possibly affect the outcome of the
specific approach adopted. The villages of Marrigudem and Allumdevicheruvu are identified
to collect data from the farmers.
The proposed work started off with understanding the problems properly, in order to gain the
insights of every nuance that must be taken care of, while providing any solution. So, instead
3
of directly trying to give a solution to the problems faced by the farmers are by doing the field
study in Marrigudem and Allumdevicheruvu.
The approach was to know every issue related to farming, think about a possible model that
could handle almost every issue and determine a point where actually technology can intervene.
The data analysis so performed helped to determine these issues. The issues that were mainly
identified are Lack of proper education and awareness (about government schemes, apps,
channels etc, new technologies), Lack of manpower, Harmful effects of pesticides, Difficulty
in monitoring motor and crops, Losses due to weeds, pests, insects, animals etc and Difficulties
in availing financial aid from banks (like loans).
Intervention of technology will help a lot in agriculture. Technolpogy has increased to such
heights that now it is being used even in the field like agriculture. It is not only reducing the
farmers’ time and efforts but also moving towards complete automation, in some parts of the
world. India being an agriculture dominant country is still not developed in terms of
agricultural technology. The methods used in the present day are indeed no different from that
of the past. This mainly persuaded us to work in this sector.
Plant Diseases are a major challenges in the agriculture sector. An accurate and a faster
detection of plant diseases will help to develop an early treatment technique while substantially
reducing economic losses. Recent developments in Deep Neural Networks have allowed
researchers to drastically improve the accuracy of disease classification.
In our approach, we focus on the identification and recognition of diseases that affect tomato
plants. Several techniques have been recently applied to apparently identify plant diseases.
These include using direct methods closely related to the chemical analysis of the infected area
of the plant, and indirect methods employing physical techniques, such as imaging and
spectroscopy, to determine plant properties and stress-based disease detection.
However,t he advantages of our approach compared to most of the traditionally used techniques
are based on the following facts:
Our system uses images of plant diseases taken in-place, thus we avoid the process of collecting
samples and analyzing them in the laboratory. Our approach uses input images captured by
camera devices it provides a practical real-time application that can be used in the field for
disease detection without employing any expensive and complex technology.
4
CHAPTER 2
FIELD STUDY
2.1 Introduction
Nalgonda district, is a district in the Telangana state of India. Nalgonda is derived from two
Telugu words Nalla (Black) & Konda (Hills). Geographically it is much above the sea level
when compared to other districts of Telangana. This simple says that there is water scarcity in
the district and another problem which has been faced by local people is fluoride levels in the
ground water. It effects in formation of bones in human being, coming to plants they usually
exposed to fluoride through the air, soil, and water. In this district, this fluoride water is used
for irrigation; it can result in toxicity symptoms on sensitive plants. Fluoride strongly inhibits
photosynthesis and other processes. It will move in the transpiration stream from roots or
through stomata and accumulate in leaf margins.
Out of total land in Nalgonda district (2.45 lakh hectares), more than 50% of land is cultivable
land. Main crops are rice, cotton, maize and wheat which occupies 70% of irrigation land.
Considering all these issues and to know the problems of farmers more effectively, research
has been done in few villages namely Marrigudem and Alumdevichervu to help the farmers
technologically by asking the local farmers various questions: what are the problems faced by
them in seeds related, what are their irrigation sources, availability of water, factors effecting
productivity, productivity margin and pesticides and manure effects etc.
In Marrigudem, most of the farmers are farming by using pesticides and manure and very few
are doing organic based farming. But comparing the total land occupied by these organic
farmers it is significant because these organic farmers are occupying most land in the villages.
Organic farming started in 2006 in that village. Most of these farmers are educated and they do
organic farming by watching YouTube channel of Subhash Palekar and they usually conduct
meetings on their own and discuss about the problems they are facing. They solve problems by
using the cow’s manure and natural manure only and they will not use any kind of chemicals
and pesticides in their fields. It takes nearly 3 years to convert pesticides used land into the land
that will suitable for organic, in these 3 years the output doesn’t yield profits. The manure they
are spraying doesn’t cause any effect to land and farmers. After 3 years there will be profits for
the farmers, they store this year seeds for the next year therefore there is no need to invest
money for seeds. Manure they are spraying is from cow’s urine and dung, which they will
breed in their fields only and they need to spend little amount on cow’s breeding or they can
breed cattle in their own fields leaving some amount of land for cattle. In this farming they
need to spray manure for every 6-7 days in rice crop and for cotton it is 14-15 days.
Farmers who are holding less land in village are not interested in organic farming because in
first 3 years they are investing in farming and the yield will be less which is not sufficient to
get their invested money, so they will be loss for these years. Small farmers who are completely
depending on farming for their food and basic needs can’t survive for 3 years by spending their
money in their fields. One of the basic problems faced by small farmers and medium scale
farmers is money, they get the money from the dealers and banks and these people can’t wait
5
for 3 years for their money and it will completely effect the life of the farmers. Small scale
farmers are not capable of doing farming by watching you tube channel as they are uneducated.
Even though these organic products are sold for high price compared to other and are
environmental friendly, still the farmers are not in a position to do organic farming.
To understand the complete process of farming, a questionnaire covering each and every aspect
related to their basic details, seed related issues, factors effecting productivity, market related
issues, digital penetration, irrigation related issues, pesticides and manures and labour related
issues. This questionnaire can be found in Appendix 1 of this report. Further, a limited set of
data was collected on these aspects from a total of 61 farmers from these two villages. The
collected data can be found in Appendix 2 of this report.
After collection of data and performing its analysis, the following are the major problems
found, which the farmers are facing in the villages of Marrigudem and Allumdevicheruvu.
❖ Lack of proper education and awareness(about government schemes, apps, channels
etc, new technologies, online marketing, their benefits) Lack of manpower.
Awareness:
• Maximum are unaware and those who are aware are not ready to use or share the
information regarding apps and schemes.
• Massive campaigning is required and influential people in the village can help.
6
• Technological solution must be provided such that it is accessible to everyone [Ex:
Radio, TV, SMSs, a center for information etc.].
➢ Motor runs even after the tanks had been filled because farmers forget to turn it off.
• Alarm or siren to inform the farmer to turn the motor off, can also be installed.
Crop monitoring:
➢ Crops if not monitored, lead to the damage of entire crop.
• An alert system can be placed to inform farmer of any early damage to crop, so that it
may be controlled.
Problems of Intermediaries:
• Farmers don’t get sufficient amount of price due to intermediaries.
• Intermediaries must be removed. Government can do this by using technology.
• For direct sale of harvested crop, a website may be built with centralized data base of
the demand of commodities and the facility of posting the details of crop yield.
7
• Logistics can be subsidized or provided by the government.
➢ Some end up paying more where they could have bought it from a farmer with surplus
of seeds from the previous crop.
• Thus farmers can buy within the community without having the need to go somewhere
else.
Considering the above points, the distributive model was built. The model so built has solutions
covering maximum aspects/problems. Each of these solutions share their output as input to
other aspect(s)’ solution, as shown in the figure next.
As seen from the distributive model
8
the solution for awareness related problems consists of Native language support, which is not
only intended to give information on government schemes, apps but also issue alerts regarding
motor system, crop monitoring system and provide a platform for networking (conferencing
app), in native language. This support system is intended to provide both voice and text support
in native language; the motor system is intended to provide remainder assistance using
threshold level of heat/moisture/water level in tank/power utility/usage of water and taking that
notification into consider farmer will take the necessary action. The crop monitoring system
is intended to provide information about farm conditions, notify when conditions cross the set
threshold and from there, farmer can take help of expert assistance and solve the problem. To
solve the problem of intermediaries, a centralised database system of demand for
commodities is proposed which is intended to collect information on demand and availability
of commodities and supply it to the farmers and people of agricultural market. A conferencing
app is proposed to provide a platform to farmers for networking with experts from within and
outside the community. To solve the issues related to seeds and cattle, a cooperative
mechanism is to be developed which utilizes a localised database of resources. The farmers
within the community who have surplus of any of the resources can fulfil the demands of the
remaining in need of these resources. In conferencing app, farmers can contact bank members
and they will clear their doubts regarding loans and bank issues.
9
DISTRIBUTIVE MODEL
VOICE
/TEXT
Crop Farmer
monitoring controlled
system motor system
Alerts Remainder
assistance and
FARMERS controlling Conferencing app
for Networking
Based on
Demand
Solution to VOICE
and Supply
the /TEXT
problem
Localised
database
of
resources
Expert
assistance
Yield Demanded
information response
Support
Centralised database demand for from
commodities Banks
Yield Required
response Information
Agri-
Market
10
2.3.2 Integrated Model:
This model is mostly about building an application. As the usage of android phones and internet
increasing rapidly even in the villages and 57% of the farmers are having at least one smart
phone in their family. 59% of the farmers are having Internet/data connection. Organic farmers
should have Internet connection as most of methods followed through YouTube channels of
the organic researchers. This data obtained in the research made in the point of building an
integrated model.
Here, the efforts are to provide a solution, covering all of the aspects. In this application, there
will be different types of blocks each deals about different issues. This acts as a forum for the
farmers.
TYPES OF BLOCKS
o Videos, this block will have the videos of the farmers who are succeeded in
implementing new methods in agriculture and researches of agricultural experts. The
videos from all over the country will be in this block and there should be option for
uploading new videos and commenting the present videos. Steps to be taken for
translating the videos into local language.
o Government related information, this block consists of all government related
schemes, websites and Government applications. Instead of searching in different
sources farmers can go through details any Government related information through
this block. This block will also have the Government officials details like phone number
and mail id, if any doubt related to them farmer can ask them.
o Industries and market members, cost of different crops in different markets around
the particular region should be entered so that farmer can go to any market in his/her
interest.Industries can also be in contact with the farmers through this block. They
should enter type of crop and required amount of that particular crop and approximate
price they can give it to that crop. So farmers who are holding that crop and satisfied
with that price can sell the yield directly to the industries. Here, farmers can combine
and sell their yield. The cost of particular crop, license of market members and
industries should be observed and verified by the Government officials regularly to
avoid frauds and misuse of the source. Through this intermediaries’ problem can be
reduced.
11
o Events, this block will have the updates and information of the events, campaigns and
different programs related to agriculture in that particular state. Both Government and
private sectors can put their events in this block.
o Farming loans, here, it requires more support from all the banks. Banks need to provide
and update all the information about their schemes, duration for issuing money to the
farmers, interest rate and complete procedure for loans including their contact details.
By this, banking procedure can be made clear and simple. o Agricultural products,
farmers will contact authorised retailer from this block. Retailers are going to provide
what type of seeds, pesticides, fertilizers and different products require for agriculture
with their cost. It just acts online shopping for farmers. This will save the farmers time
and money. The cost of the products, license of market retailers should be observed
and verified by the Government officials regularly.
o Telemedicine/e-health, this is similar to existing Govt. telemedicine scheme, provides
direct contact between farm doctor/veterinary doctor and farmer. o Water sources, this
provide the details of opening /closing of different canals, dams and other water
resources in that particular region. This also provides the water level available in
different water resources. This will be completely handled by the Government officials.
These are the different blocks in integrated model and block diagram of integrated model is
given below.
12
INTEGRATED MODEL
Cost in different
Industries and
areas for different
market members
types of crops
App
Schedules of
Events Campaigns,
programs in state
Procedure and
Farming loans in
duration of loans
various banks
in various banks
Authorised
Agricultural products seeds, fertilizers
and pesticides
Telemedicine/e-health
Water sources
Help/Notifications
Figure 2.3.2 Integrated Model
13
CHAPTER 3
METHODOLOGY
3.1 Introduction:
In our approach, we focus on the identification and recognition of diseases that affect tomato
plants. Several techniques have been applied to apparently identify plant diseases. These
include using direct methods closely related to the chemical analysis of the infected area of the
plant, and indirect methods employing physical techniques, such as imaging and spectroscopy,
to determine plant properties and stress-based disease detection. However, the advantages of
our approach compared to most of the traditionally used techniques are based on the following
facts:
Our system uses images of plant diseases taken in-place, thus we avoid the process of collecting
samples and analyzing them in the laboratory. Our approach uses input images captured by
camera devices and provides a practical real-time application that can be used in the field for
disease detection without employing any expensive and complex technology.
Plant diseases visibly show a variety of shapes, forms, colours, etc…Understanding this
interaction is essential to design more robust control strategies to reduce crop damage.
Recent developments in Deep Neural Networks have allowed researchers to drastically
improve the accuracy of disease detection and recognition systems. A deep-learning-based
approach to detect diseases in plants using images captured in-place by camera devices with
various resolutions.
The methodology suggested used in the project pertains to the most common diseases found in
the tomato plant like, Bacterial leaf spot,Late Blight, Yellow Leaf Curl among many others.
Any leaf image given as input can be classified into one of the disease classes or can be deemed
healthy. The database used for evaluation is a subset of Plant Village, a repository that contains
4100 images,the subset includes around 1000 images of tomato leaf diseases.
15
appropriate features has been increased. The augmentation process shows all supported
diseases together with the number of original images and number of augmented images for
every class used as training and validation dataset for the disease classification model.
3.2.3 Classification
Convolutional neural networks (CNN) can be used for the creation of a computational model
that works on the unstructured image inputs and converts them to corresponding classification
output labels. They belong to the category of multi-layer neural networks which can be trained
to learn the required features for classification purposes. They require less pre-processing in
comparison to traditional approaches and perform automatic feature extraction which gives
better performance. For the purpose of tomato leaf disease detection, we have experimented
16
with several standard deep learning architectures like AlexNet, GoogleNet and the best results
could be seen with the use of a variation of the LeNet architecture. LeNet is a simple CNN
model that consists of convolutional, activation, pooling and fully connected layers. The
architecture used for the classification of the tomato leaf diseases is a variation of the LeNet
model. It consists of an additional block of convolutional, activation and pooling layers in
comparison to the original LeNet architecture.
Each block consists of a convolutional, activation and a max pooling layer. Three such blocks
followed by two fully connected layers and softmax activation are used in this architecture.
Convolutional and pooling layers are used for feature extraction whereas the fully connected
layers are used for classification. Activation layers are used for introducing non-linearity into
the network.
Our project is to detect the plant diseases and provide the solutions/remedies to recover from
the leaf diseases. We planned to design our project user friendly so that a person with lesser
expertise in software should also be able to use it easily. The existing system can only identify
the type of disease and remedies for that disease. We will provide a result within few seconds
and guided you throughout the project.
Samples of 75 images are collected that comprised of different plant diseases like Yellow Curl
Virus, Bacterial Spot,Late Blight and Healthy Leaves. Different number of images is collected
for each disease that was classified into training and testing images.
Bacterial Diseases
A bacterial disease is generally referred as the “Bacterial leaf spot”. It is initiated as the small,
yellow- green lesions on young leaves which usually seen as deformed and twisted, or as
dark,water-soaked, greasy - appearing lesions on older foliage.
Viral Diseases
17
All viral disease presents some degree of reduction in production and the life of virus infected
plants is usually short. The most available symptoms of virus-infected plants are frequently
appear on the leaves, but some virus may cause on the leaves, fruits and roots. The Viral disease
is very difficult to analyze. Leaves are seen as wrinkled, curled and growth may be undersized
due to the virus.
Fungal Diseases
Fungal disease can influence the Contaminated seed , soil, yield, weeds and spread by wind
and water. In the introductory organize it shows up on lower or more seasoned clears out as
water-soaked, gray-green spots. Afterward these spots are obscure and at that point white
fungal development spread on the undersides. In wool buildup yellow to white streak on the
upper surfaces of more seasoned clears out happens. It spreads outward on the leaf surface
causing it to turn yellow.
18
Figure 3.3.1 Leafs affected with various diseases
The entire procedure of developing the model for plant disease recognition using deep CNN is
described further in detail. The complete process is divided into several necessary stages in
following sections, starting with gathering images for classification process using deep neural
networks.
19
3.4.1 NumPy
NumPy is not different programming language but a Python extension module. It provides fast
and efficient operations on arrays of any homogeneous data. NumPy extends python into a
high-level language for manipulating numerical data, similar to MATLAB.
NumPy uses Python syntax. Because NumPy is in Python, embedding code from other
languages like C, C++ and Fortran is very simple. It is an extension module for Python, mostly
written in C. This makes sure that the precompiled numerical and mathematical functions and
functionalities of Numpy guarantee great execution speed.
Furthermore, NumPy enriches the Python programming language with powerful data
structures, implementing multi-dimensional arrays and matrices. These data structures
guarantee efficient calculations with arrays and matrices. Further this module supplies a large
library of high-level mathematical functions to operate on these arrays and matrices.
3.4.2 SciPy
SciPy also known as Scientific Python is often mentioned in the same breath with NumPy.
SciPy needs Numpy, as SciPy is based on the data structures of Numpy and furthermore its
basic creation and manipulation functions. It extends the capabilities of NumPy with further
useful functions for regression, minimization, Fourier-transformation and many others. Both
SciPy and NumPy are not a part of basic Python installation. They should be installed after
the installation of Python. SciPy has to be installed before installing NumPy.
3.4.3 Matplotlib
Matplotlib is a plotting library like GNU plot. The main advantage when compared to GNU
plot is the fact that Matplotlib is a Python module. Due to the growing interest in python the
popularity of matplotlib is also continually rising.
20
Another characteristic of matplotlib is its steep learning curve, which means that users usually
make rapid progress after having started. With just a few lines of code we can generate
histograms, plots, power spectra, bar charts, error charts, scatterplots, etc…
3.4.4 Tqdm
Tqdm displays statistics and uses smart algorithms to predict and automagically adapt to a
variety of use cases with no or minimal configuration.
Instantly smart algorithms make our loops show a smart progress meter with tqdm, In addition
to its low overhead tqdm also uses smart algorithms to predict the remaining time & to skip
unnecessary iteration displays, which allows for a negligible overhead in all the cases.
However, there is one thing that tqdm cannot do that is to choose a pertinent progress indicator.
To display a useful progress bar, it is important that tqdm is supplied with the most pertinent
progress indicator. This helps to reflect the current state of our program accurately. Usually, a
good way is to pre process it quickly to first evaluate the total amount of work to do before
beginning the real processing.
3.4.5 Tkinter
Python offers multiple options for developing Graphical User Interface. Tkinter is most
commonly used method out of all the GUI methods. It is a standard Python interface to the Tk
GUI toolkit shipped with Python. Python with tkinter outputs the fastest & easiest way to
create the GUI applications. Creating a GUI using tkinter is an easy task.
Tkinter is the standard GUI library used in Python. Python when combined with Tkinter
provides a fast efficient and easy way to create GUI applications. It also provides a powerful
object oriented interface to the Tk GUI toolkit.
Tkinter provides various controls, like buttons, labels and text boxes used in a GUI application.
These controls are called as widgets.
There are 15 types of widgets in Tkinter, description of these widgets are given in the following
table.
21
S.No Operator Description
1 Button The Button widget is used to display buttons in the application.
2 Canvas The Canvas widget is used to draw various shapes, such as lines,
circles, ovals, polygons and rectangles, in your application.
3 Check button The Check button widget displays various options as checkboxes. The
user can select multiple options at a time.
4 Entry The Entry widget displays a text field for accepting values by the user.
6 Label The Label widget is used to provide a single-line caption or labels for
other widgets.
7 List box The List box widget is used to provide a list of options available to a
user.
8 Menu button The Menu button widget is used to display menus in the GUI
application.
9 Menu The Menu widget is used to provide various commands available to a
user. These commands are contained inside Menu button.
10 Message The Message widget is used to display multiline text messages for
accepting values from a user.
11 Radio button The Radio button widget is used to display a number of options as radio
buttons. Here the user can select only one option at a time.
12 Scale This widget provides a slider.
15 Top level The Top level widget provides a separate window container.
16 Spin box The Spin box widget is a variant of the standard Tkinter Entry widget,
which is used to select from a fixed number of values.
22
17 Paned Window A Paned Window is a container widget that may contain any number
of panes, arranged horizontally or vertically.
18 Label Frame A label frame is a simple container widget. Its main purpose is to act as
a spacer or container for complex window layouts.
19 tk Message Box Tk Message Box module is used to display message boxes in GUI
applications. Messages are displayed here.
Python shutil module enables user to operate with the file objects easily and without diving
into file objects a lot. It takes care of low-level semitics like creating file objects, closing the
files once they are copied and allows us to focus on the business logic of our program. Some
of the shutil module in actions used are copy file, copying Files to another directory, copying
file with metadata, replicating complete directory, removing a directory, searching files
3.4.7 TfLearn
TFlearn is both modular and transparent deep learning library built on top of Tensorflow. It
was designed to provide a higher-level API to TensorFlow in order to facilitate and speed-up
the process, while remaining compatible and fully transparent with it.
TFLearn features include:
• Easy-to-use and understand high-level API for implementation of deep neural
networks, with tutorial and examples.
• It full transparent over Tensorflow. All functions are built over tensors & can be used
independently of TFLearn.
• It contains powerful helper functions to train any TensorFlow graph, with the support
of multiple inputs, outputs and optimizers.
• Easy as well as beautiful graph visualization, with details about weights, gradients,
activations etc…
• Effortless device placement for using multiple CPU or GPU.
TFLearn is a high-level Python module for distributed machine learning on top of Tensor-Flow.
It facilitates an easy-to-use Scikit-learn style interface to simplify the process of creating,
configuring, training, evaluating, and experimenting a machine learning model. TFLearn
23
integrates a wide range of state-of-art machine learning algorithms built on top of TensorFlow’s
low level APIs for small to large-scale unsupervised and supervised problems. This module is
used to bring machine learning to non-specialists using a general-purpose high-level language
as well as researchers to implement, benchmark, and compare their new methods in a structured
environment.
TensorFlow, a general-purpose numerical computation library open-sourced by Google in
November 2015, has both flexible implementation and architecture which enables users to
focus on building the computation graph and deploy the model with little efforts on
heterogenous platforms such as mobile devices, hundreds of machines, or thousands of
computational devices. TensorFlow is straightforward to use in a sense that most of the
researchers in the research area with no experience of using TensorFlow could understand
what’s happening behind the code blocks. It also provides a good backbone for building
different shapes of machine learning applications.
Image representation for classification task used often feature extraction methods which have
been proven to be effective for different visual recognition tasks. Local binary patterns method
is used for texture features extracting. Histograms of oriented gradients are applying for image
processing. Usually these types of methods have used to transform images and describe them
for numerous tasks. Most of the applied features need to be identified by an expert and then
manually coded as per the data type and domain. This process is difficult and expensive in
terms of expertise and time. As a solution, deep learning reduces the task of developing new
feature extractor by automating the phase of extracting and learning features. The proposed
Plant Disease Classification system is able to recognize the healthy and unhealthy plants then
classify them by exploiting this technology. There exist many different architectures of deep
learning. The model presented here is a classifier system developed by using convolutional
neural networks category, which is the most efficient and useful deep neural network used for
this type of data. Therefore, CNNs applied to learn images representation on large-scale
datasets for recognition tasks can be exploited by transferring these learning representations on
other tasks with limited amount of training data. To address this problem, we propose using
the convolutional neural network AlexNet applied on the largescale datasets, by transferring
its learned image representations and reuse them to the classification task with limited training
24
data. The main idea is based on designing a method which reuse a part of training layers of
AlexNet. In the following Sections introduces the method and the CNN architecture exploited.
Convolutional Networks (ConvNets) are currently the most efficient deep models for
classifying images data. Their multistage architectures are inspired from the science of biology.
Through these models, invariant features are learned hierarchically and automatically. They
first identify low level features and then learn to recognize and combine these features to learn
more complicated patterns. And each layer has specific number of neurons and presented in 3
dimensions: height, width, depth. To understand convolutional neural network structure, we
can observe it as two distinct parts. In input, images are presented as a matrix of pixels. It has
2 dimensions for a grayscale image. The colour is represented by a third dimension, of depth 3
to represent the fundamental colours (Red, Green, Blue). The first part of a CNN is the
convolutive part. It functions as a feature extractor of images. In this part, an image is passed
through a succession of filters, or convolution kernels, creating new images called convolution
maps. Some intermediate filters are used to reduce the resolution of the image by a local
maximum operation.
The primary purpose of Convolution in case of a ConvNet is to extract features from the input
image. Convolution preserves the spatial relationship between pixels by learning image
features by using pixel values of input data. We will try to understand how it works over
images.
Every image can be considered as a matrix of pixel values. Let us consider a 5 x 5 image whose
pixel values are 0 and 1 (note that for a grayscale image, pixel values range from 0 to 255, the
green matrix below is a special case where pixel values are only 0 and 1):
25
Consider another 3 x 3 matrix used as filter
Then, the Convolution of the 5 x 5 image and the 3 x 3 matrix filter can be computed as shown
in the figure below:
We slide the orange matrix ie kernel over our original image (green) by 1 pixel & for every
position, we compute element wise multiplication between the two matrices and add the
multiplication outputs to get the final value which forms a single element of the output matrix
(pink). Note that the 3×3 matrix “sees” only a local part of the input image in each stride.
In CNN terminology, the 3×3 matrix is known as ‘filter‘ or ‘kernel’ or ‘feature detector’. The
matrix formed by sliding the filter over the image and computing the dot product is called the
‘Convolved Feature’ or ‘Activation Map’ or the ‘Feature Map‘. It is important to note that
filters acts as feature detectors from the original input image.
A Convolutional Neural Network learns the values of these filters on its own during the
training process and we need to specify parameters such as number of filters, filter size,
architecture of the network etc. before the training process. The more number of filters we
use for for feature extraction, the more image features get extracted and our network becomes
26
more efficient at recognizing patterns of unseen images.
Let us consider a CONV layer accepting a volume of size [W1×H1×D1] where W1 is the width,
H1 is the height and D1 the depth, the outputs of neurons in this type of layers are calculated
by applying the product between their weights and a local region they are connected to in the
input volume.
The obtained output volume [W2×H2×D2] is called convolution map where W2 is the width,
H2 is the height and D2 is the depth if we decided to use D2 filters or convolution kernels.
Convolution maps produce a volume equal to [W2×H2×D2], where W2, H2, D2 are given by
equations (1), (2), (3):
With:
F: spatial extend of the filter.
K: number of filters.
P: zero padding (hyperparameter controlling the output volume).
S: stride (hyperparameter with which we slide the filter).
In the end, a feature extractor vector or CNN code concatenate the output information as a
unique vector. This code is then connected to the input of a second part, consisting of fully
connected layers (multilayer perceptron). The role of this part is to combine the characteristics
of the CNN code to classify the image. It determines the class scores, presenting in an output
volume of size [1×1×k]. The architecture of this part is a usual multilayer perceptron and each
of the k output. The size of the Feature Map is controlled by three parameters that we needs to
be decided before the convolution step:
27
➢ Depth: Depth means the number of filters we use for the convolution operation. You
can think of these three feature maps as stacked 2d matrices, then ‘depth’ of the feature
map would be three.
➢ Stride: Stride is the number of pixels by which we slide our filter matrix over the input
image matrix. When the stride is 1 then we move the filters by one pixel at a time. When
the stride is 2, then the filters jump 2 pixels at a time, When a larger stride is used it
produces smaller feature maps.
➢ Zero-padding: Sometimes, it is convenient to pad the input matrix with zeros around
the border, so that we can apply the filter to bordering elements of our input image
matrix. A use of zero padding is that it allows us to control the diminishing size of the
feature maps.
An additional operation called ReLU has been used after every Convolution operation in Figure
below. ReLU stands for Rectified Linear Unit and is a non-linear operation. Its output is given
by:
F(x)= max(0,x)
ReLU is an element wise operation which replaces all negative pixel values in the feature map
by zero. The purpose of ReLU is to introduce non-linearity in our Convolutional Neural
Network, since most of the real-world data we would want our ConvNet to learn would be non-
linear, Other non linear functions such as tanh or sigmoid can also be used instead of ReLU,
but ReLU has been found to perform better in most situations.
28
3.5.3 Pooling Layer:
Spatial Pooling is also called subsampling or down sampling which reduces the dimensionality
of each feature map but retains the most important information. Spatial Pooling can be of
different types: Max pooling, Average pooling, Sum etc.
In case of Max Pooling, we take a spatial neighbourhood (for example, a 2×2 window) and
take the largest element from the rectified feature map within that window. Instead of taking
the largest element we can also take the average (Average Pooling) or sum of all elements in
that window. In practice, Max Pooling has been shown to work efficiently.
Figure shows an example of Max Pooling operation on a Rectified Feature map (obtained after
convolution + ReLU operation) by using a 2×2 window.
We slide our 2 x 2 window by 2 cells (also called ‘stride’) and take the maximum value in each
region. As shown in Figure, this reduces the dimensionality of our feature map. Pooling
operation is applied separately to each feature map, the function of Pooling is to progressively
reduce the spatial size of the input representation and it has following functions
29
● Reduces the number of parameters and computations in the network, therefore,
controlling problem of overfitting.
● Pooling operation makes the network invariant to small transformations, distortions and
translations in the input image. So a small distortion in input will not change the output
of Pooling, since we take the maximum or average value in a local neighbourhood.
POOL layer inserted between successive Conv layers, applying a down sampling operation
along the spatial dimension’s width and height. It uses MAX operation to optimize the spatial
size of the representation as well as reducing the amount of parameters, [21]. Pool Layer
produces a volume [W2×H2×D2] where W2, H2, D2 are given by applying equations (4), (5)
and (6) :
Together these layers extract the useful features from the images, introduce non-linearity in our
network and reduce feature dimension while aiming to make the features somewhat equivariant
to scale and translation.
The term “Fully Connected” implies that every neuron in the previous layer is connected to
every neuron on the next layer.The output from the convolutional and pooling layers represent
high-level features of the input image. The purpose of the Fully Connected layer is to use these
high-level features for classifying the input image into different classes based on the training
dataset. Most of the features from convolutional and pooling layers may be good for the
classification task, but combinations of those features will work even better.
30
Figure 3.5.2 Fully connected layer
Sum of all the output probabilities from the Fully Connected Layer is one. This is ensured by
using the Softmax function as the activation function in the output layer of the Fully Connected
Layer.
● Step2: The network takes a training image as input, goes through the forward
propagation steps convolution, ReLU and pooling operations along with forward
propagation in the Fully Connected layer and finds the output probabilities for each
class.
○ Let’s say the output probabilities for an image are [0.2, 0.4, 0.1, 0.3]
○ Since weights are randomly assigned for the first training step, output
probabilities are also random in nature.
31
● Step3: Calculate the total error at the output layer
○ Total Error = ∑ ½ (target probability – output probability) ²
● Step4: Use Backpropagation to calculate the gradients of the error with respect to all
weights in the network and use gradient descent to update all filter values / weights and
parameter values to minimize the output error.
○ The weights are adjusted in proportion to their contribution to the total error.
○ When the same image is input again, output probabilities might now be [0.1,
0.1, 0.7, 0.1], which is closer to the target vector [0, 0, 1, 0].
○ This means that the network has learnt to classify a particular image correctly
by adjusting its weights and filters such that the output error is reduced.
○ Parameters like number of filters, filter sizes, architecture of the network etc.
should be fixed before Step 1 and do not change during the entire training
process – only the values of the filter matrix and connection weights get
updated after each step.
● Step5: Repeat steps 2-4 with all images in the training set.
The above steps train the ConvNet – this essentially means that all the weights and parameters
of the ConvNet have been optimized to efficiently to classify images from the training set.
When a new image is given as input to the ConvNet, the network would go through the forward
propagation step and the output probabilities are calculated using the weights which have been
optimized to correctly classify all the previous training examples. If our training set is large
enough, the network will generalize well to new images and classify them into correct
categories.
32
3.5.7 Last layer activation function:
The activation function has to be applied to the last fully connected layer which is usually
different from the others. An appropriate activation function needs to be selected according to
specific task. An activation function applied to the multiclass classification task is a softmax
function it normalizes output real values from the last fully connected layer to target class
probabilities, where values range between 0 and 1 and sum of all the values is 1.
Random crops of size 227×227 were generated from the 256×256 input images to feed the
first layer of AlexNet. Note that the paper mentions the network inputs to be 224×224, but
that was a mistake and the numbers make sense only with 227×227 instead.
33
In AlexNet 5 Convolutional Layers and 3 Fully Connected Layers are used. Multiple
Kernels extract interesting features in an image. In a single convolutional layer, there are
usually many kernels of the same size. For example, the first Conv Layer of AlexNet uses 96
kernels of size 11x11x3. The width and height of the kernel are usually same and the depth is
same as the number of channels. The first two Convolutional layers are followed by
the Overlapping Max Pooling layers. The third, fourth and fifth convolutional layers are
connected directly. The fifth convolutional layer is followed by a Max Pooling layer, the output
of which goes into a series of two fully connected layers. The second fully connected layer
feeds into a softmax classifier which classifies the image.
Reducing Overfitting
The size of the Neural Network is its capacity to learn, but if you are not careful, it will try to
memorize the features in the training data without understanding the concept. As a result, the
Neural Network will work exceptionally well on the training samples, but they fail to learn the
real concept. It will fail to work well when a new or unseen test data is used. This is
called overfitting.
Data Augmentation
Showing a Neural Net different variation of the same image helps in preventing overfitting.
We can use mirror images, cropping and flipping for data augmentation.
Dropout
With about 60Million parameters to train, the authors experimented with other ways to reduce
overfitting too. In dropout, a neuron is dropped from the network with a probability of 0.5.
When a neuron is dropped, it does not contribute to both forward and backward propagation.
As a result, the learnt weight parameters are more robust and do not get overfitted easily.
During testing dropout is not used and the whole network is used, but output is scaled by a
factor of 0.5 to account for the missed neurons while training. Today dropout regularization is
very important and implementations are better than the original one have been developed.
34
3.5.9 CNN Benefits
The main motivation behind the emergence of CNNs in deep learning is to address many of
the limitations that traditional neural networks faced when applied to those problems. When
used in areas like image classification, traditional fully-connected neural networks simply don’t
scale well due to their disproportionally large number of connections. Convolutional Neural
Networks bring a few new ideas that contribute to improve the efficiency of deep neural
networks.
35
parameters across different functions in the deep neural network. More specifically, parameter
sharing entails that the weight parameters will be used on every position of the input which
will allow the model to learn a single set of weights once instead of a different set for every
function. Parameter sharing in CNNs typically results on massive savings in memory compared
to traditional models.
3 ) Equivariance
Conceptually, a function can be considered equivariance if, upon a change in the input, a similar
change is reflected in the output. Using a mathematically nomenclature, a function f(x) is
considered equivariant to a function g() if f(g(x))= g(f(x)). It turns out that convolutions are
equivariant to many data transformation operations which means that we can predict how
specific changes in the input will be reflected in the output.
36
CHAPTER 4
RESULTS AND DISCUSSION
37
38
To evaluate the performance of the proposed model, a confusion matrix is drawn and a set of
quantitative metrics comprising of accuracy, precision are measured. A confusion matrix is a
table that is often used to describe the performance of a classification model on a set of test
data for which the true values are known.
Bacterial 0 7 3 0 10
Spot
Late 0 1 8 1 10
Blight
Yellow 0 0 0 10 10
Curl
Virus
Table 4.1 Confusion matrix for 50 real-time samples
39
Healthy Bacterial Late Yellow Total
Spot Blight Curl
Virus
Healthy 468 20 8 4 500
40
Healthy Bacterial Late Yellow Total
Spot Blight Curl
Virus
Healthy 857 27 10 6 900
A highest validation accuracy of 93.85% was obtained over 8 epochs of training, while 85%
accuracy is obtained using real time images collected from fields. This is an effective measure
of the classification made by the deep learning model. The results show that the model performs
well when there is increase in number of training samples. The implementation process requires
minimum hardware requirements unlike large neural networks which generally have high
computational resource requirements or the use of a Graphics Processing Unit. Also, the
variation of the AlexNet model adopted is simple to understand and easy to implement. The
model thus, provides a simple and effective way of solving the problem of plant disease
detection with results comparative to traditional state of the art techniques. With less resource
constraints and minimal data.
41
CHAPTER 5
CONCLUSION
The proposed work is aimed at examining different issues related to agriculture and provide
possible interventions using technology. To understand the process of farming, field study is
conducted from which various issues related to farming are identified. Data analysis performed
through field study helped us in understanding the issues related to agriculture. Difficultly in
monitoring crops, Improper usage of pesticides, lack of education & awareness, slow
adaptation of new methods & technology, losses due to weeds, pests, insects are some of the
core issues.
Crop health monitoring is identified as specific intervention point as diseases are detrimental
to the plant’s health which in turn affects its growth. To ensure minimal losses to the cultivated
crop, it is crucial to supervise it’s growth, Timely identification of the plant diseases will reduce
the usage of pesticides & helps in increasing quality & quantity of the production rate.
The evaluated system uses a convolutional neural network (CNN) model to classify leaf
diseases obtained from the Plant Village dataset. and proved to be effective in accurately
classifying plant health into one of 4 classes; Healthy, late blight, bacterial spot, yellow curl
virus with an accuracy of 85% and provides suitable remedies to the farmers using simplest
approach while making use of minimal computing resources.
Different learning rates, optimizers and newer architectures could also be used for
experimenting with the proposed model for improving the performance of the model on the
train set as a part of the future work. It can also be made more user friendly by designing an
app for the developed model. This would also solve the problem of expensive domain expert
and provides a good choice for agriculture community particularly in remote villages.
42
REFERENCES
a. Saichand Thota, Sohail Arif, et al, “A Field Study for Technological Interventionin
Agriculture”, Department of E.C.E, JNTUHCEH, 2017.
d. Prajwala et al.“Tomato Leaf Disease Detection using Convolutional Neural Networks”. In:
Proceedings of 2018 Eleventh International Conference on Contemporary Computing (IC3),
Noida, 2018, pp. 1-5.
e. Gandhi et al."Plant disease detection using CNNs and GANs as an augmentative approach,"
2018 IEEE International Conference on Innovative Research and Development (ICIRD),
Bangkok, 2018, pp. 1-5.
APPENDIX 1
QUESTIONNAIRE
BASIC:-
1. Name
2. Age
3. Educational Qualification
4. Number of years of experience in farming
5. Number of Acres cultivated a)Own, b)Rent
6. Type of crops grown since 5 years a)Similar b)Different
7. How many family members do farming? Why they don’t (if any)?
8. How much time do they spend at fields?
9. What do they do there? What are the daily works? What are the seasonal works?
10. Are they dependent on only agriculture or they practice animal husbandry as well?
11. Levels of uncertainty in rains or famines
12. Methods adopted to decide the type of crop
13. Is there any advancement in the way of farming?
14. Which is more profitable farming or animal husbandry?
15. How many days the crops can survive without attention?
16. How many times do they sow crops in a year?
17. Do they follow crop rotation?
44
18. Can they use the remaining seeds next time the sow?
19. How much does the yield differ for normal and hybrid seeds?
PRODUCTIVITY:
DIGITAL PENETRATION:-
47