0% found this document useful (0 votes)
117 views75 pages

MP Documentation

This document describes a project that aims to detect plant diseases using deep learning and image processing. It presents work done by three students to fulfill the requirements for a Bachelor of Technology degree in Computer Science and Engineering. The project involved building a model to identify plant diseases by analyzing images of crop leaves. Deep learning and computer vision techniques were used to automatically extract features from the images and detect diseases without requiring human expertise. The model could classify images into 12 different classes corresponding to 3 crop species and 9 common diseases. The goal of the project was to develop an accurate and reliable system to help with plant disease identification and increase agricultural production.

Uploaded by

omkar ejjagiri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
117 views75 pages

MP Documentation

This document describes a project that aims to detect plant diseases using deep learning and image processing. It presents work done by three students to fulfill the requirements for a Bachelor of Technology degree in Computer Science and Engineering. The project involved building a model to identify plant diseases by analyzing images of crop leaves. Deep learning and computer vision techniques were used to automatically extract features from the images and detect diseases without requiring human expertise. The model could classify images into 12 different classes corresponding to 3 crop species and 9 common diseases. The goal of the project was to develop an accurate and reliable system to help with plant disease identification and increase agricultural production.

Uploaded by

omkar ejjagiri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 75

PLANT DISEASE DETECTION USING DEEP

LEARNING AND IMAGE PROCESSING

A mini project-1 report submitted in partial fulfillment of


requirements for the award of Degree of

BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE AND ENGINEERING

By

L.SREYA REDDY (199X1A0578)


M.SAI PRANATHI (199X1A0534)
M.JAHNAVI (199X1A0591)

Under the Esteemed guidance of

Smt. S. Aarthi

Assistant Professor
Department of C.S.E.

Department of Computer Science and Engineering


G. PULLA REDDY ENGINEERING COLLEGE (Autonomous): KURNOOL
(Affiliated to JNTUA, ANANTAPURAMU)

2021 – 2022
Department of Computer Science and Engineering
G. PULLA REDDY ENGINEERING COLLEGE (Autonomous): KURNOOL
(Affiliated to JNTUA, ANANTAPURAMU)

CERTIFICATE

This is to certify that the mini project-1 work entitled ‘PLANT


DISEASE DETECTION USING DEEP LEARING AND
IMAGE PROCESSING’ is a bona fide record of work carried out by

L.SAREYA REDDY (199X1A0578)


M.SAI PRANATHI (199X1A0534)
M.JAHNAVI (199X1A0591)

Under my guidance and supervision in fulfillment of the


requirements for the award of degree of

BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE & ENGINEERING

Smt. S. AARTHI Dr. N. Kasiviswanath,


Assistant Professor, Professor & Head of the Department,
Department of CSE, Department of CSE.
G. PullaReddy Engineering College, G. PullaReddy Engineering College,
Kurnool. Kurnool.
DECLARATION

We hereby declare that the project titled “PLANT DISEASE DETECTION


BASED ON DEEP LEARNING AND IMAGE PROCESSING” is the authentic work
carried out by us as students of G. PULLA REDDY ENGINEERING COLLEGE
(Autonomous) Kurnool, during October 2021 - March 2022 and has not been submitted
elsewhere for the award of degree in part or in full to any institute.

L.SREYA REDDY
(199X1A0578)

M.SAI PRANATHI
(199X1A0534)

M.JAHNAVI
(199X1A0591)

1ii
2ii
ACKNOWLEDGEMENT

We wish to express our deep sense of gratitude to our project guide,


Smt.S.Aarthi Assistant Professor of CSE Department, G. Pulla Reddy Engineering
College, for her immaculate guidance, constant encouragement and cooperation which
have made this project work possible.

We are grateful to our project incharge, Sri.S.Vinay kumar, Asst Professor of


CSE Department, G. Pulla Reddy Engineering College, for helping us and giving us
the required information needed for our project work.

We are thankful to our Head of the Department Dr. N. Kasi Viswanath, for
his whole hearted support and encouragement during the project sessions.

We are grateful to our respected Principal Dr. B. Sreenivasa Reddy, for


providing requisite facilities and helping us in providing such a good environment.

We wish to convey our acknowledgements to all the staff members of the


Computer Science Engineering Department for giving the required information needed
for our project work.

Finally we wish to thank all our friends and well wishers who have helped us
directly or indirectly during the course of this project work.

1v
Plant Disease Detection Based On Deep Learning And Image Processing

CHAPTERS PageNo

ABSTRACT 5

1.INTRODUCTION 6

1.1 Introduction 7

1.2 Objective of the project 8

1.3 Organization of the project 9

2.SYSTEM SPECIFICATION 10

2.1 Software Specification 11

2.2 Hardware Specification 11

3.DESIGN AND IMPLEMENTATION 12

3.1 Introduction 13

3.2 System Design 26

3.2.1 Numpy 26

3.2.2 Pandas 28

3.2.3 Matplotlib 29

3.2.4 Keras 29

3.2.5 Google Colaboratory 30

3.2.6 VGG19 31

3.3 Source Code 33

DEPT OF CSE,GPREC,KNLPage 1
Plant Disease Detection Based On Deep Learning And Image Processing

3.3.1 Output Screens 38

3.4Testing and Validation 48

4.CONCLUSION 65

4.1Conclusion 66

5.REFERENCES 67

DEPT OF CSE,GPREC,KNLPage 2
Plant Disease Detection Based On Deep Learning And Image Processing

List of Images PageNo


Fig 3.1.a brief overview of AI, ML, DL 14
Fig 3.1.b A CNN sequence 15
Fig 3.1.b ConvNets 16
Fig 3.1.d Convoluting an image with a kernel to get 16
convoluted feature
Fig 3.1.e Movement of the Kernal 17
Fig 3.1.f Image Channel and Kernal Channel 18
Fig 3.1.g Convolution Operation of matrix 19
Fig 3.1.h Pooling Layer 20
Fig 3.1.i Types of Pooling 21
Fig 3.1.j Flatten Layer 22
Fig 3.1.k Dense Layer 23
Fig 3.1.l Connected Layer 24
Fig 3.1.m VGGNet 24
Fig 3.2.3.a Types of plots in Matplotlib 26
Fig 3.2.6.a Basic architecture of VGG19 32

DEPT OF CSE,GPREC,KNLPage 3
Plant Disease Detection Based On Deep Learning And Image Processing

ABSTRACT

DEPT OF CSE,GPREC,KNLPage 4
Plant Disease Detection Based On Deep Learning And Image Processing

ABSTRACT
Plant disease diagnosis is very critical for agriculture due to its importance for increasing crop
production.Recent advances in image processing offer us a new way to solve this issue via visual
plant disease analysis.In this project model, we systematically investigate the problem of visual
plant disease recognition for plant disease diagnosis.The detection process marks the beginning
of a series of activities to fight the diseases and reduce their spread. Compared with other types
of images, plant disease images generally exhibit randomly distributed lesions, diverse
symptoms and complex backgrounds, and thus are hard to capture discriminative information.
To facilitate plant disease recognition research, we considered a dataset consisting of about 3,000
images of healthy and diseased crop leaves which is categorized into 12 different classes of 3
crop species and 9 diseases . The use of technology in the detection and analysis process
increases the accuracy and reliability of these processes. We expect this model will further the
agenda of plant disease recognition in the community of image processing.

DEPT OF CSE,GPREC,KNLPage 5
Plant Disease Detection Based On Deep Learning And Image Processing

1.INTRODUCTION

DEPT OF CSE,GPREC,KNLPage 6
Plant Disease Detection Based On Deep Learning And Image Processing

1.1INTRODUCTION
In India, about 70% of the population relies on agriculture. Identification of plant diseases
is important to prevent losses within the yield. It's troublesome to observe plant diseases
manually.

It needs a tremendous quantity of labor, expertise within the plant diseases, and
conjointly needs the excessive time interval. Hence, image processing and deep learning
models can be employed for the detection of plant diseases.

In this project, we have described the technique for the detection of plant diseases with
the help of their leaves pictures. Image processing is a branch of signal processing that
can extract the image properties or useful information from the image.

Deep learning is a subpart of artificial intelligence which works automatically or gives


instructions to do a particular task. The main aim of deep learning is to eliminate some
of the data pre-processing that is typically involved with machine learning.

The algorithms can ingest and process unstructured data, like text and images, and they
automate feature extraction, removing some of the dependency on human experts. So it
can assist in good decision making and predicting the correct output using a large amount
of training data.

The color of leaves, amount of damage to leaves, area of the leaf, texture parameters are
used for classification. In this project, we have analyzed different image parameters or
features to identify different plant leaves diseases to achieve the best accuracy

DEPT OF CSE,GPREC,KNLPage 7
Plant Disease Detection Based On Deep Learning And Image Processing

1.2 OBJECTIVE OF THE REPORT

