Вы находитесь на странице: 1из 57

Project report on

PLANT DISEASE DETECTION USING CONVOLUTIONAL NEURAL


NETWORKS

Submitted in partial fulfillment of the requirements for the award of degree of


MASTER OF TECHNOLOGY
in
ELECTRONICS AND COMMUNICATION ENGINEERING
(Communications and Signal Processing)

Submitted by
S. SOHAIL ARIF
(14011P0414)

Department of Electronics and Communication Engineering


JNTUH College of Engineering Hyderabad
Hyderabad-500085
April- 2019
Project report on
PLANT DISEASE DETECTION USING CONVOLUTIONAL NEURAL
NETWORKS

Submitted in partial fulfillment of the requirements for the award of degree of


MASTER OF TECHNOLOGY
in
ELECTRONICS AND COMMUNICATION ENGINEERING
(Communications and Signal Processing)
Submitted by
S. SOHAIL ARIF
(14011P0414)
Under the esteemed guidance of

Dr.L.Pratap Reddy
Professor

Department of Electronics and Communication Engineering


JNTUH College of Engineering Hyderabad
Hyderabad-500085
April- 2019

i
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
JNTUH College of Engineering

Hyderabad-500085

CERTIFICATE BY THE SUPERVISOR

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

CERTIFICATE BY THE HEAD OF THE DEPARTMENT

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 .

Dr. K. ANITHA SHEELA


Professor & Head of ECE Department
JNTUH-College of Engineering
Hyderabad- 500085

iii
DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING
JNTUH College of Engineering
Hyderabad-500 085

DECLARATION BY THE CANDIDATE


I, S.SOHAIL ARIF bearing the roll number 14011P0414 hereby declare that the report of the
P.G. project work entitled “PLANT DISEASE DETECTION USING CONVOLUTIONAL
NEURAL NETWORKS” under the guidance of Dr.L.Pratap Reddy, Professor of ECE
Department, JNTUH College of Engineering Hyderabad is a bona fide work carried out by
me. This is being submitted to JNTUH-CEH, in partial fulfillment of the requirements for the
award of Master of Technology (IDP) in ELECTRONICS AND COMMUNICATION
ENGINEERING with specialization “COMMUNICATIONS & SIGNAL PROCESSING”
from JNTUH during the period 2018-19.
This is a bona fide report of the work carried out by me. The material contained in this report
has not been submitted to any University or Institution for the award of any degree or diploma.

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.

I would like to express my gratitude towards Dr.L.Pratap Reddy Professor, Department of


ECE for providing me with the required infrastructure and lab facility to do this project work
and for her constant guidance and endless support throughout this project.

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

Advances in technology mostly remained untouched in agriculture sector, problem of food


security, low farm productivity, slow adaptation of new methods & technology by Indian
farmers, motivated us to understand issues related to farming sector. While aiming at a solution,
field study is conducted to understand various issues related to farming. Crop health monitoring
is chosen as specific intervention point as health monitoring and plant disease detection are
critical for agriculture.
The present scenario for plant disease detection involved direct eye observation, remembering
the particular set of disease as per the climate, season etc. These methods were indeed time
consuming. The other methods of plant disease detection involved various laboratory tests,
skilled people, well equipped laboratories etc. These things are expensive and may not be
available everywhere especially in remote areas. Hence developing a computer vision system
to detect, recognize, and classify disease affected on crops which will augment human
interference and lead to precise decision about disease infection.
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
agriculture. The methodology involves image acquisition, starting from gathering images in
order to create a database, pre-processing, building deep learning framework to perform the
deep CNN training and classification.
The model evaluated here is based on AlexNet architecture to perform plant disease
classification. It is trained using 4100 samples containing leaf images of 4 classes obtained
from the plant village database. The model achieved 85% classification accuracy which show
clearly that CNN can extract input features and classify plant diseases from images taken in
the natural environment. Early identification of leaf disease can aid farmers into taking prompt
actions to avoid disease spreading.

I
CONTENTS
ABSTRACT I

LIST OF FIGURES III

LIST OF TABLES IV

CHAPTER 1: INTRODUCTION

1.1 Introduction 1
1.2 Background 3

CHAPTER 2: FIELD STUDY

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 4: RESULTS AND DISCUSSION 37

CHAPTER 5: CONCLUSION 42

REFERENCES 43

APPENDIX 1 44

II
LIST OF FIGURES

Figure 2.3.1 Distributive model 10

Figure 2.3.2 Integrated model 13

Figure 3.2.1 Flow chart of methodology followed 15

Figure 3.3.1 Leafs affected with various diseases 19

