Project Documentation
Project Documentation
Project Report on
Submitted in partial fulfilment of the requirements for the Award of the degree of
BACHELOR OF TECHNOLOGY
IN
SUBMITTED BY
G.KEERTHANA 17L31A05J6
A. AMRUTHA 17L31A05L6
June-2021
VIGNAN’S INSTITUTE OF INFORMATION TECHNOLOGY
CERTIFICATE
This is to certify that the project report entitled “PLANT DISEASE DETECTION USING
MACHINE LEARNING” is the bonafide record of project work carried out under my
supervision by G. Keerthana(17L31A05J6), B. Dheeraj Varma(17L31A05I8), A.
Amrutha (17L31A05L6), and M. Nissy Grace(17L31A05L9), during the academic year
2020-2021, in partial fulfilment of the requirements for the award of the degree of Bachelor
of Technology in Computer Science and Engineering of Jawaharlal Nehru Technological
University, Kakinada. The results embodied in this project report have not been submitted to
any other University or Institute for the award of any Degree Or Diploma.
We hereby declare that the project report entitled “PLANT DISEASE DETECTION
USING MACHINE LEARNING” has been written by us and has not been submitted either
in part or whole for the award of any degree, diploma or any other similar title to this or any
other university .
Date:
Place:
i
ACKNOWLEDGEMENT
It gives us a great sense of pleasure to acknowledge the assistance and cooperation we have
received from several persons while undertaking this B. Tech. Final Year Project. We owe
special debt of gratitude to Mrs. A. Sravani, Department of Computer Science &
Engineering, for her constant support and guidance throughout the course of our work. Her
sincerity, thoroughness and perseverance have been a constant source of inspiration for us.
We also take the opportunity to acknowledge the contribution of Mr. B. Dinesh Reddy,
Head, Department of Computer Science & Engineering, for his full support and assistance
during the development of the project.
We also do not like to miss the opportunity to acknowledge the contribution of all faculty
members of the department for their kind assistance and cooperation during the development
of our project. Last but not the least, we acknowledge our friends for their contribution in the
completion of the project.
ii
ABSTRACT
Agriculture is the most primary and indispensable source to furnish national income of
numerous countries including India. Getting affected by a disease is very common in
plants due to various factors such as fertilizers , cultural practices followed by
environmental conditions etc. Diseases in plants/crops are the serious causes in
degrading the production quantity and quality, which results in economic losses. Any
technique or method to overcome this problem and getting a warning before the plants
are infected would aid farmers to efficiently cultivate crops or plants, both
qualitatively and quantitatively.
Thus, disease detection in plants plays a very important role in agriculture. Plant
disease symptoms are evident in various parts of plants. In this project we take an
image dataset of some plants with and without diseases. We will use machine learning
classification algorithms to design a model and we will embed that into an android
app which will be able to predict the disease of the plant on seeing an image of the
plant leaf.
iii
CONTENTS
PAGE NO
Declaration i
Acknowledgement ii
Abstract iii
List of Figures viii
List of Abbreviations viii
1. INTRODUCTION 01
1.1 About the Project 02
1.2 Problem statement 02
1.3 Objective of the Project 02
1.4 Achievements 03
2. SYSTEM ANALYSIS 04
2.1 Feasibility study 05
2.1.1 Technical feasibility 05
2.1.2 Social feasibility 05
2.1.3 Operational feasibility 06
2.2 Existing system 06
2.3 Proposed system 06
2.4 System design 07
2.4.1 Input design 07
2.4.2 Output design 07
2.5 System block diagram 08
iv
3. SOFTWARE REQUIREMENT SPECIFICATIONS 09
3.1 Functional requirements 10
3.1.1 Camera 10
3.2 Non functional requirements 10
3.2.1 Efficiency 10
3.2.2 Portability 11
3.2.3 Reliability 11
3.2.4 Availability 11
3.3 Environmental specifications 11
3.3.1 Software requirements 11
3.3.2 Hardware requirements 12
5. SOFTWARE DESIGN 28
5.1 Introduction to UML Diagrams 29
5.1.1 Things 29
5.1.1.1 Structural Things 29
5.1.1.2 Behavioural Things 31
5.1.1.3 Grouping Things 32
5.1.1.4 Annotational Things 32
5.2 UML Diagram 32
5.2.1 Use case diagram 32
5.2.2 Sequence diagram 33
5.2.3 Activity Diagram 34
6. MODULES 36
6.1 OS Module 37
6.2 TensorFlow module 37
6.3 Keras module 37
7. CODING 39
7.1 Machine Learning model code 40
7.2 Android Application Code 45
8. TESTING 50
8.1 Testing 51
8.1.1 Testing objectives 51
8.1.2 Testing Principles 51
vi
8.2 Test Plan 52
8.3 Testing Strategies 52
8.3.1 Types of testing 53
8.3.1.1 White-box testing 53
8.3.1.2 Black-box testing 54
8.3.1.3 Integration testing 54
8.3.1.4 System testing 54
8.3.1.5 Validation testing 55
8.4 Test case design 55
8.4.1 Information to include in a formal test case 55
8.4.2 Identification and classification 55
8.4.3 Instructions 55
8.4.4 Expected result 56
8.4.5 Levels of importance of test cases 56
8.5 Class testing 56
9. OUTPUT SCREENS 58
9.1 Splash Screen 59
9.2 Home page 60
9.3 Output page 61
10. CONCLUSION 62
11. REFERENCES 64
vii
LIST OF FIGURES
Figure No. Figure Name Page No
1 System Block Diagram 08
2 Composition Inheritance 19
3 Flutter Framework Layer 20
4 Handling User Interaction in Flutter 22
5 Architecture of CNN 24
6 Use case diagram 33
7 Sequence diagram 34
8. Activity diagram 35
9 Splash Screen 59
10 Home Page 60
11 Output Page 61
LIST OF ABBREVIATIONS
S.No. Abbreviations Expansion
1 CNN Convolutional Neural Network
2 UML Unified Modelling Language
3 OS Operating System
4 ReLu Rectified Linear Unit
5 GPU Graphics Processing Unit
6 VB Visual Basics
7 UI User Interface
8 JSX Javascript XML
9 XML eXtensible Markup Language
10 API Application Programming Interface
11 SDK Software Development Kit
viii
CHAPTER 1
INTRODUCTION
Indian economy is dependent on agricultural productivity. Over 70% of rural homes depend
on agriculture. Agriculture pays about 17% to the total GDP and provides employment to
over 60% of the population. Therefore detection of plant diseases plays a vital key role in the
arena of agriculture. Indian agriculture is composed of a wide range of crops. All these crops
grow based on the strength of leaves and roots. There are things that lead to different diseases
for the plant leaves, which spoil crops and finally it will affect the economy of the country.
These big losses can be avoided by early identification of plant diseases. Accurate detection
of plant disease is needed to strengthen the field of agriculture and economy of our country.
Various types of Disease kill leaves in a plant. Farmers get more difficulties in identifying
these diseases in its initial stage, they are unable to take precaution on those plants due to lack
of knowledge on those diseases. In the current day the Machine Learning methods are a
suitable, efficient and reliable field for disease detection with help of plant leaf images.
Farmers need fast and efficient techniques to detect all types of diseases of plants that can
save time. These systems can reduce efforts and use of pesticides. For measurement of yields
in agriculture different ideas are proposed by scientists with the help of laboratories and
systems for efficient identification of plant leaf diseases. The proposed Android Application
is one of the solutions to detect various plant diseases in its initial stage.
The objective of the project is to help the farmers by detecting the diseases in the plants at an
early stage and reduce their crop damage and help in cost deduction.
The process of developing this model was an enriching experience. It made us identify and
utilize a variety of learning materials, resources and technology methods to support &
develop this model. A great deal of knowledge has been gained through the trials of the
project, these lessons will be valuable in future endeavors. We got an opportunity to learn
multiple things like tensor flow ,python and dart . The project pronded a unique opportunity
to know and learn about the technical functionalities which play a crucial role in the success
of the project
SYSTEM ANALYSIS
The feasibility of the project is analyzed in this phase and a Socio-beneficiary proposal is put
forth with a very general plan for the project and for the benefit of the farmers. During system
analysis the feasibility study of the proposed system is to be carried out. For feasibility
analysis, some understanding of the major requirements for the system is essential.
❖ TECHNICAL FEASIBILITY
❖ SOCIAL FEASIBILITY
❖ OPERATIONAL FEASIBILITY
The system is developed for an Android environment. Python and Dart programming
languages have been used to develop the system. The technical feasibility has been carried
out. The system is technically feasible for development and can be developed with the
existing facility.
The aspect of study is to check the level of acceptance of the Application by the user. This
includes the process of training the user to use the Application efficiently. The user must feel
the ease of using the Application. The level of acceptance by the users solely depends on the
methods that are employed to educate the user about the Application and to make him
familiar with it. His level of confidence must be raised so that he is also able to make some
constructive criticism, which is welcomed, as he is the final user of the system.
Operational feasibility determines if the proposed Application satisfies user objectives and
can be fitted into current system operation. As the user requires minimum knowledge about
how to use an android phone, So it can be considered as operationally feasible.
● In the existing system, A machine learning model is used to detect the disease of the
plant by taking the picture of the plant as input.
Drawbacks:
● It will be difficult for the farmers to use this model since they have to input the
images in a computer.
● It has not focused on increasing the recognition rate and classification accuracy of the
diseases.
● In the proposed system we can identify the diseases of the plant by giving the image
of the plant as input in the Android application which is embedded by our machine
learning model.
● The accuracy of this model of the proposed model is ranging around 80-90%.
Benefits:
● The Android Application was developed in such a way that is easy and user friendly
for the farmers to use.
The input design is the link between the information system and the user. It comprises the
developing specification and procedures for data preparation and those steps necessary to put
data into a usable form for processing and can be achieved by the Application to input data
from camera (capture image) or upload image from file manager.The input is designed in
such a way so that it provides security and ease of use with retaining privacy. Input Design
considered the following things:
An output is one, which meets all the requirements of the goals of the project. In this
Application results are communicated to the users via screen.In output design it is determined
how the information is to be displaced for immediate need. It is the most important and direct
source of information to the user. Efficient and intelligent output design improves the
Application’s relationship to help people in plant disease Detection. Designing the
Application output should proceed in an organized, well thought out manner; the right output
must be developed while ensuring that each output so that users will find that the Application
can be used easily and effectively.
3.1.1 CAMERA
Input:The camera ensures to capture the image which is used in the further process
Processing:The Application which is designed ensures to detect the type of disease of the
plant.
Output:If the model is processed successfully we will get the output as which type of disease
is it.
3.2.1. EFFICIENCY
Efficiency is concerned with the system resources used when providing the required
functionality. The amount of disk space, memory, network etc. provides a good indication of
this characteristic.This application focuses on increasing the recognition rate and
3.2.2. PORTABILITY
Portability specifies the ease with which the application can be installed on all
necessary platforms, and the platforms on which it is expected to run. We had to use Dart and
Python for developing our project. Since our application is an android application we can run
only on mobile phones which have android operating system.So our Application is
moderately portable
3.2.3. RELIABILITY
Reliability characteristic defines the capability of the application to maintain its
service provision under defined conditions for defined periods of time. One aspect of this
characteristic is fault tolerance that is the ability of an application to withstand component
failure. All the details provided by the user are recorded. Hence we can say the application is
extremely reliable.
3.2.4. AVAILABILITY
Availability is the ratio of time an application or component is functional to the total
time it is required or expected to function. The user can always use the application when he
has an android mobile phone in which the application is installed.Our application can be
accessed by users at any time and place since it is easier to use unlike a Machine Learning
Model.
● CPU : I5 or later
● RAM : 8GB or above
● INPUT DEVICE : Android Mobile phone
● OUTPUT DEVICE : Android Mobile Phone
● SPEED : 1.1GHZ
● Interactive
● Interpreted
● Modular
● Dynamic
● Portable
● High level
4. Productivity
With its strong process integration features, unit testing framework and enhanced control
capabilities contribute towards the increased speed for most applications and
productivity of applications. It is a great option for building scalable multi-protocol
network applications.
4. Run-time Errors
The Python language is dynamically typed so it has many design restrictions that are
reported by some Python developers.
It is even seen that it requires more testing time, and the errors show up when the
applications are finally run.
● An SDK (Software Development Kit): A collection of tools that are going to help you
develop your applications. This includes tools to compile your code into native
machine code (code for iOS and Android).
● A Framework (UI Library based on widgets): A collection of reusable UI elements
(buttons, text inputs, sliders, and so on) that you can personalize for your own needs
Figure 2: Composition>Inheritance
You can also control the layout of a widget by composing it with other widgets. For example,
to centre a widget, you wrap it in a Centre widget. There are widgets for padding, alignment,
row, columns, and grids. These layout widgets do not have a visual representation of their
own. Instead, their sole purpose is to control some aspect of another widget’s layout. To
understand why a widget renders in a certain way, it’s often helpful to inspect the
neighbouring widgets.
The upper layers of the framework are used more frequently than the lower layers. For the
complete set of libraries that make up Flutter's layered framework, see API documentation.
The goal of this design is to help you do more with less code. For example, the Material
layer is built by composing basic widgets from the widgets layer, and the widgets layer
itself is built by orchestrating lower-level objects from the rendering layer.
The layers offer many options for building apps. Choose a customized approach to unlock
the full expressive power of the framework, or use building blocks from the widgets layer,
or mix and match. You can compose the ready-made widgets Flutter provides, or create
your own custom widgets using the same tools and techniques that the Flutter team used to
build the framework.
Nothing is hidden from you. You reap the productivity benefits of a high-level, unified
widget concept, without sacrificing the ability to dive as deeply as you wish into the lower
layers.
● A fully connected layer that utilizes the output from the convolution process and
predicts the class of the image based on the features extracted in previous stages.
There are three types of layers that make up the CNN which are the convolutional layers,
pooling layers, and fully-connected (FC) layers. When these layers are stacked, a CNN
architecture will be formed. In addition to these three layers, there are two more important
parameters which are the dropout layer and the activation function which are defined below.
This layer is the first layer that is used to extract the various features from the input images.
In this layer, the mathematical operation of convolution is performed between the input
image and a filter of a particular size MxM. By sliding the filter over the input image, the dot
product is taken between the filter and the parts of the input image with respect to the size of
the filter (MxM).The output is termed as the Feature map which gives us information about
the image such as the corners and edges. Later, this feature map is fed to other layers to learn
several other features of the input image.
In Max Pooling, the largest element is taken from the feature map. Average Pooling
calculates the average of the elements in a predefined size Image section. The total sum of the
elements in the predefined section is computed in Sum Pooling. The Pooling Layer usually
serves as a bridge between the Convolutional Layer and the FC Layer
The Fully Connected (FC) layer consists of the weights and biases along with the neurons
and is used to connect the neurons between two different layers. These layers are usually
placed before the output layer and form the last few layers of a CNN Architecture.
In this, the input image from the previous layers are flattened and fed to the FC layer. The
flattened vector then undergoes few more FC layers where the mathematical functions
operations usually take place. In this stage, the classification process begins to take place.
4.5.3.4. DROPOUT
Usually, when all the features are connected to the FC layer, it can cause overfitting in the
training dataset. Overfitting occurs when a particular model works so well on the training
data causing a negative impact in the model’s performance when used on new data.
To overcome this problem, a dropout layer is utilised wherein a few neurons are dropped
from the neural network during training process resulting in reduced size of the model. On
passing a dropout of 0.3, 30% of the nodes are dropped out randomly from the neural
network.
Finally, one of the most important parameters of the CNN model is the activation function.
They are used to learn and approximate any kind of continuous and complex relationship
between variables of the network. In simple words, it decides which information of the model
should fire in the forward direction and which ones should not at the end of the network.
It adds non-linearity to the network. There are several commonly used activation functions
such as the ReLU, Softmax, TanH and the Sigmoid functions. Each of these functions have a
specific usage. For a binary classification CNN model, sigmoid and softmax functions are
4.6 MOBILENET
MobileNet is a CNN architecture model for Image Classification and Mobile Vision.There
are other models as well but what makes MobileNet special that it very less computation
power to run or apply transfer learning to.This makes it a perfect fit for Mobile
devices,embedded systems and computers without GPU or low computational efficiency with
compromising significantly with the accuracy of the results.It is also best suited for web
● MobileNets for mobile and embedded vision applications is proposed, which are
based on a streamlined architecture that uses depth wise separable convolutions to
build light weight deep neural network
5.1.1. THINGS:
These are the abstractions that are first class citizens in a model. These are four kinds
of things mostly used in UML:
● Structural Things
● Behavioural Things
● Grouping Things
● Annotational Things
Class_Name
Attributes
Operations
Interface
● Collaboration
Collaboration defines interaction between elements. Collaborations have structural, as
well as behavioural, dimensions. Collaboration is rendered as an ellipse with dashed
lines, sometimes including only its name.
Chain of responsibility
● Use case
Use case represents a set of actions performed by a system for a specific goal.
Graphically, a use case is rendered as an ellipse with solid lines, usually including
only its name.
Place order
● Active Class
An active class is a class whose objects own one or more processes or threads and
therefore can initiate control activity. It is just like a class except that its objects
represent elements whose behaviour is concurrent with other elements.
Class_Name
● Component
Component describes the physical part of a system. Graphically, a component is
rendered like a class with a special icon in the upper right corner.
Orderform.java
● Node
A node can be defined as a physical element that exists at run time. Graphically, a
node is rendered as a cube.
● Interaction
Interaction is defined as a behaviour that consists of a group of messages exchanged
among elements to accomplish a specific task. Graphically, a message is rendered as a
directed line.
Message
● State machine
State machine is useful when the state of an object in its life cycle is important. It
defines the sequence of states an object goes through in response to events. Events are
external factors responsible for state change.
Package
MODULES
6.1 OS MODULE:
The OS module in Python provides functions for interacting with the operating system. OS
comes under Python’s standard utility modules. This module provides a portable way of
using operating system dependent functionality. The *os* and *os.path* modules include
many functions to interact with the file system.
Keras runs on top of open source machine libraries like TensorFlow, Theano or
Cognitive Toolkit (CNTK). Theano is a python library used for fast numerical
computation tasks. TensorFlow is the most famous symbolic math library used for
creating neural networks and deep learning models. TensorFlow is very flexible and the
CODING
import tensorflow as tf
#tf.logging.set_verbosity(tf.logging.ERROR)
#tf.enable_eager_execution()
import os
drive.mount('/content/drive')
files.upload()
! mkdir ~/.kaggle
! cp kaggle.json ~/.kaggle/
#Load data
file_folder="/content/plantvillagek.zip"
train_dir = "/content/PlantVillage/train/"
validation_dir = "/content/PlantVillage/val/"
import time
import os
for f in pack[2]:
counter += 1
#Data Preprocessing
BATCH_SIZE = 64
validation_datagen = tf.keras.preprocessing.image.ImageDataGenerator(rescale=1./255)
validation_generator = validation_datagen.flow_from_directory(
validation_dir,
shuffle=False,
seed=42,
color_mode="rgb",
class_mode="categorical",
target_size=IMAGE_SHAPE,
batch_size=BATCH_SIZE)
if do_data_augmentation:
train_datagen = tf.keras.preprocessing.image.ImageDataGenerator(
rescale = 1./255,
rotation_range=40,
horizontal_flip=True,
width_shift_range=0.2,
height_shift_range=0.2,
shear_range=0.2,
zoom_range=0.2,
fill_mode='nearest' )
else:
train_datagen = validation_datagen
train_generator = train_datagen.flow_from_directory(
train_dir,
subset="training",
shuffle=True,
seed=42,
color_mode="rgb",
class_mode="categorical",
target_size=IMAGE_SHAPE,
batch_size=BATCH_SIZE)
model = tf.keras.Sequential([
hub.KerasLayer("https://tfhub.dev/google/tf2-preview/mobilenet_v2/feature_vector/4",
output_shape=[1280],trainable=False),
tf.keras.layers.Dropout(0.4),
tf.keras.layers.Dense(512, activation='relu'),
tf.keras.layers.Dropout(rate=0.2),
tf.keras.layers.Dense(train_generator.num_classes, activation='softmax')
])
EPOCHS=20
history = model.fit_generator(
train_generator,
steps_per_epoch=train_generator.samples//train_generator.batch_size,
epochs=EPOCHS,
validation_data=validation_generator,
validation_steps=validation_generator.samples//validation_generator.batch_size)
model.save('weights.h5')
model.save(filepath="/content/weights.h5")
new_model= tf.keras.models.load_model(filepath="/content/weights.h5")
model.load("/content/weights.h5")
x = np.random.uniform(size=(4, 32)).astype(np.float32)
predicted = tensorflow_graph(x).numpy()
model.save(KERAS_MODEL_NAME)
tf_lite_converter = tf.lite.TFLiteConverter.from_keras_model(KERAS_MODEL_NAME)
tflite_model = tf_lite_converter.convert()
Main.dart:
Home.dart:
TESTING
8.1. TESTING
Software testing is a critical element of software quality assurance and represents the
ultimate service of specification design and coding. The increasing visibility of software as a
system element and the attended costs associated with the software failure and motivating
forces for well planned, through testing. It is not unusual for a software developer to spend
between 30 and 40 percent of total project effort in testing.
System Testing Strategies for this system integrate test case design techniques into a
well-planned series of steps that result in the successful construction of this software. It also
provides a road map for the developer, the quality assurance organization and the customer, a
roadmap that describes the steps to be conducted as a path of testing, when these steps are
planned and then undertaken and how much effort, time and resources will be required. The
test provisions are as follows.
8.4.3. INSTRUCTIONS
These tell the tester exactly what to do. The instructions must tell the tester how to put
the system into the required initial state and what inputs to provide.
OUTPUT SCREENS
CONCLUSION
This project proposes an Android Application which is embedded with a machine learning
model helpful in detecting the plant's diseases. This project was made for the benefit of
farmers .. We used Dart, python,tensorflow, keras and CNN to detect diseases of some plants.
The model is tested with real time images and gives a good accuracy above 80%.This
specific model could be used as a use case for edge analytics. Furthermore, the proposed
method achieves state-of-the-art results on a plant disease detection dataset. By the
development of plant disease detection we can detect diseases in the earlier stage and reduce
the crop damage.This project has a good future scope in helping the farmers and improves
cost reduction for farmers. This is a socio beneficiary project
REFERENCES
1. Sachin D. Khirade, A.B. Patil, “Plant Disease Detection Using Image Processing”
IEEE, International Conference on Computing Communication Control and
Automation Feb 2015.
2. Gittaly Dhingra, Vinay Kumar, Hem Dutt Joshi ,“Study of digital image processing
techniques for leaf disease detection and classification,” Springer-Science, 29
November 2017
4. Aakanksha Rastogi, Ritika Arora and Shanu Sharma, "Leaf disease detection and
grading using computer vision technology & fuzzy logic", 2015 2nd International
Conference on Signal Processing and Integrated Networks(SPIN) 2015.
6. Anil A.Bharate and M.S. Shirdhonkar, “Plant Disease Detection using image
processing”, 2017 International Conference on Intelligent Sustainable
Systems(ICISS),2017