Previously plant disease detection was done by visual inspection of the leaves or some chemical
processes by experts. For doing so, a large team of experts, as well as continuous observation of
plants, is needed, which costs high when we do with large farms.

In such conditions, the recommended system proves to help monitor large fields of crops.
Automatic detection of the diseases by simply seeing the symptoms on the plant leaves makes it
easier as well as cheaper.

DEPT OF CSE,GPREC,KNLPage 8
Plant Disease Detection Based On Deep Learning And Image Processing

1.3 ORGANIZATION OF THE REPORT

The first chapter deals with the introduction of the Plant Disease Detection Based on
Deep Learning and Image Processing , motivating for developing this project, objective of the
project. The second chapter deals with the system specifications. The third chapter gives us the
Design and implementations which includes introduction, source code and description of the
programming languages used for the project, methods of implementation. Finally the fourth
chapter deals with the conclusion.

DEPT OF CSE,GPREC,KNLPage 9
Plant Disease Detection Based On Deep Learning And Image Processing

2.SYSTEM SPECIFICATIONS

DEPT OF CSE,GPREC,KNLPage 10
Plant Disease Detection Based On Deep Learning And Image Processing

2. SYSTEM SPECIFICATIONS
2.1 SOFTWARE SPECIFICATIONS
Software Requirement Specification is the starting point of the software developing
activity. As the system grew complex it became evident that the goal of the entire system cannot
be easily comprehended. Hence the need for the requirement arose. The software is limited by
the client’s side. The SRS is the means of translating the ideas of the minds of the clients (the
input) into a formal document.
➢ Operating system: Windows XP/7/8/10
➢ Coding Language: Python
➢ Development environment: Google Colab
➢ Dataset: Kaggle dataset

2.2 HARDWARE SPECIFICATIONS


The most common set of requirements defined by any operating system or software
application is the physical computer resources, also known as hardware. A hardware
requirements list is often accompanied by a hardware compatibility list (HCL), especially in case
of operating systems. An HCL list is tested, compatible and sometimes incompatible hardware
devices for a particular operating system or application. The following subsections discuss the
various aspects of hardware requirements. They are peripherals, secondary storage, processing
power and memory.
➢ System : Intel core i3/ i5
➢ Hard Disk : 1TB / 2TB
➢ RAM : 4 GB & more
➢ Speed : 1.1GHz minimum
➢ Monitor : Any monitor
➢ Keyboard : Standard Keyboard
➢ Mouse : Two or Three Button Mouse

DEPT OF CSE,GPREC,KNLPage 11
Plant Disease Detection Based On Deep Learning And Image Processing

3.DESIGN AND IMPLEMENTATION

DEPT OF CSE,GPREC,KNLPage 12
Plant Disease Detection Based On Deep Learning And Image Processing

3.DESIGN AND IMPLEMENTATION


3.1 INTRODUCTION
India is a cultivated country and about 70% of the population depends on agriculture. Farmers
have a large range of diversity for selecting various suitable crops and finding suitable
pesticides for plants. Disease on plants leads to a significant reduction in both the quality and
quantity of agricultural products. The studies of plant disease refer to the studies of visually
observable patterns on the plants. Monitoring of health and disease on plants plays an important
role in the successful cultivation of crops on the farm. In the early days, the monitoring and
analysis of plant diseases were done manually by experts in that field. This requires
a tremendous amount of work and also requires excessive processing time. The image processing
techniques can be used in plant disease detection. In most cases, disease symptoms are
seen on the leaves, stems, and fruit. The plant leaf for the detection of disease is considered
which shows the disease symptoms. This gives the introduction to the image processing
techniques used for plant disease detection.

Deep learning is a machine learning technique that teaches computers to do what comes naturally
to humans.Deep learning is a part of machine learning, which is in turn part of a larger umbrella
called AI as shown in the Fig 1.1.2 below. In other words, you can say Deep Learning is a
special type of machine learning consisting of a few algorithms which are designed to learn from
large amounts of data or unstructured data like images, texts, and audio. These algorithms are
inspired by the way our brain works. Deep learning algorithms like ANN, CNN, RNN, LSTM,
etc. attempt to mimic the behavior of the neural network present in our brains. In deep learning, a
computer model learns to perform classification tasks directly from images, text, or sound. Deep
learning models can achieve state-of-the-art accuracy, sometimes exceeding human-level
performance. Models are trained by using a large set of labeled data and neural network
architectures that contain many layers.

DEPT OF CSE,GPREC,KNLPage 13
Plant Disease Detection Based On Deep Learning And Image Processing

Fig 3.1.a brief overview of AI, ML, DL

PREPROCESSING IMAGES USING KERAS:


ImageDataGenerator that rescales the images,applies shear in some range, zooms the image and
does horizontal flipping with the image. This ImageDataGenerator includes all possible
orientations of the image.

The Keras preprocessing layers API allows developers to build Keras-native input processing
pipelines. These input processing pipelines can be used as independent preprocessing code in
non-Keras workflows, combined directly with Keras models, and exported as part of a Keras
SavedModel.

With Keras preprocessing layers, you can build and export models that are truly end-to-end:
models that accept raw images or raw structured data as input; models that handle feature
normalization or feature value indexing on their own.

These layers are for standardizing the inputs of an image model.

DEPT OF CSE,GPREC,KNLPage 14
Plant Disease Detection Based On Deep Learning And Image Processing

● tf.keras.layers.Resizing: resizes a batch of images to a target size.