Figure 3.5.1 Max pooling operation 29

Figure 3.5.2 Fully connected layer operation 31

Figure 3.5.3 AlexNet Architecture 34

III
LIST OF TABLES

Table 3.4.1 Various widges provided by Tkinter 22

Table 4.1 Confusion matrix for real-time samples 39

Table 4.2 Confusion matrix for 800 samples 39

Table 4.3 Confusion matrix for 2000 samples 40

Table 4.4 Confusion matrix for 3200 samples 40

Table 4.5 Confusion matrix for 4000 samples 41

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.

Plant disease management faces ever-growing challenges due to:


(i) increasing demands for total, safe and diverse foods to support the booming global
population and its improving standards;
(ii) production potential in agriculture has been reduced due to competition for land in
fertile areas and exhaustion of marginal arable lands;
(iii) Deteriorating ecology of agro-ecosystems and climate change;
(iv) Increased risk of disease epidemics resulting from intensification of agriculture and
monocultures.

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.

Convolutional networks were inspired by biological processes in which the connectivity


pattern between neurons resembles the organization of the animal visual cortex.
Individual neurons respond to stimuli only in a certain restricted region of the visual
field known as the receptive field. The receptive fields of different neurons partially overlap so
that they cover the entire visual field.

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.

2.2 Data Analysis

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.

❖ Harmful effects of pesticides.

❖ Difficulty in monitoring motor and crops.

❖ Losses due to weeds, pests, insects, animals etc.

❖ Difficulties in availing financial aid from banks(like loans).

2.3 PROPOSED MODELS

2.3.1 Distributive Model


In distributive model, the approach mainly looked at the problems individually and attempt was
made to solve them individual. The following are the challenges and things to be done in regard
with each of these problems:

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.].

• The support should be in native language.

• Special content should be created for younger generation.

Motor related issues:


➢ Overheating of motor.

➢ Motor runs even after the tanks had been filled because farmers forget to turn it off.

• Farmer should control the motor through his mobile phone.

• 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.

➢ They are generally affected by insects, animals, weeds etc.

• Hence to monitor the crop, image processing technique may be used.

• An alert system can be placed to inform farmer of any early damage to crop, so that it
may be controlled.

• A networking system can also be placed, which is discussed under productivity.

Lack of Manpower Problems:


• There is a shortage of manpower for sowing seeds/transplanting, spraying pesticides,
harvesting etc.
• These problems may be solved by complete automation.
• But the villages may not be ready physically, mentally and economically ready for
complete automation.
• Thus the problems may be solved by providing assistance wherever possible.

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.

Problems affecting productivity:


• The productivity is mainly affected by the insects, pesticides, weed, improper storage
etc.
• Apart from crop monitoring, government can also provide storage services or timely
purchasing.
• Networking of farmers, within and outside the community maybe helpful.
• The networking may be done by conducting regular meetings or providing them with
a digital platform like conferencing apps with native language support.

Banking related problems:


• Bank branches and ATMs are quit far from both the villages.
• Awareness about *99# services and BHIM app should be increased.
• Also banking apps in native language may help.
• Text/Voice support from the banks via networking may also help.

Seeds and cattle:


➢ The purchasing of seeds is different for different farmers and hence is highly irregular.

➢ Some end up paying more where they could have bought it from a farmer with surplus
of seeds from the previous crop.

• Awareness of high yielding variety (HYV) is also important.

• Proper utilization of resources can be done by co-operative method of creating a


localized database.

• 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

Native language support to people

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

Figure 2.3.1 Distributive Model

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

Videos of successful From different


farmers and villages of the
agriculture experts country

Government related Government


information apps, websites
and schemes

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.

3.2 Proposed methodology


The proposed methodology consists of three major steps: Data acquisition, Data pre-processing
and Classification. The images used for the implementation of the proposed methodology were
acquired from a publicly available dataset called Plant Village, as mentioned earlier. In the next
step, the images were re-sized to a standard size before feeding it into the classification model.
14
The final step is the classification of the input images with the use of a slight variation of the
deep learning convolutional neural network (CNN) standard model called the AlexNet which
consists of the convolutional, activation, pooling and fully connected layers. Flow diagram is
shown in and current section includes the brief discussions of the same.

Figure 3.2.1 Flow chart of methodology followed

3.2.1 Data Acquisition


