MP Documentation
MP Documentation
BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE AND ENGINEERING
By
Smt. S. Aarthi
Assistant Professor
Department of C.S.E.
2021 – 2022
Department of Computer Science and Engineering
G. PULLA REDDY ENGINEERING COLLEGE (Autonomous): KURNOOL
(Affiliated to JNTUA, ANANTAPURAMU)
CERTIFICATE
BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE & ENGINEERING
L.SREYA REDDY
(199X1A0578)
M.SAI PRANATHI
(199X1A0534)
M.JAHNAVI
(199X1A0591)
1ii
2ii
ACKNOWLEDGEMENT
We are thankful to our Head of the Department Dr. N. Kasi Viswanath, for
his whole hearted support and encouragement during the project sessions.
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
2.SYSTEM SPECIFICATION 10
3.1 Introduction 13
3.2.1 Numpy 26
3.2.2 Pandas 28
3.2.3 Matplotlib 29
3.2.4 Keras 29
3.2.6 VGG19 31
DEPT OF CSE,GPREC,KNLPage 1
Plant Disease Detection Based On Deep Learning And Image Processing
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
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.
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
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
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
DEPT OF CSE,GPREC,KNLPage 11
Plant Disease Detection Based On Deep Learning And Image Processing
DEPT OF CSE,GPREC,KNLPage 12
Plant Disease Detection Based On Deep Learning And Image Processing
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
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.
DEPT OF CSE,GPREC,KNLPage 14
Plant Disease Detection Based On Deep Learning And Image Processing
INTRODUCTION TO CNN
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
INPUT IMAGE
DEPT OF CSE,GPREC,KNLPage 16
Plant Disease Detection Based On Deep Learning And Image Processing
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.
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
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
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.
DEPT OF CSE,GPREC,KNLPage 19
Plant Disease Detection Based On Deep Learning And Image Processing
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
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
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
DEPT OF CSE,GPREC,KNLPage 24
Plant Disease Detection Based On Deep Learning And Image Processing
VGGNET:
DEPT OF CSE,GPREC,KNLPage 25
Plant Disease Detection Based On Deep Learning And Image Processing
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.
DEPT OF CSE,GPREC,KNLPage 27
Plant Disease Detection Based On Deep Learning And Image Processing
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.
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:
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 −
Benefits
Keras is highly powerful and dynamic framework and comes up with the following advantages−
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
DEPT OF CSE,GPREC,KNLPage 32
Plant Disease Detection Based On Deep Learning And Image Processing
DEPT OF CSE,GPREC,KNLPage 33
Plant Disease Detection Based On Deep Learning And Image Processing
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)
DEPT OF CSE,GPREC,KNLPage 34
Plant Disease Detection Based On Deep Learning And Image Processing
base_model.summary()
X = Flatten()(base_model.output)
model.summary()
model.compile(optimizer='adam',loss=keras.losses.categorical_crossentropy , metrics=
['accuracy'])
#early stopping
es = EarlyStopping(monitor= 'val_accuracy', min_delta= 0.01, patience= 3,verbose= 1)
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
model = load_model("/content/best_model.h5")
acc = model.evaluate_generator(val)[1]
DEPT OF CSE,GPREC,KNLPage 36
Plant Disease Detection Based On Deep Learning And Image Processing
i = img_to_array(img)
im = preprocess_input(i)
pred = np.argmax(model.predict(img))
prediction(path)
DEPT OF CSE,GPREC,KNLPage 37
Plant Disease Detection Based On Deep Learning And Image Processing
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 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.
DEPT OF CSE,GPREC,KNLPage 45
Plant Disease Detection Based On Deep Learning And Image Processing
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
DEPT OF CSE,GPREC,KNLPage 48
Plant Disease Detection Based On Deep Learning And Image Processing
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.
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.
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.
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.
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
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
DEPT OF CSE,GPREC,KNLPage 53
Plant Disease Detection Based On Deep Learning And Image Processing
. 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 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.
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.
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.
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.
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
'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 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.
DEPT OF CSE,GPREC,KNLPage 58
Plant Disease Detection Based On Deep Learning And Image Processing
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
SYSTEM TESTING
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:
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