● tf.keras.layers.Rescaling: rescales and offsets the values of a batch of image (e.g. go from
inputs in the [0, 255] range to inputs in the [0, 1] range.
● tf.keras.layers.CenterCrop: returns a center crop of a batch of images.

INTRODUCTION TO CNN

A CNN sequence to classify handwritten digits


Fig 3.1.b A CNN sequence

A Convolutional Neural Network (ConvNet/CNN) is a Deep Learning algorithm that can take in
an input image, assign importance (learnable weights and biases) to various aspects/objects in the
image, and be able to differentiate one from the other. The pre-processing required in a ConvNet
is much lower as compared to other classification algorithms. While in primitive methods filters
are hand-engineered, with enough training, ConvNets have the ability to learn these
filters/characteristics.
The architecture of a ConvNet is analogous to that of the connectivity pattern of Neurons in the
Human Brain and was inspired by the organization of the Visual Cortex. Individual neurons
respond to stimuli only in a restricted region of the visual field known as the Receptive Field. A
collection of such fields overlap to cover the entire visual area.
Why ConvNets over Feed-Forward Neural Nets?

DEPT OF CSE,GPREC,KNLPage 15
Plant Disease Detection Based On Deep Learning And Image Processing

Fig 3.1.b ConvNets


An image is nothing but a matrix of pixel values, right? So why not just flatten the image (e.g.
3x3 image matrix into a 9x1 vector) and feed it to a Multi-Level Perceptron for classification
purposes?
In cases of extremely basic binary images, the method might show an average precision score
while performing prediction of classes but would have little to no accuracy when it comes to
complex images having pixel dependencies throughout.
A ConvNet can successfully capture the Spatial and Temporal dependencies in an image
through the application of relevant filters. The architecture performs a better fitting to the image
dataset due to the reduction in the number of parameters involved and the reusability of weights.
In other words, the network can be trained to understand the sophistication of the image better.

INPUT IMAGE

DEPT OF CSE,GPREC,KNLPage 16
Plant Disease Detection Based On Deep Learning And Image Processing

Fig 3.1.c Input Image for ConvNet

In the figure, we have an RGB image that has been separated by its three color planes — Red,
Green, and Blue. There are several such color spaces in which images exist — Grayscale, RGB,
HSV, CMYK, etc.
Computationally intensive things would get once the images reach dimensions, say 8K
(7680×4320). The role of the ConvNet is to reduce the images into a form that is easier to
process, without losing features that are critical for getting a good prediction. This is important
when we are to design an architecture that is not only good at learning features but also is
scalable to massive datasets.

CONVOLUTION LAYER — THE KERNAL

Convoluting a 5x5x1 image with a 3x3x1 kernel to get a 3x3x1 convolved feature
Fig 3.1.d Convoluting an image with a kernel to get convoluted feature

mage Dimensions = 5 (Height) x 5 (Breadth) x 1 (Number of channels, eg. RGB)

DEPT OF CSE,GPREC,KNLPage 17
Plant Disease Detection Based On Deep Learning And Image Processing

In the above demonstration, the green section resembles our 5x5x1 input image, I. The element
involved in carrying out the convolution operation in the first part of a Convolutional Layer is
called the Kernel/Filter, K, represented in the color yellow. We have selected K as a 3x3x1
matrix.

Kernel/Filter, K = 1 0 1
0 1 0
1 0 1

The Kernel shifts 9 times because of Stride Length = 1 (Non-Stridethat), every time
performing a matrix multiplication operation between K and the portion P of the image over
which the kernel is hovering

Movement of the Kernel


Fig 3.1.e Movement of the Kernal

DEPT OF CSE,GPREC,KNLPage 18
Plant Disease Detection Based On Deep Learning And Image Processing

The filter moves to the right with a certain Stride Value till it parses the complete width. Moving
on, it hops down to the beginning (left) of the image with the same Stride Value and repeats the
process until the entire image is traversed.

Fig 3.1.f Image Channel and Kernal Channel


In the case of images with multiple channels (e.g. RGB), the Kernel has the same depth as that of
the input image. Matrix Multiplication is performed between Kn and In stack ([K1, I1]; [K2, I2];
[K3, I3]) and all the results are summed with the bias to give us a squashed one-depth channel
Convoluted Feature Output.

DEPT OF CSE,GPREC,KNLPage 19
Plant Disease Detection Based On Deep Learning And Image Processing

Convolution Operation with Stride Length = 2


Fig 3.1.g Convolution Operation of matrix
The objective of the Convolution Operation is to extract the high-level features such as edges,
from the input image. ConvNets need not be limited to only one Convolutional Layer.
Conventionally, the first ConvLayer is responsible for capturing the Low-Level features such as
edges, color, gradient orientation, etc. With added layers, the architecture adapts to the
High-Level features as well, giving us a network that has a wholesome understanding of images
in the dataset, similar to how we would.

There are two types of results to the operation — one in which the convolved feature is reduced
in dimensionality as compared to the input, and the other in which the dimensionality is either
increased or remains the same. This is done by applying Valid Padding in the case of the former,
or the Same Padding in the case of the latter.

DEPT OF CSE,GPREC,KNLPage 20
Plant Disease Detection Based On Deep Learning And Image Processing

same padding: 5x5x1 image is padded with 0s to create a 6x6x1 image


When we augment the 5x5x1 image into a 6x6x1 image and then apply the 3x3x1 kernel over it,
we find that the convolved matrix turns out to be of dimensions 5x5x1. Hence the name — Same
Padding.
On the other hand, if we perform the same operation without padding, we are presented with a
matrix that has dimensions of the Kernel (3x3x1) itself — Valid Padding.
The following repository houses many such GIFs which would help you get a better
understanding of how Padding and Stride Length work together to achieve results relevant to our
needs.

POOLING LAYER

3x3 pooling over 5x5 convolved feature


Fig 3.1.h Pooling Layer

DEPT OF CSE,GPREC,KNLPage 21
Plant Disease Detection Based On Deep Learning And Image Processing

Similar to the Convolutional Layer, the Pooling layer is responsible for reducing the spatial size
of the Convolved Feature. This is to decrease the computational power required to process
the data through dimensionality reduction. Furthermore, it is useful for extracting dominant
features which are rotational and positional invariant, thus maintaining the process of effectively
training the model.
There are two types of Pooling: Max Pooling and Average Pooling. Max Pooling returns the
maximum value from the portion of the image covered by the Kernel. On the other hand,
Average Pooling returns the average of all the values from the portion of the image covered by
the Kernel.
Max Pooling also performs as a Noise Suppressant. It discards the noisy activations altogether
and also performs de-noising along with dimensionality reduction. On the other hand, Average
Pooling simply performs dimensionality reduction as a noise suppressing mechanism. Hence, we
can say that Max Pooling performs a lot better than Average Pooling.

Types of Pooling
Fig 3.1.i Types of Pooling

DEPT OF CSE,GPREC,KNLPage 22
Plant Disease Detection Based On Deep Learning And Image Processing

The Convolutional Layer and the Pooling Layer, together form the i-th layer of a Convolutional
Neural Network. Depending on the complexities in the images, the number of such layers may
be increased for capturing low-level details even further, but at the cost of more computational
power.
After going through the above process, we have successfully enabled the model to understand
the features. Moving on, we are going to flatten the final output and feed it to a regular Neural
Network for classification purposes.
FLATTEN LAYER

Fig 3.1.j Flatten Layer

Flattening is converting the data into a 1-dimensional array for inputting it to the next layer. We
flatten the output of the convolutional layers to create a single long feature vector. And it is
connected to the final classification model, which is called a fully-connected layer.

DENSE LAYER

DEPT OF CSE,GPREC,KNLPage 23
Plant Disease Detection Based On Deep Learning And Image Processing

Fig 3.1.k Dense Layer


Dense Layer is a simple layer of neurons in which each neuron receives input from all the
neurons of previous classify image based on output from convolutional layers.layer, thus called
as dense. Dense Layer is used to classify images based on the output of the convolution layer.

CLASSIFICATION FULLY— CONNECTED LAYER (FC Layer)

Fig 3.1.l Connected Layer

DEPT OF CSE,GPREC,KNLPage 24
Plant Disease Detection Based On Deep Learning And Image Processing

Adding a Fully-Connected layer is a (usually) cheap way of learning non-linear combinations of


the high-level features as represented by the output of the convolutional layer. The
Fully-Connected layer is learning a possibly non-linear function in that space.
Now that we have converted our input image into a suitable form for our Multi-Level Perceptron,
we shall flatten the image into a column vector. The flattened output is fed to a feed-forward
neural network and backpropagation is applied to every iteration of training. Over a series of
epochs, the model can distinguish between dominating and certain low-level features in images
and classify them using the Softmax Classification technique.
There are various architectures of CNNs available which have been key in building algorithms
that power and shall power AI as a whole in the foreseeable future. Some of them have been
listed below:
1. LeNet
2. AlexNet
3. VGGNet
4. GoogLeNet
5. ResNet
6. ZFNet

VGGNET:

VGGNet is a Convolutional Neural Network architecture proposed by Karen Simonyan and


Andrew Zisserman from the University of Oxford in 2014.
The input to VGG based convNet is a 224*224 RGB image. Preprocessing layer takes the RGB
image with pixel values in the range of 0–255 and subtracts the mean image values which is
calculated over the entire ImageNet training set.

DEPT OF CSE,GPREC,KNLPage 25
Plant Disease Detection Based On Deep Learning And Image Processing

Fig 3.1.m VGGNet


The input images after preprocessing are passed through these weight layers. The training images
are passed through a stack of convolution layers. There are a total of 13 convolutional layers and
3 fully connected layers in VGG16 architecture. VGG has smaller filters (3*3) with more depth
instead of having large filters. It has ended up having the same effective receptive field as if you
only have one 7 x 7 convolutional layer.Another variation of VGGNet has 19 weight layers
consisting of 16 convolutional layers with 3 fully connected layers and the same 5 pooling
layers. In both variations of VGGNet there consists of two Fully Connected layers with 4096
channels each which is followed by another fully connected layer with 1000 channels to predict
1000 labels. Last fully connected layer uses the softmax layer for classification purposes.

3.2 SYSTEM DESIGN


3.2.1 NumPy
NumPy is a python library used for working with arrays. It also has functions for
working in the domain of linear algebra, fourier transform, and matrices. NumPy was created in
2005 by Travis Oliphant. It is an open source project and you can use it freely. NumPy stands
for Numerical Python.
In Python we have lists that serve the purpose of arrays, but they are slow to process.
NumPy aims to provide an array object that is up to 50x faster than traditional Python lists.
At the core of the NumPy package, is the ndarray object. This

DEPT OF CSE,GPREC,KNLPage 26
Plant Disease Detection Based On Deep Learning And Image Processing

encapsulates n-dimensional arrays of homogeneous data types, with many operations being
performed in compiled code for performance. There are several important differences between
NumPy arrays and the standard Python sequences:
● NumPy arrays have a fixed size at creation, unlike Python lists (which can grow
dynamically). Changing the size of an ndarray will create a new array and delete the
original.
● The elements in a NumPy array are all required to be of the same data type, and thus will
be the same size in memory. The exception: one can have arrays of (Python, including
NumPy) objects, thereby allowing for arrays of different sized elements.
● NumPy arrays facilitate advanced mathematical and other types of operations on large
numbers of data. Typically, such operations are executed more efficiently and with less
code that is possible using Python’s built-in sequences.
● A growing plethora of scientific and mathematical Python-based packages are using
NumPy arrays; though these typically support Python-sequence input, they convert such
input to NumPy arrays prior to processing, and they often output NumPy arrays. In other
words, in order to efficiently use much (perhaps even most) of today’s
scientific/mathematical Python-based software, just knowing how to use Python’s built-in
sequence types are insufficient - one also needs to know how to use NumPy arrays.
Who else uses NumPy?
NumPy fully supports an object-oriented approach, starting, once again, with ndarray. For
example, ndarray is a class, possessing numerous methods and attributes. Many of its methods
are mirrored by functions in the outermost NumPy namespace, allowing the programmer to code
in whichever paradigm they prefer. This flexibility has allowed the NumPy array dialect and
NumPy ndarray class to become the de-facto language of multi-dimensional data interchange
used in Python.

Why is NumPy Fast?


Vectorization describes the absence of any explicit looping, indexing, etc., in the code -
these things are taking place, of course, just “behind the scenes” in optimized, pre-compiled C

DEPT OF CSE,GPREC,KNLPage 27
Plant Disease Detection Based On Deep Learning And Image Processing

code. Vectorized code has many advantages, among which are:


● vectorized code is more concise and easier to read
● fewer lines of code generally means fewer bugs
● the code more closely resembles standard mathematical notation (making it easier,
typically, to correctly code mathematical constructs)
● vectorization results in more “Pythonic” code. Without vectorization, our code would be
littered with inefficient and difficult to read for loops.

3.2.2.Pandas
Pandas is a Python library for data analysis. Started by Wes McKinney in 2008 out of a need for
a powerful and flexible quantitative analysis tool, pandas has grown into one of the most popular
Python libraries. It has an extremely active community of contributions

Pandas is built on top of two core Python libraries—matplotlib for data visualization and NumPy
for mathematical operations. Pandas acts as a wrapper over these libraries, allowing you to
access many of matplotlib and NumPy's methods with less code. For instance, pandas' .plot()
combines multiple matplotlib methods into a single method, enabling you to plot a chart in a few
lines.

Key Features of Pandas


● Fast and efficient DataFrame object with default and customized indexing.
● Tools for loading data into in-memory data objects from different file formats.
● Data alignment and integrated handling of missing data.
● Reshaping and pivoting of date sets.
● Label-based slicing, indexing and subsetting of large data sets.
● Columns from a data structure can be deleted or inserted.
● Group by data for aggregation and transformations.
● High performance merging and joining of data.
● Time Series functionality.

DEPT OF CSE,GPREC,KNLPage 28
Plant Disease Detection Based On Deep Learning And Image Processing

3.2.3 Matplotlib
Matplotlib is a plotting library that works with the Python programming language and its
numerical mathematics extension 'NumPy'. It allows the user to embed plots into applications
using various general purpose tool kits (essentially, it's what turns the data into the graph).

Types of Plots
There are various plots which can be created using python matplotlib. Some of them are listed
below:

Fig 3.2.3.a Types of plots in Matplotlib

3.2.4 Keras
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 primary benefit is distributed computing. CNTK is a
deep learning framework developed by Microsoft. It uses libraries such as Python, C#, C++ or
standalone machine learning toolkits. Theano and TensorFlow are very powerful libraries but
difficult to understand for creating neural networks.

Keras is based on a minimal structure that provides a clean and easy way to create deep learning
models based on TensorFlow or Theano. Keras is designed to quickly define deep learning
models. Well, Keras is an optimal choice for deep learning applications.

DEPT OF CSE,GPREC,KNLPage 29
Plant Disease Detection Based On Deep Learning And Image Processing

Features

Keras leverages various optimization techniques to make high level neural network API easier
and more performant. It supports the following features −

● Consistent, simple and extensible API.


● Minimal structure - easy to achieve the result without any frills.
● It supports multiple platforms and backends.
● It is a user-friendly framework which runs on both CPU and GPU.
● Highly scalability of computation.

Benefits

Keras is highly powerful and dynamic framework and comes up with the following advantages−

● Larger community support.


● Easy to test.
● Keras neural networks are written in Python which makes things simpler.
● Keras supports both convolution and recurrent networks.
● Deep learning models are discrete components, so that you can combine them in many
ways.

3.2.5 Google Colaboratory


What is Colaboratory?
Colaboratory, or “Colab” for short, is a product from Google Research. Colab allows
anybody to write and execute arbitrary python code through the browser, and is especially well
suited to machine learning, data analysis and education. More technically, Colab is a hosted
Jupyter notebook service that requires no setup to use, while providing free access to computing
resources including GPUs.
Google is quite aggressive in AI research. Over many years, Google developed an AI
framework called TensorFlow and a development tool called Colaboratory. Today TensorFlow is
open-sourced and since 2017, Google Colab or simply Colab.

DEPT OF CSE,GPREC,KNLPage 30
Plant Disease Detection Based On Deep Learning And Image Processing

Another attractive feature that Google offers to the developers is the use of GPU. Colab
supports GPU and it is totally free. The reasons for making it free for the public could be to
make its software a standard in the academics for teaching machine learning and data science. It
may also have a long term perspective of building a customer base for Google Cloud APIs which
are sold on a per-use basis.
Is it really free to use?
Yes. Colab is free to use.
As a programmer, you can perform the following using Google Colab.
● Write and execute code in python
● Document your code that supports mathematical equations
● Create/Upload/Share notebooks
● Import/Save notebooks from/to Google Drive
● Import/Publish notebooks from GitHub
● Integrate PyTorch, TensorFlow, Keras, OpenCV
● Free Cloud service with free GPU
3.2.6 VGG19
Visual Geometry Group (VGG) is a widely used deep learning model amongst all the models and
also highly portable in nature. Though VGG is a simple architecture with convolution and
pooling layers, the number of parameters generated in the VGG network is relatively high and it
is more than 140 million. The VGG network is pretrained on a large dataset (ImageNet) with
1000 categories. Instead of using a large deep network, shallow CNN provides enough feature
information to classify. Instead of training the model with randomly initialized weights, we have
used the pre-trained network which is trained on a large dataset. Figure shows the VGG19
model and in our work, we have used only 7 convolution and 2 pooling layers from the
pre-trained network. VGG19 is considered the base model. After the 7th convolution layer, we
have replaced all convolution layers, pooling layer, and fully connected layer with the Global
Average Pooling layer and Batch Normalization layer. The modified VGG19 network is named
as shallow VGG network.

DEPT OF CSE,GPREC,KNLPage 31
Plant Disease Detection Based On Deep Learning And Image Processing

Fig 3.2.6.a Basic architecture of VGG19


Firstly, the images of plant leaves are pre-processed and fed into the shallow VGG network. The
input size used in our model is 256 × 256 × 3. The convolution layers of the network extract the
features and pooling layers are used to reduce the dimension of the features. Instead of using a
fully connected layer on top, we have used global average pooling. Global average pooling has
an advantage over a fully connected layer is that it is more familiar to the convolution structure.
Another advantage is that overfitting can be avoided in the global average pooling layer since
there is no parameter to optimize [46]. The model first extracts the features by 3 × 3 convolution
with 64 filters. Next, 2 × 2 max-pooling is used which reduces the feature dimension and
computation. Next 3 × 3 convolution is used with 128 filters to extract the features. The second 2
× 2 max-pooling layer further reduces the feature dimension. The third block of the
convolutional layer uses 3 × 3 convolution and 256 filters. At last the global average pooling
layer is used and it generates 256 neurons which are used for classification. Later, dropout is
used to reduce overfitting and also to improve the generalization of the model. After that
classification of the diseased leaves are performed using Random forest and Xgboost classifier.
Figure shows the proposed model used in the identification of plant diseases. The parameter
used in this shallow VGG network as shown.
The shallow VGG model has two parts. One part is using this shallow network to extract the
features and the next part is used to classify using two classical machine learning classifiers such
as random forest and Xgboost classifier. The shallow VGG reduces the parameter by a large
margin. Hence, the computational cost of this model is much less in comparison to the VGG19
model.

DEPT OF CSE,GPREC,KNLPage 32
Plant Disease Detection Based On Deep Learning And Image Processing

3.3 SOURCE CODE

DEPT OF CSE,GPREC,KNLPage 33
Plant Disease Detection Based On Deep Learning And Image Processing

3.3 Source Code


from google.colab import drive
drive.mount('/content/drive')
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import os

import keras
from keras.preprocessing.image import ImageDataGenerator, img_to_array, load_img
from keras.applications.vgg19 import VGG19, preprocess_input, decode_predictions
#EDA (Exploratory Data Analysis)

os.listdir("/content/drive/MyDrive/train_set")

len(os.listdir("/content/drive/MyDrive/train_set"))
train_datagen = ImageDataGenerator(zoom_range= 0.5, shear_range=0.3, horizontal_flip= True,
preprocessing_function= preprocess_input)
val_datagen = ImageDataGenerator(preprocessing_function= preprocess_input)

targetrain= train_datagen.flow_from_directory(directory= "/content/drive/MyDrive/train_set",


target_size=(256,256), batch_size= 32)
val= val_datagen.flow_from_directory(directory="/content/drive/MyDrive/test_data",
target_size=(256,256), batch_size= 32)
t_img , label= train.next()
t_img.shape
def plotImage(img_arr,label):

for im, l in zip(img_arr , label):


plt.figure(figsize=(5,5))
plt.imshow(im/255)
plt.show()
plotImage(t_img[:3], label[:3])

DEPT OF CSE,GPREC,KNLPage 34
Plant Disease Detection Based On Deep Learning And Image Processing

Building Our Model


from keras.layers import Dense, Flatten
from keras.models import Model
from keras.applications.vgg19 import VGG19
import keras
base_model = VGG19(input_shape=(256,256,3), include_top= False)
for layer in base_model.layers:
layer.trainable = False

base_model.summary()
X = Flatten()(base_model.output)

X = Dense(units= 12, activation='softmax')(X)

#Creating our model


model = Model(base_model.input, X)

model.summary()
model.compile(optimizer='adam',loss=keras.losses.categorical_crossentropy , metrics=
['accuracy'])

Early Stopping and Model Check point


from keras.callbacks import ModelCheckpoint, EarlyStopping

#early stopping
es = EarlyStopping(monitor= 'val_accuracy', min_delta= 0.01, patience= 3,verbose= 1)

# model check point


mc = ModelCheckpoint(filepath="best_model.h5",
monitor= 'val_accuracy',
min_delta= 0.01,
patience= 3,

DEPT OF CSE,GPREC,KNLPage 35
Plant Disease Detection Based On Deep Learning And Image Processing

verbose= 1,
save_best_only= True)

cb = [es, mc]
his = model.fit_generator(train ,
steps_per_epoch= 16,
epochs= 50,
verbose= 1,
callbacks= cb,
validation_data= val ,
validation_steps= 16
)
h = his.history
h.keys()
plt.plot(h['accuracy'])
plt.plot(h['val_accuracy'] , c = "red")
plt.title("acc vs v-acc")
plt.show()
plt.plot(h['loss'])
plt.plot(h['val_loss'] , c = "red")
plt.title("loss vs v-loss")
plt.show()
# load best model

from keras.models import load_model

model = load_model("/content/best_model.h5")
acc = model.evaluate_generator(val)[1]

print(f"The accuracy of your model is = {acc*100} %")


train.class_indices
ref = dict(zip(list(train.class_indices.values()), list(train.class_indices.keys())))
def prediction(path):

DEPT OF CSE,GPREC,KNLPage 36
Plant Disease Detection Based On Deep Learning And Image Processing

img = load_img(path, target_size= (256,256))

i = img_to_array(img)

im = preprocess_input(i)

img = np.expand_dims(im, axis= 0)

pred = np.argmax(model.predict(img))

print(f" The image belongs to { ref[pred]}")


path = "/content/drive/MyDrive/test/Grape___Esca_(Black_Measles)3.JPG"

prediction(path)

DEPT OF CSE,GPREC,KNLPage 37
Plant Disease Detection Based On Deep Learning And Image Processing

3.3.1 OUTPUT SCREENS

DEPT OF CSE,GPREC,KNLPage 38
Plant Disease Detection Based On Deep Learning And Image Processing

In the above image, we connected the drive to mount the data, imported libraries such as numpy,
pandas, matplotlib, os and keras. We also performed Exploratory Data Analysis.

In the above image, preprocessing of images is done using Keras by ImageDataGenerator and
found how many images are there in train and test folders.

DEPT OF CSE,GPREC,KNLPage 39
Plant Disease Detection Based On Deep Learning And Image Processing

In the above image we wrote a function to plot the images which are present in the train folder.

In the above image, we plotted the images of leaves based on the input data and given a valid
range.

DEPT OF CSE,GPREC,KNLPage 40
Plant Disease Detection Based On Deep Learning And Image Processing

In the above image, we plotted the images of leaves based on the input data and given a valid
range.

In the above image, we started building our model and we imported Dense and Flatten Layers
from keras and vgg19 from keras.application.vgg19.

DEPT OF CSE,GPREC,KNLPage 41
Plant Disease Detection Based On Deep Learning And Image Processing

In the above image, we started training our base_model and used base_model.summary() to get
the params.

In the above image, we got how many params are there in different layers.Parameters (params)
are the weights and biases that will be used for computation in all neurons of the CNN.

DEPT OF CSE,GPREC,KNLPage 42
Plant Disease Detection Based On Deep Learning And Image Processing

In the above image, we flatten our base_model.

In the above image, we used a Dense layer to train our model using an activation function called
softmax.

DEPT OF CSE,GPREC,KNLPage 43
Plant Disease Detection Based On Deep Learning And Image Processing

In the above image, we got how many Trainable params and Non trainable params are there in
our model.

In the above image, we started Early Stopping and Model Checkpoint to train our model.

DEPT OF CSE,GPREC,KNLPage 44
Plant Disease Detection Based On Deep Learning And Image Processing

In the above image, we used model.fit_generator to know in how many epochs our model is
trained and what is the accuracy of our model.

In the above image, we got the accuracy of our model.

DEPT OF CSE,GPREC,KNLPage 45
Plant Disease Detection Based On Deep Learning And Image Processing

In the above image, we plotted the validation accuracy vs accuracy graph.

In the above image, we plotted the graph between validation loss and loss.

DEPT OF CSE,GPREC,KNLPage 46
Plant Disease Detection Based On Deep Learning And Image Processing

In the above image, we load our best model and print the accuracy of the model.

In the above image, we have written a function to predict the input image to which class it
belongs to.

DEPT OF CSE,GPREC,KNLPage 47
Plant Disease Detection Based On Deep Learning And Image Processing

3.4 TESTING AND VALIDATION

DEPT OF CSE,GPREC,KNLPage 48
Plant Disease Detection Based On Deep Learning And Image Processing

3.3 TESTING AND VALIDATION

TESTING

The purpose of testing can be quality assurance, verification and validation, or reliability
estimation. Testing can be used as a generic metric as well. Correctness testing and reliability
testing are two major areas of testing. Software testing is a trade-off between budget, time and
quality. The main course of testing is to check for the existence of defects or errors in a program
or project or product, based on some predefined instructions or conditions.

Verification : Checks consistency with the i/p's

The process of determining whether or not the products of a given phase of the software
development cycle meets the implementation steps and can be traced to the incoming objectives
established during the previous phase. The techniques for verification are testing, inspection.

Validation: Checks Consistency with the User Requirements.

The process of evaluating software at the end of the software development process to
ensure compliance with software requirements. The techniques for validation are testing,
inspection and reviewing.

Software Testing is an empirical investigation conducted to provide stakeholders with


information about the quality of the product or service under test, with respect to the context in
which it is intended to operate. This includes, but is not limited to, the process of executing a
program or application with the intent of finding software bugs.

Testing can never completely establish the correctness of computer software. Instead, it
furnishes a criticism or comparison that compares the state and behavior of the product against
oracles—principles or mechanisms by which someone might recognize a problem. These oracles
may include (but are not limited to) specifications, comparable products, past versions of the

DEPT OF CSE,GPREC,KNLPage 49
Plant Disease Detection Based On Deep Learning And Image Processing

same product, inferences about intended or expected purpose, user or customer expectations,
relevant standards, applicable laws, or other criteria.

Over its existence, computer software has continued to grow in complexity and size.
Every software product has a target audience. For example, the audience for video game
software is completely different from banking software. Therefore, when an organization
develops or otherwise invests in a software product, it presumably must assess whether the
software product will be acceptable to its end users, its target audience, its purchasers, and other
stakeholders. Software testing is the process of attempting to make this assessment.

A primary purpose for testing is to detect software failures so that defects may be
uncovered and corrected. This is a non-trivial pursuit. Testing cannot establish that a product
functions properly under all conditions but can only establish that it does not function properly
under specific conditions. The scope of software testing often includes examination of code as
well as execution of that code in various environments and conditions as well as examining the
aspects of code: does it do what it is supposed to do and do what it needs to do. In the current
culture of software development, a testing organization may be separate from the development
team. There are various roles for testing team members. Information derived from software
testing may be used to correct the process by which software is developed.

Not all software defects are caused by coding errors. One common source of expensive
defects is caused by requirements gaps, e.g., unrecognized requirements, that result in errors of
omission by the program designer. A common source of requirements gaps is non-functional
requirements such as testability, scalability, maintainability, usability, performance, and security.

Software faults occur through the following process. A programmer makes an error
(mistake), which results in a defect (fault, bug) in the software source code. If this defect is
executed, in certain situations the system will produce wrong results, causing a failure. Not all
defects will necessarily result in failures. For example, defects in dead code will never result in
failures. A defect can turn into a failure when the environment is changed. Examples of these
changes in environment include the software being run on a new hardware platform, alterations

DEPT OF CSE,GPREC,KNLPage 50
Plant Disease Detection Based On Deep Learning And Image Processing

in source data or interacting with different software. A single defect may result in a wide range
of failure symptoms.

A frequent cause of software failure is compatibility with another application, a new


operating system, or, increasingly, web browser version. In the case of lack of backward
compatibility, this can occur (for example...) because the programmers have only considered
coding their programs for, or testing the software upon, "the latest version of" this-or-that
operating system. The unintended consequence of this fact is that: their latest work might not be
fully compatible with earlier mixtures of software/hardware, or it might not be fully compatible
with another important operating system. In any case, these differences, whatever they might be,
may have resulted in (unintended...) software failures, as witnessed by some significant
population of computer users.

UNIT TESTING

In computer programming, unit testing is a software design and development method where the
programmer gains confidence that individual units of source code are fit for use. A unit is the
smallest testable part of an application. In procedural programming a unit may be an individual
program, function, procedure, etc., while in object-oriented programming, the smallest unit is a
method, which may belong to a base/super class, abstract class or derived/child class.

Unit testing can be done by something as simple as stepping through code in a debugger;
modern applications include the use of a test framework such as xUnit.

Ideally, each test case is independent from the others; Double objects like stubs, mock or
fake objects as well as test harnesses can be used to assist testing a module in isolation. Unit
testing is typically done by software developers to ensure that the code other developers have
written meets software requirements and behaves as the developer intended.

The first test in the development process is the unit test. The source code is normally
divided into modules, which in turn are divided into smaller units called units. These units have
specific behavior. The test done on these units of code is called unit test. Unit test depends upon

DEPT OF CSE,GPREC,KNLPage 51
Plant Disease Detection Based On Deep Learning And Image Processing

the language on which the project is developed. Unit tests ensure that each unique path of the
project performs accurately to the documented specifications and contains clearly defined inputs
and expected results.

Unit testing provides a sort of living documentation of the system. Developers looking to
learn what functionality is provided by a unit and how to use it can look at the unit tests to gain a
basic understanding of the unit API.

Unit test cases embody characteristics that are critical to the success of the unit. These
characteristics can indicate appropriate/inappropriate use of a unit as well as negative behaviors
that are to be trapped by the unit. A unit test case, in and of itself, documents these critical
characteristics, although many software development environments do not rely solely upon code
to document the product in development.

On the other hand, ordinary narrative documentation is more susceptible to drifting from
the implementation of the program and will thus become outdated (e.g. design changes, feature
creep, relaxed practices in keeping documents up-to-date).

When software is developed using a test-driven approach, the Unit-Test may take the
place of formal design. Each unit test can be seen as a design element specifying classes,
methods, and observable behavior. The following Java example will help illustrate this point.

Here is a test class that specifies a number of elements of the implementation. First, there must
be an interface called Adder, and an implementing class with a zero-argument constructor called
AdderImpl.

It goes on to assert that the Adder interface should have a method called add, with two
integer parameters, which returns another integer. It also specifies the behavior of this method for
a small range of values.

LIMITATIONS

DEPT OF CSE,GPREC,KNLPage 52
Plant Disease Detection Based On Deep Learning And Image Processing

Testing cannot be expected to catch every error in the program - it is impossible to


evaluate all execution paths for all but the most trivial programs. The same is true for unit
testing. Additionally, by definition unit testing only tests the functionality of the units
themselves. Therefore it will not catch integration errors, or broader system level errors (such as
functions performed across multiple units, or non-functional test areas such as performance).
Unit testing is more effective if it is used in conjunction with other software testing activities.
Like all forms of software testing, unit tests can only show the presence of errors; it cannot show
the absence of errors.

Software testing is a combinatorial problem. For example, every boolean decision


statement requires at least two tests: one with an outcome of "true" and one with an outcome of
"false". As a result, for every line of code written, programmers often need 3 to 5 lines of test
code.

To obtain the intended benefits from unit testing, a rigorous sense of discipline is needed
throughout the software development process. It is essential to keep careful records not only of
the tests that have been performed, but also of all changes that have been made to the source
code of this or any other unit in the software. Use of a version control system is essential. If a
later version of the unit fails a particular test that it had previously passed, the version-control
software can provide a list of the source code changes (if any) that have been applied to the unit
since that time.

It is also essential to implement a sustainable process for ensuring that test case failures
[3]
are reviewed daily and addressed immediately. If such a process is not implemented and
ingrained into the team's workflow, the application will evolve out of sync with the unit test suite
― increasing false positives and reducing the effectiveness of the test suite.

ACCEPTANCE TESTING

Acceptance testing is formal testing conducted to determine whether a system satisfies


its acceptance criteria and thus whether the customer should accept the system.

DEPT OF CSE,GPREC,KNLPage 53
Plant Disease Detection Based On Deep Learning And Image Processing

The main types of software testing are:

. Component.

• Interface.
• System.
• Acceptance.
• Release.
Acceptance Testing checks the system against the "Requirements". It is similar to systems
testing in that the whole system is checked but the important difference is the change in focus:
Systems Testing checks that the system that was specified has been delivered.
Acceptance Testing checks that the system delivers what was requested. The customer, and not
the developer should always do acceptance testing. The customer knows what is required from
the system to achieve value in the business and is the only person qualified to make that
judgment. The User Acceptance Test Plan will vary from system to system but, in general, the
testing should be planned in order to provide a realistic and adequate exposure of the system to
all reasonably expected events. The testing can be based upon the User Requirements
Specification to which the system should conform.
In engineering and its various subdisciplines, acceptance testing is black-box testing performed
on a system (e.g. software, lots of manufactured mechanical parts, or batches of chemical
products) prior to its delivery. It is also known as functional testing, black-box testing, release
acceptance, QA testing, application testing, confidence testing, final testing, validation testing, or
factory acceptance testing.
In software development, acceptance testing by the system provider is often distinguished from
acceptance testing by the customer (the user or client) prior to accepting transfer of ownership. In
such environments, acceptance testing performed by the customer is known as user acceptance
testing (UAT). This is also known as end-user testing, site (acceptance) testing, or field
(acceptance) testing.
A smoke test is used as an acceptance test prior to introducing a build to the main testing
process.

DEPT OF CSE,GPREC,KNLPage 54
Plant Disease Detection Based On Deep Learning And Image Processing

Acceptance testing generally involves running a suite of tests on the completed system. Each
individual test, known as a case, exercises a particular operating condition of the user's
environment or feature of the system, and will result in a pass or fail boolean outcome. There is
generally no degree of success or failure. The test environment is usually designed to be
identical, or as close as possible, to the anticipated user's environment, including extremes of
such. These test cases must each be accompanied by test case input data or a formal description
of the operational activities (or both) to be performed—intended to thoroughly exercise the
specific case—and a formal description of the expected results.

Acceptance Tests/Criterion (in Agile Software Development) are usually created by


business customers and expressed in a business domain language. These are high level tests to
test the completeness of a user story or stories 'played' during any sprint/iteration. These tests are
created ideally through collaboration between business customers, business analysts, testers and
developers, however the business customers (product owners) are the primary owners of these
tests. As the user stories pass their acceptance criteria, the business owners can be sure of the fact
that the developers are progressing in the right direction about how the application was
envisaged to work and so it's essential that these tests include both business logic tests as well as
UI validation elements (if need be).

Acceptance test cards are ideally created during sprint planning or iteration planning
meeting, before development begins so that the developers have a clear idea of what to develop.
Sometimes (due to bad planning!) acceptance tests may span multiple stories (that are not
implemented in the same sprint) and there are different ways to test them out during actual
sprints. One popular technique is to mock external interfaces or data to mimick other stories
which might not be played out during an iteration (as those stories may have been relatively
lower business priority). A user story is not considered complete until the acceptance tests have
passed.

The acceptance test suite is run against the supplied input data or using an acceptance test
script to direct the testers. Then the results obtained are compared with the expected results. If
there is a correct match for every case, the test suite is said to pass. If not, the system may either

DEPT OF CSE,GPREC,KNLPage 55
Plant Disease Detection Based On Deep Learning And Image Processing

be rejected or accepted on conditions previously agreed between the sponsor and the
manufacturer.

The objective is to provide confidence that the delivered system meets the business
requirements of both sponsors and users. The acceptance phase may also act as the final quality
gateway, where any quality defects not previously detected may be uncovered.

A principal purpose of acceptance testing is that, once completed successfully, and


provided certain additional (contractually agreed) acceptance criteria are met, the sponsors will
then sign off on the system as satisfying the contract (previously agreed between sponsor and
manufacturer), and deliver final payment.

User Acceptance Testing (UAT) is a process to obtain confirmation by a Subject Matter


Expert (SME), preferably the owner or client of the object under test, through trial or review, that
the modification or addition meets mutually agreed-upon requirements. In software development,
UAT is one of the final stages of a project and often occurs before a client or customer accepts
the new system.

Users of the system perform these tests, which developers derive from the client's
contract or the user requirements specification.

Test designers draw up formal tests and device a range of severity levels. It is preferable
that the designer of the user acceptance tests not be the creator of the formal integration and
system test cases for the same system, however there are some situations where this may not be
avoided. The UAT acts as a final verification of the required business function and proper
functioning of the system, emulating real-world usage conditions on behalf of the paying client
or a specific large customer. If the software works as intended and without issues during normal
use, one can reasonably infer the same level of stability in production. These tests, which are
usually performed by clients or end-users, are not usually focused on identifying simple
problems such as spelling errors and cosmetic problems, nor show stopper bugs, such as software

DEPT OF CSE,GPREC,KNLPage 56
Plant Disease Detection Based On Deep Learning And Image Processing

crashes; testers and developers previously identify and fix these issues during earlier unit testing,
integration testing, and system testing phases.

The results of these tests give confidence to the clients as to how the system will perform
in production. There may also be legal or contractual requirements for acceptance of the system.

TYPES OF ACCEPTANCE TESTING:

User acceptance testing

This may include factory acceptance testing, i.e. the testing done by factory users before
the factory is moved to its own site, after which site acceptance testing may be performed by the
users at the site.

Operational acceptance testing

Also known as operational readiness testing, this refers to the checking done to a system
to ensure that processes and procedures are in place to allow the system to be used and
maintained. This may include checks done to back-up facilities, procedures for disaster recovery,
training for end users, maintenance procedures, and security procedures.

Contract and regulation acceptance testing

In contract acceptance testing, a system is tested against acceptance criteria as


documented in a contract, before the system is accepted. In regulation acceptance testing, a
system is tested to ensure it meets governmental, legal and safety standards.

Alpha and beta testing

Alpha testing takes place at developers' sites, and involves testing of the operational
system by internal staff, before it is released to external customers. Beta testing takes place at
customers' sites, and involves testing by a group of customers who use the system at their own
locations and provide feedback, before the system is released to other customers. The latter is
often called “field testing”.

DEPT OF CSE,GPREC,KNLPage 57
Plant Disease Detection Based On Deep Learning And Image Processing

INTEGRATION TESTING

Testing in which software components, hardware components, or both together are


combined and tested to evaluate interactions between them. Integration testing takes as its input
modules that have been checked out by unit testing, groups them in larger aggregates, applies
tests defined in an Integration test plan to those aggregates, and delivers as its output the
integrated system ready for system testing.

'Integration testing' (sometimes called Integration and Testing, abbreviated I&T) is the
phase of software testing in which individual software modules are combined and tested as a
group. It follows unit testing and precedes system testing.

Integration testing takes as its input modules that have been unit tested, groups them in
larger aggregates, applies tests defined in an integration test plan to those aggregates, and
delivers as its output the integrated system ready for system testing.

The purpose of integration testing is to verify functional, performance and reliability


requirements placed on major design items. These "design items", i.e. assemblages (or groups of
units), are exercised through their interfaces using Black box testing, success and error cases
being simulated via appropriate parameter and data inputs. Simulated usage of shared data areas
and inter-process communication is tested and individual subsystems are exercised through their
input interface. Test cases are constructed to test that all components within assemblages interact
correctly, for example across procedure calls or process activations, and this is done after testing
individual modules, i.e. unit testing.

The overall idea is a "building block" approach, in which verified assemblages are added
to a verified base which is then used to support the integration testing of further
assemblages.Some different types of integration testing are big bang, top-down, and bottom-up.

There are two types in Integration Testing.


1. Bottom Up
2. Top Down.

DEPT OF CSE,GPREC,KNLPage 58
Plant Disease Detection Based On Deep Learning And Image Processing

Bottom-UP testing: An approach to integration testing where the lowest level


components are tested first, then used to facilitate the testing of higher level components. The
process is repeated until the component at the top of the hierarchy is tested.
All the bottom or low-level modules, procedures or functions are integrated and then
tested. After the integration testing of lower level integrated modules, the next level of modules
will be formed and can be used for integration testing. This approach is helpful only when all or
most of the modules of the same development level are ready. This method also helps to
determine the levels of software developed and makes it easier to report testing progress in the
form of a percentage. The Top Down is the procedure where the top integrated modules are
tested and the branch of the module is testing step by step till end of the related module. The
main advantage of the Bottom up is easy to find bugs. In Top down it is easy to find the missing
branch link.

Integration testing is a logical extension of unit testing. In its simplest form, two units
that have already been tested are combined into a component and the interface between them is
tested. A component, in this sense, refers to an integrated aggregate of more than one unit. In a
realistic scenario, many units are combined into components, which are in turn aggregated into
even larger parts of the program. The idea is to test combinations of pieces and eventually
expand the process to test your modules with those of other groups. Eventually all the modules
making up a process are tested together. Beyond that, if the program is composed of more than
one process, they should be tested in pairs rather than all at once.

Integration testing identifies problems that occur when units are combined. By using a
test plan that requires you to test each unit and ensure the viability of each before combining
units, you know that any errors discovered when combining units are likely related to the
interface between units. This method reduces the number of possibilities to a far simpler level of
analysis.

You can do integration testing in a variety of ways but the following are three common
strategies:

DEPT OF CSE,GPREC,KNLPage 59
Plant Disease Detection Based On Deep Learning And Image Processing

● The top-down approach to integration testing requires the highest-level modules be test
and integrated first. This allows high-level logic and data flow to be tested early in the
process and it tends to minimize the need for drivers. However, the need for stubs
complicates test management and low-level utilities are tested relatively late in the
development cycle. Another disadvantage of top-down integration testing is its poor
support for early release of limited functionality.

The bottom-up approach requires the lowest-level units be tested and integrated first. These units
are frequently referred to as utility modules. By using this approach, utility modules are tested
early in the development process and the need for stubs is minimized. The downside, however, is
that the need for drivers complicates test management and high-level logic and data flow are
tested late. Like the top-down approach, the bottom-up approach also provides poor support for
early release of limited functionality.
● The third approach, sometimes referred to as the umbrella approach, requires testing
along functional data and control-flow paths. First, the inputs for functions are integrated
in the bottom-up pattern discussed above. The outputs for each function are then
integrated in the top-down manner. The primary advantage of this approach is the degree
of support for early release of limited functionality. It also helps minimize the need for
stubs and drivers. The potential weaknesses of this approach are significant, however, in
that it can be less systematic than the other two approaches, leading to the need for more
regression testing.

REGRESSION TESTING

Regression testing is the process of testing changes to computer programs to make sure
that the older programming still works with the new changes. Regression testing is a normal part
of the program development process. Test department coders develop code test scenarios and
exercises that will test new units of code after they have been written. Before a new version of a

DEPT OF CSE,GPREC,KNLPage 60
Plant Disease Detection Based On Deep Learning And Image Processing

software product is released, the old test cases are run against the new version to make sure that
all the old capabilities still work. The reason they might not work because changing or adding
new code to a program can easily introduce errors into code that is not intended to be changed. It
is a quality control measure to ensure that the newly modified code still complies with its
specified requirements and that unmodified code has not been affected by the maintenance
activity.

Regression testing is any type of software testing which seeks to uncover software
regressions. Such regressions occur whenever software functionality that was previously
working correctly stops working as intended. Typically regressions occur as an unintended
consequence of program changes. Common methods of regression testing include re-running
previously run tests and checking whether previously fixed faults have re-emerged.
Effective regression tests generate sufficient code execution coverage to exercise all
meaningful code branches. Therefore, software testing is a combinatorial problem. However, in
practice many combinations are unreachable so the problem size is greatly reduced. Every
boolean decision statement requires at least two tests: one with an outcome of "true" and one
with an outcome of "false". As a result, for every line of code written, programmers often need 3
to 5 lines of test code.
Traditionally, in the corporate world, regression testing has been performed by a software quality
assurance team after the development team has completed work. However, defects found at this stage
are the most costly to fix. This problem is being addressed by the rise of developer testing. Although
developers have always written test cases as part of the development cycle, these test cases have
generally been either functional tests or unit tests that verify only intended outcomes. Developer testing
compels a developer to focus on unit testing and to include both positive and negative test cases.
Any time you modify an implementation within a program, you should also do regression testing.
You can do so by rerunning existing tests against the modified code to determine whether the changes
break anything that worked prior to the change and by writing new tests where necessary. Adequate
coverage without wasting time should be a primary consideration when conducting regression tests. Try
to spend as little time as possible doing regression testing without reducing the probability that you will
detect new failures in old, already tested code.

DEPT OF CSE,GPREC,KNLPage 61
Plant Disease Detection Based On Deep Learning And Image Processing

Some strategies and factors to consider during this process include the following:
● Test fixed bugs promptly. The programmer might have handled the symptoms but not
have gotten to the underlying cause.
● Watch for side effects of fixes. The bug itself might be fixed but the fix might create
other bugs.
● Write a regression test for each bug fixed.
● If two or more tests are similar, determine which is less effective and get rid of it.
● Identify tests that the program consistently passes and archive them.
● Focus on functional issues, not those related to design.
● Make changes (small and large) to data and find any resulting corruption.
● Trace the effects of the changes on program memory.

The selective retesting of a software system that has been modified to ensure that any bugs
have been fixed and that no other previously working functions have failed as a result of the
reparations and that newly added features have not created problems with previous versions of
the software. Also referred to as verification testing, regression testing is initiated after a
programmer has attempted to fix a recognized problem or has added source code to a program
that may have inadvertently introduced errors. It is a quality control measure to ensure that the
newly modified code still complies with its specified requirements and that unmodified code has
not been affected by the maintenance activity.
Regression testing means rerunning test cases from existing test suites to build confidence that
software changes have no unintended side-effects. The “ideal” process would be to create an
extensive test suite and run it after each and every change. Unfortunately, for many projects this
is just impossible because test suites are too large, because changes come in too fast, because
humans are in the testing loop, because scarce, highly in-demand simulation laboratories are
needed, or because testing must be done on many different hardware .

Researchers have tried to make regression testing more effective and efficient by developing
regression test selection (RTS) techniques, but many problem remain, such as:

DEPT OF CSE,GPREC,KNLPage 62
Plant Disease Detection Based On Deep Learning And Image Processing

● Unpredictable performance. RTS techniques sometimes save time and money, but they
sometimes select most or all of the original test cases. Thus, developers using RTS
techniques can find themselves worse off for having done so.
● Incompatible process assumptions. Testing time is often limited (e.g., must be done
overnight). RTS techniques do not consider such constraints and, therefore, can and do
select more test cases than can be run.
● Inappropriate evaluation models. RTS techniques try to maximize average regression
testing performance rather than optimize aggregate performance over many testing
sessions. However, companies that test frequently might accept less effective, but cheaper
individual testing sessions if the system would, nonetheless, be well-tested over some
short period of time.

These and other issues have not been adequately considered in current research, yet they
strongly affect the applicability of proposed regression testing processes. Moreover, we believe
that solutions to these problems can be exploited, singly and in combination, to dramatically
improve the costs and benefits of the

regression testing process.

SYSTEM TESTING

System testing of software or hardware is testing conducted on a complete, integrated


system to evaluate the system's compliance with its specified requirements. System testing falls
within the scope of black box testing, and as such, should require no knowledge of the inner
design of the code or logic.

As a rule, system testing takes, as its input, all of the "integrated" software components
that have successfully passed integration testing and also the software system itself integrated
with any applicable hardware system(s). The purpose of integration testing is to detect any
inconsistencies between the software units that are integrated together (called assemblages) or
between any of the assemblages and the hardware. System testing is a more limiting type of

DEPT OF CSE,GPREC,KNLPage 63
Plant Disease Detection Based On Deep Learning And Image Processing

testing; it seeks to detect defects both within the "inter-assemblages" and also within the system
as a whole.

DEPT OF CSE,GPREC,KNLPage 64
Plant Disease Detection Based On Deep Learning And Image Processing

4.CONCLUSION

DEPT OF CSE,GPREC,KNLPage 65
Plant Disease Detection Based On Deep Learning And Image Processing

4.1.Conclusion

Compared with the traditional model, the model proposed above not only guarantees the
robustness of the convolutional neural network, but also reduces the number and quality
requirements of the convolutional neural network on the data set and obtains better results.
Therefore, the model could help agricultural production personnel to prevent and cure the plant
disease quickly. The model which overcomes the problem of environment complexity can get an
accurate identification result in practical application. Furthermore, this study enriches the
existing theory and helps to improve the accuracy. At the same time, it is of great significance for
the study of plant disease identification in the field of environmental complexity and helps
researchers pay attention to the important role of environmental complexity in plant disease
identification. Therefore, the model applies information technology to agricultural production
and is favorable to sustainable development of smart agriculture.

DEPT OF CSE,GPREC,KNLPage 66
Plant Disease Detection Based On Deep Learning And Image Processing

5.REFERENCES

DEPT OF CSE,GPREC,KNLPage 67
Plant Disease Detection Based On Deep Learning And Image Processing

References:

1. A. Breukers, D. L. Kettenis, M. Mourits, W. V. D. Werf, and A. O. Lansink,


“Individual-based models in the analysis of disease transmission in plant production
chains: an application to potato brown rot,” Academy of Sciences, vol. 90, no. 1–3, pp.
112–131, 2021.
2. S. P. Mohanty, D. P. Hughes, and S. Marcel, “Using deep learning for image-based plant
disease detection,” Frontiers in Plant Science, vol. 7, p. 1419, 2020.
3. Md Rahmat Ullah, Nagifa Anjum and Abdus Sattar, "Plant Disease Recognition Using
Machine Learning", 2019 8 th International Conference System Modeling and
Advancement in Research Trends (SMART 2019) .
4. Melike Sardogan, Adem Tuncer and Yunnus Ozen, "Plant Leaf Disease Detection and
Classification Based on CNN with LVQ Algorithm", 3 rd International Conference on
Computer Science and Engineering (UBMK) Posted , 2018.
5. Haseeb Nazki, Sook Yoon, Alvaro Fuentes, Dong Sun Park (2020) “Unsupervised image
translat ion using adversarial networks for improved plant disease recognit ion”
Published by Elsevier B.V.
6. Nilay Ganatra, Atul Patel (2020) “Performance Analysis of Fine-Tuned Convolut ional
Neural Network Models for Plant Disease Classificat ion” Published by Internat ional
Journal of Control and Automat ion Vol. 13, No. 3,pp. 293-305
7. BATTALA LAKSHMI THUSHARA,T. MAHABOOB RASOOL (2020) “Analysis of
Plant Diseases Using Expectation Maximization Detection with BP-ANN Classification”
Volume XIII, Issue VIII, AUGUST 2020
8. Chaitanya and Yasudha (2020) “Image Based Plant Disease Detect ion Using Convolut
ion Neural Networks Algorithm”, Volume 5, Issue 5, May – 2020, Published by Internat
ional Journal of Innovative Science and Research Technology ISSN No:-2456-2165
9. Shanwen Zhang, Subing Zhang, Chuanlei Zhang, Xianfeng Wang, Yun Shi (2019)
“Cucumber leaf disease identification with global pooling dilated convolutional neural
network” 2021 Published by Elsevier B.V.

DEPT OF CSE,GPREC,KNLPage 68
Plant Disease Detection Based On Deep Learning And Image Processing

10. V. Singh, N. Sharma and S. Singh, "A review of imaging techniques for plant disease
detection", Artif. Intell. Agricult., vol. 4, pp. 229-242, Oct. 2021.
11. L. C. Ngugi, M. Abelwahab and M. Abo-Zahhad, "Recent advances in image processing
techniques for automated leaf pest and disease recognition—A review", Inf. Process.
Agricult., vol. 180, pp. 26-50, Apr. 2021
12. H. Nazki, S. Yoon, A. Fuentes and D. S. Park, "Unsupervised image translation using
adversarial networks for improved plant disease recognition", Comput. Electron.
Agricult., vol. 168, Jan. 2020.
13. H.-Y. Wu, "Identification of tea leaf’s diseases in natural scene images based on low shot
learning", 2020.
14. B. Liu, C. Tan, S. Li, J. He and H. Wang, "A data augmentation method based on
generative adversarial networks for grape leaf disease identification", IEEE Access, vol.
8, pp. 102188-102198, 2020.
15. Q. Wu, Y. Chen and J. Meng, "DCGAN-based data augmentation for tomato leaf disease
identification", IEEE Access, vol. 8, pp. 98716-98728, 2020.
16. S.H.Lee, H. Goëau, P. Bonnet and A. Joly, "New perspectives on plant disease
characterization based on deep learning", Comput. Electron. Agricult., vol. 170, Mar.
2020.
17. I. Ahmad, M. Hamid, S. Yousaf, S. T. Shah and M. O. Ahmad, "Optimizing pretrained
convolutional neural networks for tomato leaf disease detection", Complexity, vol. 2020,
pp. 1-6, Sep. 2020.
18. J.-P. Huang, J.-X. Chen, K.-X. Li, J.-Y. Li and H. Liu, "Identification of multiple plant
leaf diseases using neural architecture search", Trans. Chin. Soc. Agricult. Eng., vol. 36,
no. 16, pp. 166-173, Aug. 2020.
19. J.-H. Xu, M.-Y. Shao, Y.-C. Wang and W.-T. Han, "Recognition of corn leaf spot and rust
based on transfer learning with convolutional neural network", Trans. Chin. Soc.
Agricult. Mach., vol. 51, no. 2, pp. 230-236, Feb. 2020.

DEPT OF CSE,GPREC,KNLPage 69
Plant Disease Detection Based On Deep Learning And Image Processing

20. J. Chen, J. Chen, D. Zhang, Y. Sun and Y. A. Nanehkaran, "Using deep transfer learning
for image-based plant disease identification", Comput. Electron. Agricult., vol. 173, Jun.
2020.

DEPT OF CSE,GPREC,KNLPage 70

You might also like