The tomato leaf disease images have been taken from the Plant Village repository. Images for
the diseases were downloaded using a python script. The acquired dataset consists of around
4100 images belonging to 4 different classes. The dataset includes images of all major kinds
of leaf diseases that could affect the tomato, potato and grape plants. Each of the downloaded
images belongs to the RGB color space by default and were stored in the uncompressed JPG
format.
Appropriate datasets are required at all stages of Plant Diseases, starting from training phase to
evaluating the performance of recognition algorithms. All the pictures collected for the dataset
were taken from the Internet, searched by disease name on various sources. Images in the
dataset were grouped into different classes which represented plant diseases which could be
visually determined from leaves. In order to distinguish healthy leaves from diseased ones, one
more class was added in the dataset. It contains only images of healthy leaves. An extra class
in the dataset with background pictures were advantageous to get more accurate classification.
Deep neural network are trained to differentiate the leaves from the surrounding.
Next step was to enrich the dataset with augmented images. The main aim of the presented
study is to train the network to learn the various features that differentiate one class from the
other. Therefore, when using more augmented pictures, the chance for the network to learn the

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.2 Data pre-processing and Labelling


The acquired dataset consisted of images with minimal noise and hence noise removal was not
a necessary pre- processing step. The images in the dataset were resized to 256 × 256 resolution
in order to speed up the training process and make the model training computationally feasible.
The process of standardizing either the input or target variables tends to speed up the training
process. This is done through improvement of the numerical condition of the optimization
problem. It is also made sure that the several default values involved in initialization and
termination are appropriate.
In order to get better feature extraction, final images intended to be used as dataset for deep
neural network classifier were preprocessed in order to gain consistency. Preprocessing images
means removing low-frequency background noise, normalizing the intensity of the images,
removing reflections, and masking portions of images. Image preprocessing is the technique
used to enhance data Furthermore, procedure of image preprocessing involves cropping of all
the images manually, making the square around the leaves, in order to highlight the region of
interest. During the phase of collecting the images for the dataset, images with smaller
resolution and dimension less than 256 pixels are eliminated as they are not valid images for
the dataset. In addition, only the images where the region of interest was in higher resolution
were marked as eligible samples for the dataset. In that way, it was ensured that images contain
all the important information for feature learning.
It is important to use accurately classified images for both training and validation dataset. Only
in this way an efficient and reliable model can be developed.

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.

3.3 Plant Diseases- Fundamentals


In the field of crop production, plant disease is a significant factor that degrades the eminence
and quantity of the plants. The common approach followed in plant diseases are the
classification and detection model. Both the classification and detection model are widely
studied by the Engineering and IT fields.

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.

3.4 Software Description:

Computer Vision is the science of programming a computer to process and ultimately


understand images and videos, or simply saying to make a computer see. Solving even small
parts of certain Computer Vision challenges, creates exciting new possibilities in technology,
engineering and entertainment. In order to advance vision research and disseminate vision
knowledge, it is important to have a library of programming functions with the optimized and
portable code, and hopefully available for free. Since then, a number of programmers have
contributed to the library developments in OpenCV. The latest major change took place in 2009
where OpenCV 2 was introduced which includes main changes to the C++ interface.
Computer Vision can also be defined as a discipline that explains how to reconstruct, interrupt,
and understand a 3D scene from its 2D images, in terms of the properties of the structure
present in the scene. It deals with replicating and modeling human vision using both computer
software and hardware.

OpenCV is a cross-platform library where we can develop real-time computer vision


applications. It focuses mainly on image processing, video capture and analysing features like
face detection and object detection.

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.

Matplotlib is widely considered to be a perfect alternative to MATLAB, if it is used in


combination with Scipy and Numpy. MATLAB is a closed source software and expensive
while Matplotlib is free and open source code. Matolotlib is also object-oriented and can be
used in an object oriented way. It can be used to create publication quality figures in a variety
of hardcopy formats and interactive environments across various platforms.

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.

5 Frame The Frame widget is used to organize other widgets.

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.

13 Scrollbar The Scrollbar widget is used to add scrolling capability to various


widgets, in GUI application.
14 Text The Text widget is used to display text message in multiple lines.

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.

Table 3.4.1 Various widges provided by Tkinter

3.4.6 Python shutil

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.

3.5 Convolutional Neural Networks

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.

3.5.1 Convolution Layer:

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.

3.5.2 Nonlinear activation function:(ReLU)

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.

Figure 3.5.1 Max pool operation

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

● Makes the input representations smaller and more manageable.

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.

3.5.4 Fully connected layer

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.

3.5.5 Training using Backpropagation:

The training process of the CNN is summarized below:


● Step1: We initialize all filters and parameters / weights with random values

● 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.

3.5.6 Visualizing Convolutional Neural Networks


In general, the more convolution steps we use, the more complicated features our ConvNet
will be able to learn to recognize. For example, a ConvNet may learn to detect edges from
raw pixels in the first layer, then use these edges to detect simple shapes in the second layer,
and then use these shapes to determine more complicated higher-level features.

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.

3.5.8 AlexNet Architecture


AlexNet solves the problem of image classification where the input is an image of one of 1000
different classes and the output is a vector of 1000 numbers. The input to AlexNet is an RGB
image of size 256×256. This means all the images in the training set and all test images need
to be of size 256×256.If the input image is not 256×256, it needs to be converted to 256×256
before training the network.

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.

Figure 3.5.3 AlexNet Architecture

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.

1 )  Sparse Representations


Working on an image classification problem that involves the analysis of large pictures that are
millions of pixels in size. A traditional neural network will model the knowledge using matrix
multiplication operations that involve every input and every parameter which results easily in
tens of billions of computations. As CNNs are based on convolution operations between and
input and a kernel tensors. Well, it turns out that the kernel in convolution functions tends to
be drastically smaller than the input which simplifies the number of computations required to
train the model or to make predictions. In our sample scenario, a potential CNN algorithm will
focus only on relevant features of the input image requiring fewer parameters to use in the
convolution. The result could be a few billion operations smaller and more efficient than
traditional fully-connected neural networks.

2 ) Parameter Sharing


Another important optimization technique used in CNNs is known as parameter sharing.
Conceptually, parameter sharing simply refers to the fact that CNNs tend to reuse the same

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.

Healthy Bacterial Late Yellow Total


Spot Blight Curl
Virus
Healthy 9 1 0 0 10

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

Accuracy when tested using real time images= 34/40= 85%


Miss classification rate= 15%

Healthy Bacterial Late Yellow Total


Spot Blight Curl
Virus
Healthy 184 9 5 2 200

Bacterial 8 161 27 4 200


Spot
Late 5 24 163 8 200
Blight
Yellow 2 4 8 186 200
Curl
Virus
Table 4.2 Confusion matrix for 800 samples

Accuracy when model is trained with 800 images= 734/800= 86.75%


Miss classification rate= 13.25%

39
Healthy Bacterial Late Yellow Total
Spot Blight Curl
Virus
Healthy 468 20 8 4 500

Bacterial 13 442 38 7 500


Spot
Late 8 34 446 12 500
Blight
Yellow 5 9 14 472 500
Curl
Virus
Table 4.3 Confusion matrix for 2000 samples

Accuracy when model is trained with 2000 images= 1848/2000= 92.4%


Miss classification rate= 7.6%

Healthy Bacterial Late Yellow Total


Spot Blight Curl
Virus
Healthy 761 25 9 5 800

Bacterial 18 725 48 9 800


Spot
Late 10 42 733 15 800
Blight
Yellow 6 11 17 766 800
Curl
Virus
Table 4.4 Confusion matrix for 3200 samples

Accuracy when model is trained with 3200 images= 2985/3200= 93.28%


Miss classification rate= 6.72%

40
Healthy Bacterial Late Yellow Total
Spot Blight Curl
Virus
Healthy 857 27 10 6 900

Bacterial 22 1012 55 11 1100


Spot
Late 12 48 1022 18 1100
Blight
Yellow 7 12 18 863 900
Curl
Virus
Table 4.5 Confusion matrix for 4000 samples

Accuracy when model is trained with 4000 images= 3754/4000= 93.85%


Miss classification rate= 6.15%

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.

b. Saichand Thota, et al, “Technological Intervention in Agriculture”, Department of E.C.E,


JNTUHCEH, pp. 05-31,44-73,2017.

c. Sohail Arif, et al, “Technological Intervention in Agriculture by Automated Irrigation


System”, Department of E.C.E, JNTUHCEH, pp.7-21,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?

SEEDS RELATED ISSUES:-

1. What is the strategy when they go to buy the seeds?


2. Do they buy just because others are buying?
3. Do they buy according to the climate?
4. Do they take cash crop seeds for more profits?
5. Do they buy according to the type of soil?
6. Do they observe the quality of seeds?
7. Are the seeds easily available?
8. How do they judge quality of seeds?
9. Is there large difference in prices of the same seed?
10. Do they buy seeds from the same place always or it differs?
11. Are there any particular centres or shops where these seeds are available?
12. Is there any representation of the quality of the seeds on the pack (e.g. - premium etc)?
13. Do they sow the seeds directly or do they apply any coating?
14. What are the methods of sowing?
15. Do they require labour for sowing?
16. Do the same seeds give different yield for different people?
17. Do they water seeds immediately after sowing?

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:

1. What are the methods used for harvesting?


2. What has been the trend of yield per acre in last 5 years?
3. Has it increased or decreased? Why?
4. Do weeds always grow every year along with crops?
5. What are the methods used for removing weeds?
6. How much is the productivity affected because of weeds?
7. What are the other factors that affect the productivity badly?
8. Does the land require rest before sowing the next crop?
9. If yes, then how many days?
10. How much time does it take to harvest?
11. What is the process done (if required) on the harvested crop, before sending to market? (e.g.
– removal of husk etc)
12. What are the methods used for that?
13. How much time does it take to complete that process?
14. What are the storage methods (if required)?
15. How much time does it take for the produce to reah the market?
16. What is the method used for taking it to the market?
17. While taking it to the market, during transit, do they lose some amount of productivity?
18. If yes, then why?

MARKET RELATED ISSUES:-

1. Who buys the produce from the market?


2. Who fixes the price?
3. Are they aware of the prices available on the government’s official website?
4. Is the profit margin enough for them?
5. Where is the place where they sell their produce?
6. Does the person, who buys the produce, provide any kind of documentation?
7. Do they always go to the same place every time?
8. For different crops, are there different markets available?
9. After buying from agriculture market, where does the product go?
10. How is it transported till there?
11. Again during transit, is there any loss? If yes, then why?
12. Do they think that their products should be sold directly to the consumers? 13. If yes, then
how much do they wish to price their product? (optional)
14. Is there increase in the prices since last 5 years?

DIGITAL PENETRATION:-

1. How many of them have bank accounts?


2. How many of them have ATM/Debit cards?
3. How many of them have used ATM/Debit card for digital transactions?
45
4. How many of them have internet connection?
5. How many of them have pc?
6. Is there any internet centre in the village?
7. How many of them have smart phones?
8. How many of them have normal phones?
9. How many of them are aware about BHIM app?
10. How many of them are aware about *99# services?
11. How many of them use the above two services?
12. How many ATMs are available?
13. How many banks are available?
14. If banks are not there, how far they are located from the village?
15. If ATMs are not there, how far they are located from the village?
16. Is anyone aware of online marketing? How many of them use it?
17. Is anyone aware of government’s websites available for agriculture? How many of them use
it?
18. Do the people who use smart phones are aware of the agriculture related apps? How many
of them use it?
19. How many of them are aware of the kisan helpline numbers? How many of them use it?
20. How many of them have TV?
21. How many of them have analog cable?
22. How many of them have digital cable?
23. Do they watch DD Kisan channel? How many of them are even aware of it?
24. How many of them are aware of online banking & how many of them use it?
25. What are the other purposes they use TV & smart phones for?

IRRIGATION RELATED ISSUES:-

1. How many acres of land are irrigated?


2. Sources of irrigation since 5 years?
3. How many bore wells are drilled?
4. Is there any availability of other sources for irrigation?(canal, pond, river)
5. Time required for watering plants?
6. Number of times the plants are watered?
7. Is water through bore wells enough?
8. How much farmers are dependent on bore water?
9. The capacity and working condition of motor?
10. Methods adopted to check the availability of ground water?
11. Any problems associated with floods, droughts?
12. Is there any contribution of rain in watering plants?
13. At what times farmers wait for rain?
14. Which type of crop requires more water? Which do not?
15. What is the water absorption capacity of soil in fields?
16. What is the availability of power?(no. of hours)
17. Do you use generators as a substitute for power sources?
18. Is the soil quality same throughout the village?
19. Do you decide the type of crop depending on the type of soil?
20. If there is no ground water? What would they do?
46
21. Did you experience any current shocks while switching on motors?
22. What is the power capacity of motors?
23. How frequently they get damaged?
24. Which type of water source is more advantageous?

PESTICIDES AND MANURES:-

1. How many types of pesticides are there?


2. What are the methods adopted to spray pesticides? 3. Type of pesticides
frequently use?(solid/liquid)
4. Amount of money spent on pesticides?
5. Pesticides are used for what purpose?(to kill germs or to protect plants)
6. Will pesticides affect the purity of plants?
7. Do they use natural manures?
8. Will they prepare manure by themselves or they buy?
9. Which are more advantageous?(pesticides or manures)
10. What are the disadvantages of using pesticides?
11. Is there any machine for spraying?
12. Do they outsource labour while spraying pesticides?

LABOUR RELATED ISSUES:-

1. How many times they will outsource labour?


2. What are the stages where labour is required?
3. How much money will they spend on labour?
4. Differences of money spent on automation and labour?

47

Вам также может понравиться