Professional Documents
Culture Documents
on
BACHELOR OF TECHNOLOGY
in
ELECTRONICS AND COMMUNICATION ENGINEERING
Submitted by
M.SOWMYA - 20FE1A04B1
P.SANTHISRI - 20FE1A04C4
K.GIGNESH - 20FE1A0488
K.PREMSAGAR - 20FE1A0489
CERTIFICATE
External Examiner
ACKNOWLEDGEMENT
We are most thankful to our parents who stood as pillars of motivation and for the way
they influenced and molded our lives.
We are more thankful to our chairman Dr. LAVU RATHAIAH who helped us to have
a technical incubation by providing the required infrastructure.
We are very much thankful to our principal Dr. K. PHANEENDRA KUMAR who
extended a timely help at each and every step of our academic career.
We are very thankful to our Head of the department Dr. B. HARISH an amicable
person who supported us very much and helped to a maximum extent and made this project
successful.
We are heartily thankful to our project guide Mr. G. HARISH, Assistant Professor,
the person with vibrant knowledge and amicable by nature who laid a best guide line and for
the efforts made by him to make the project a successful one.
Finally, we are thankful to each and every faculty member both technical and non-
technical, friends and all the persons who helped us directly or indirectly in making our project
a successful one.
Project Associates
M.SOWMYA (20FE1A04B1)
P.SANTHISRI (20FE1A04C4)
K.GIGNESH (20FE1A0488)
K.PREMSAGAR (20FE1A0489)
DECLARATION
We hereby declare that the work described in this project work, entitled
Andhra Pradesh, is the result of work done by us under the guidance of Mr. G.HARISH,
The work is original and has not been submitted for any Degree/Diploma of this or any
other university.
Signatures
M.SOWMYA (20FE1A04B1)
P.SANTHISRI (20FE1A04C4)
K.GIGNESH (20FE1A0488)
K.PREMSAGAR (20FE1A0489)
Place: Vadlamudi.
Date:
INDEX
CONTENTS I
ABSTRACT III
LIST OF FIGURES IV
LIST OF ABBREVIATION V
i
4.5.1.1 Convolutional Neural Network 22
4.5.1.2 Long Short Term Memory Network 22
4.5.1.3 Recurrent Neural Network 22
4.5.1.4 Generative Adversarial Network 23
4.5.1.10 Autoencoders 24
4.6 How Deep learning works 24
4.7 Python Development steps 26
Chapter 6: MODULES
6.3 Pandas 33
Chapter 7: IMPLEMENTATION
7.1 The general steps involved in leaf disease detection 36
7.2 Code Used In Python 38
Chapter 8: RESULT 41
Chapter 9: CONCLUSION 46
REFERENCES 47
ii
ABSTRACT
India is a land of agriculture and mainly known for growing variety of crops.
Around half of the population in India depend on agriculture. Diseases to the crops
may affect the livelihood of the farmers. In order to overcome this major problem, a
robot that detects the leaf disease using image processing and Machine learning is
deployed. The machine learning model with Image processing is trained with
feature extraction, Segmentation using CNN Algorithm . Android application is
used for controlling the robot. This application controls all the operation of the
robot. Diseases to the crops may affect the livelihood of the farmers. In order to
overcome this major problem, a robot that detects the leaf disease using image
processing and Machine learning is deployed. The machine learning model with
Image processing is trained with feature extraction, Segmentation using CNN
Algorithm.
iii
LIST OF FIGURES
Figure1.1. Sample images from Cotton Village dataset for types of leaf
diseases. 2
Figure 1.2. Cotton leaf detection and disease recognition methodology 3
Figure3.1 system architecture for leaf disease detection 9
Figure 3.2 .Data flow diagram for user to end process 10
Figure 3.3.Data transferring from user to database 11
Figure4.1. Installation of python 14
Figure 4.2 Optional features of python 14
Figure 4.3 Advanced options of python 15
Figure 4.4 Successful installation of python 16
Figure 8.1 output at the python 41
Figure 8.2 prediction of Leaf disease photo uploadation 42
Figure 8.3 Detected cotton yellow leaf curl virus disease 42
Figure 8.4 Detected Septoria leaf spot disease 43
Figure 8.5 Detected Bacteria spot disease 43
Figure 8.6 Detected Target spot disease 44
Figure 8.7 Detected Early Blight disease 44
Figure 8.8 Detected Healthy and fresh leaf 45
iv
LIST OF ABBREVIATION
v
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
CHAPTER 1
INTRODUCTION
1.1 Overview
Early cotton disease detection plays a significant role in efficient crop yield. Cotton
diseases like black measles, black rot, bacterial spot, etc. affect the growth, crop quality
of cottons and economic impacts in the agricultureindustry. To avoid the impact of
these diseases, expensive approaches and the use of pesticides are some solutions the
farmers usually implement. The use of chemical means damages the cotton and
the surrounding environment. In addition, this kind of approach intensifies the cost of
production and majormonetary loss to farmers.
Early discovery of diseases as they occur is the most important period for efficient
disease management. Manual disease detection through human experts to identify and
recognize cotton diseases is a usual practice in agriculture . With the improvements in
technology, automatic detection of cotton diseases from raw images is possible through
computer vision and artificial intelligence researches . In this study, the researchers
were able to investigate cotton diseases and pest’s infestation that affects the leaves of
the cottons.
The work of Lee et al. presents a hybrid model to obtain characteristics of leaves using
CNN and classify the extracted features of leaves. The methodology in the study
involves three key stages: acquisition of data, pre- processing of data and image
classification. The study utilized dataset from Cotton village dataset that contains
cotton varieties of apple, corn, grapes, potato, sugarcane, and cotton. There are 11 types
of cotton diseases identified in the study including healthy images of identified cottons.
ECE, VLITS 1
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
Image pre- processing involves re-sized images and enhancement before supplying it
for the classification model. CONVULUTIONAL NEURAL NETWORK Deep
learning is a subsection of Artificial Intelligence and machine learning that uses
Artificial neural networks (ANN). Training the deep learning models divides the
feature extraction and extracts its features for classification. There are several
applications of deep learning which include computer vision, image classification,
restoration, speech, video analysis, etc. A convolutional neural network with nominal
process can simply detect and categorize. It is efficient in evaluating graphical images
and extracts the essential features through its multi-layered structure. As shown in
Figure 1.1, the CNN involves our layers, that is: input image, convolutional layer and
pooling layer, fully connected layers, and output.
Leafdiseases
CNN deep-learning models are popular for image-based research. They are efficient in
learning low-level complex features from images. However, deep CNN layers are
difficult to train as this process is computationally expensive. To solve such issues,
transfer learning-based models have been proposed by various researchers. These
models are trained with the ImageNet dataset, which consists of multiple classes. Such
ECE, VLITS 2
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
models can be used for training with any dataset as the features of the images. Hence,
the transfer learning approach has been found to be the most suitable and robust model
for image classification. Further, transfer learning can improve learning even when
there is a smaller dataset.
1.2 Methodology
A block diagram presented in Figure 1.2 shows the Input Dataset, Image Acquisition,
Image pre-processing and Classification
Data set
Image Acquisition
Image pre-processing
Classification
Image Acquisition
Image dataset used for training the model was acquired in the Cotton Village repository.
A python script was used to download images of the cotton diseases from the repository.
The acquired dataset consists of approximately 35,000images with 32 different classes
cotton varieties and diseases.
ECE, VLITS 3
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
Image Pre-processing
Pre-processed images are reduced image size and image crop to a given input. It
processes and enhances the image to its needed colour scale. The study uses coloured
and resized images to 96x96 resolution for processing.
Classification
Classification uses a fully connected layers and for feature extraction it uses
convolutional and pooling layers. The classification process classifies thecotton leaf if
it is infected with the disease or not, identifies the type ofcotton disease and recognize
the cotton variety.
1.3 Advantages
The advantages of the proposed system are it increases the crop productivity, instant
and accurate results, automatically predicts the remedy for the disease, saves a lot of
time, protects the environment by limiting the usage of pesticides through early disease
detection, allow us to take the live sample of the leaves through digital camera.
1.4 Limitations
In addition to the above advantages the system has certain limitations of its usage,
that is while we are taking the live image through camera proper lighting conditions are
required, if not accurate results may not be acquired
ECE, VLITS 4
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
CHAPTER 2
LITERATURE SURVEY
2.1 A survey of image processing techniques for agriculture
AUTHORS: Lalit P. Saxena and Leisa J. Armstrong
ECE, VLITS 5
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
ECE, VLITS 6
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
features from 989 to 86. Three datasets were generated from the preprocessed raw
data: first derivatives, second derivatives, and a combined dataset (generated by
integrating preprocessed raw data, first derivatives and second derivatives). The
preprocessed datasets were analyzed using principal component analysis (PCA) to
further reduce the number of features used as inputs in the classification algorithm.
The dataset consisting of principal components were randomized and separated into
training and testing datasets such that 75% of the dataset was used for training;
while 25% of the dataset was used for testing the classification algorithms. The
number of samples in the training and testing datasets was145 and 48,
respectively. The classification algorithms tested were: linear discriminant analysis,
quadratic discriminant analysis (QDA), k-nearest neighbor, and soft independent
modeling of classification analogies (SIMCA). Thereported classification accuracies
of the algorithms are an average of three runs. When the second derivatives dataset
were analyzed, the QDA-based classification algorithm yielded the highest overall
average classification accuracies of about 95%, with HLB-class classification
accuracies of about 98%. In the combined dataset, SIMCA-based algorithms
resulted in high overall classification accuracies of about 92% with low false
negatives (less than 3%).
ECE, VLITS 7
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
CHAPTER 3
SYSTEM ANALYSIS
Leaf disease detection using deep learning is a popular area of research that involves
developing computer algorithms capable of detecting and classifying cotton diseases
from digital images of cotton leaves. This technology has the potential to revolutionize
agriculture by allowing farmers to quickly and accurately identify and treat diseased
cottons, thereby reducing crop losses and increasing yields.
The current approach for detecting cotton disease is simple naked eye observation by
cotton experts, which can be used to detect and identify cotton diseases. In these
circumstances, the suggested technique is useful for tracking vast fields of crops.
Furthermore, in some nations, farmers lack adequate facilities or are unaware that they
can contact experts. As a result, consulting experts is not only more expensive but also
more time consuming. In those circumstances, the suggested technique for tracking a
large number of cottons would be useful.
ECE, VLITS 8
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
Dataset Creation
CNN Design Pre-processing
Train, test, validation
Pre-process input
Training -model Load model-test
image
clasification
Figure3.3 system architecture for leaf disease detection using deep learning
ECE, VLITS 9
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
user
yes
No Unauthorized user
check
Logout
END PROCESS
1. DFD is also called as bubble chart. It is a simple graphical formalism that can be
used to represent a system in terms of input data to the system, various processing
carried out on this data, and the output data is generated by this system.
2. The data flow diagram (DFD) is one of the most important modeling tools. It is
used to model the system components. These components are the system process,
the data used by the process, an external entity that interacts with the system and
the information flows in the system.
3. DFD shows how the information moves through the system and how it is modified
ECE, VLITS 10
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
4. DFD is also known as bubble chart. A DFD may be used to represent a system at
any level of abstraction. DFD may be partitioned into levels that represent
increasing information flow and functional detail
3.5HARDWARE REQUIREMENTS
The advent of machine learning and deep learning techniques, the progress made in
cotton disease recognition has been enormous and represents a massive breakthrough
ECE, VLITS 11
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
in research. This has made it easy for automatic classification and feature extraction to
express the original characteristics of an image. Furthermore, the availability of
datasets, GPU machines, and software supporting complex deep-learning architectures
with lower complexity has made it feasible to switch from traditional methods to the
deep- learning platform.
Convolutional Neural Networks (CNNs): CNNs are a type of deep learning algorithm
that have been very successful in image recognition tasks. They can be trained to detect
patterns in images that are indicative of leaf diseases.
Support Vector Machines (SVMs): SVMs are a type of machine learning algorithm that
are used for classification tasks. They work by finding the hyperplane that best
separates the different classes of data.
K-Nearest Neighbors (KNN): KNN is a simple machine learning algorithm that can be
used for classification tasks. It works by finding the k nearest neighbors to a given data
point, and classifying the point based on the majority class of its neighbors.
Deep Belief Networks (DBNs): DBNs are a type of deep learning algorithm that are
used for unsupervised learning tasks, such as feature extraction. They can be used
to extract features from leaf images that are then fed into a classifier.
The choice of algorithm will depend on the specific requirements of the leaf disease
detection task, such as the size of the dataset, the complexity of the images, and the
desired level of accuracy.
ECE, VLITS 12
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
CHAPTER 4
SOFTWARE ENVIRONMENT
ECE, VLITS 13
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
ECE, VLITS 14
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
1.Install for all users: recommended if you’re not the only user on this computer.
2.Associate files with Python: recommended, because this option associates all
the Python file types with the launcher or editor.
3. Create shortcuts for installed applications: recommended to enable shortcuts
for Python applications.
ECE, VLITS 15
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
You can verify whether the Python installation is successful either through
the command line or through the Integrated Development Environment (IDLE)
application, if you chose to install it.
Go to Start and enter cmd in the search bar. Click Command Prompt.
Enter the following command in the command prompt:
Python--version
ECE, VLITS 16
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
4.2What is Python
Programmers have to type relatively less and indentation requirement of the language,
makes them readable all the time.
• Machine Learning
• GUI Applications (like Kivy, Tkinter, PyQt etc. )
• Web frameworks like Django (used by YouTube, Instagram, Dropbox)
• Image processing (like Opencv, Pillow)
• Web scraping (like Scrapy, BeautifulSoup, Selenium)
• Test frameworks
• Multimedia
Advantages of Python :-
Let’s see how Python dominates over other languages.
1.Extensive Libraries
Python downloads with an extensive library and it contain code for various purposes
like regular expressions, documentation-generation, unit- testing, web browsers,
threading, databases, CGI, email, image manipulation, and more. So, we don’t have to
write the complete code for that manually.
ECE, VLITS 17
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
2.Extensible
As we have seen earlier, Python can be extended to other languages. You can write
some of your code in languages like C++ or C. This comes in handy, especially in
projects.
3.Embeddable
Complimentary to extensibility, Python is embeddable as well. You can put your
Python code in your source code of a different language, like C++. This lets us add
scripting capabilities to our code in the other language.
4.Improved Productivity
The language’s simplicity and extensive libraries render programmers more
productive than languages like Java and C++ do. Also, the fact that you need to
write less and get more things done.
5.IOT Opportunities
Since Python forms the basis of new platforms like Raspberry Pi, it finds the
future bright for the Internet Of Things. This is a way to connect the language with the
real world.
7.Readable
Because it is not such a verbose language, reading Python is much like reading
English. This is the reason why it is so easy to learn, understand, and code. It also
does not need curly braces to define blocks, and indentation is mandatory.
This further aids the readability of the code.
8.Object-Oriented
This language supports both the procedural and object- oriented
programming paradigms. While functions help us with code reusability, classes and
ECE, VLITS 18
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
objects let us model the real world. A class allows the encapsulation of data and
functions into one.
10.Portable
When you code your project in a language like C++, you may need to make
some changes to it if you want to run it on another platform. But it isn’t
the same with Python. Here, you need to code only once, and you can run
it anywhere. This is called Write Once Run Anywhere (WORA). Howe ver ,
you need to be careful enough not to include any system- dependent features.
11.Interpreted
Lastly, we will say that it is an interpreted language. Since statements
are executed one by one, debugging is easier than in compiled languages.
1.Less Coding
Almost all of the tasks done in Python requires less coding when the
same task is done in other languages. Python also has an awesome standard
library support, so you don’t have to search for any third-party libraries to
get your job done. This is the reason that many people suggest learning
Python to beginners.
2.Affordable
Python is free therefore individuals, small companies or big organizati ons
can leverage the free available resources to build applications. Python is
popular and widely used so it gives you better community support .
ECE, VLITS 19
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
4.4Disadvantages of Python
So far, we’ve seen why Python is a great choice for your project. But if you
choose it, you should be aware of its consequences as well. Let’s now see the downsides
of choosing Python over another language.
1.Speed Limitations
We have seen that Python code is executed line by line. But since
Python is interpreted, it often results in slow execution. This, however, isn’t a problem
unless speed is a focal point for the project. In other words, unless high speed is a
requirement, the benefits offered by Python are enough to distract us from its speed
limitations.
ECE, VLITS 20
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
5.Simple
No, we’re not kidding. Python’s simplicity can indeed be a problem. Take my
example. I don’t do Java, I’m more of a Python person. To me, its syntax is so simple
that the verbosity of Java code seems unnecessary.
ECE, VLITS 21
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
10. Autoencoders
Convolutional Neural Networks, also known as CNN or ConvNet, come under the
category of the artificial neural networks used for image processing and visualizing.
Artificial intelligence uses deep learning to perform the task. Neural networks are
either hardware or software programmed as neurons in the human brain. The traditional
neural network takes only images of reduced resolution as inputs. CNN solves that
problem by arranging their neurons as the frontal lobe of human brains. Pre-
processing on CNN is very less when compared to other algorithms. Convolution, a
linear mathematical operation, is employed on CNN. It uses convolution instead of
general matrix multiplication in one of its layers.
LSTMs retain information over time. They are useful in time-series prediction because
they remember previous inputs. LSTMs have a chain-like structure where four
interacting layers communicate in a unique way. Besides time- series predictions,
LSTMs are typically used for speech recognition, music composition, and
pharmaceutical development.
The output from the LSTM becomes an input to the current phase and can memorize
previous inputs due to its internal memory. RNNs are commonly used for image
ECE, VLITS 22
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
The usage of GANs has increased over a period of time. They can be used to improve
astronomical images and simulate gravitational lensing for dark- matter research. Video
game developers use GANs to upscale low-resolution, 2D textures in old video games
by recreating them in 4K or higher resolutions via image training.
GANs help generate realistic images and cartoon characters, create photographs of
human faces, and render 3D objects.
Data visualization attempts to solve the problem that humans cannot easily visualize
high-dimensional data. SOMs are created to help users understand this high-
dimensional information.
ECE, VLITS 23
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
DBNs are a stack of Boltzmann Machines with connections between the layers, and
each RBM layer communicates with both the previous and subsequent layers. Deep
Belief Networks (DBNs) are used for image- recognition, video-recognition, and
motion-capture data.
2.Hidden unit
Each visible unit is connected to all hidden units. RBMs have a bias unit that is
connected to all the visible units and the hidden units, and they have no output nodes.
4.5.1.10 Autoencoders
Autoencoders are a specific type of feedforward neural network in which the input
and output are identical. Geoffrey Hinton designed autoencoders in the 1980s to solve
unsupervised learning problems. They are trained neural networks that replicate the
data from the input layer to the output layer. Autoencoders are used for purposes such
as pharmaceutical discovery, popularity prediction, and image processing.
The term “deep” usually refers to the number of hidden layers in the neural network.
only contain 2-3 hidden layers, while deep networks can have as many as 150.
ECE, VLITS 24
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
Deep learning models are trained by using large sets of labeled data and neural network
architectures that learn features directly from the data without the need for manual
feature extraction.
Another key difference is deep learning algorithms scale with data, whereas shallow
learning converges. Shallow learning refers to machine learning methods that plateau
at a certain level of performance when you add more examples and training data to the
network.
A key advantage of deep learning networks is that they often continue to improve as
the size of your data increases.
ECE, VLITS 25
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
• There is only one integer type left, i.e. int. long is int as well.
• The division of two integers returns a float instead of an integer. "//" can be used to
have the "old" behaviour.
Purpose :-
ECE, VLITS 26
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
CHAPTER 5
SYSTEM TEST
The purpose of testing is to discover errors. Testing is the process of trying to discover
every conceivable fault or weakness in a work product. It provides a way to check the
functionality of components, sub assemblies, assemblies and/or a finished product It is
the process of exercising software with the intent of ensuring that the Software system
meets its requirements and user expectations and does not fail in an unacceptable
manner. There are various types of test. Each test type addresses a specific testing
requirement.
Integration testing
Integration tests are designed to test integrated software components to determine if
they actually run as one program. Testing is event driven and is more concerned with
the basic outcome of screens or fields. Integration tests demonstrate that although the
components were individually satisfaction, as shown by successfully unit testing, the
combination of components is correct and consistent. Integration testing is specifically
aimed at exposing the problems that arise from the combination of components.
ECE, VLITS 27
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
Functional test
Functional tests provide systematic demonstrations that functions tested are available
as specified by the business and technical requirements, system documentation, and
user manuals.
System Test
System testing ensures that the entire integrated software system meets requirements. It tests a
configuration to ensure known and predictable results. An example of system testing is the
configuration oriented system integration test. System testing is based on process descriptions
and flows, emphasizing pre-driven process links and integration points.
ECE, VLITS 28
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
Unit Testing
Unit testing is usually conducted as part of a combined code and unit test phase of the
software lifecycle, although it is not uncommon for coding and unit testing to be
conducted as two distinct phases.
Test objectives
• All field entries must work properly.
• Pages must be activated from the identified link.
• The entry screen, messages and responses must not be delayed.
Features to be tested
• Verify that the entries are of the correct format
• No duplicate entries should be allowed
• All links should take the user to the correct page.
Integration Testing
Software integration testing is the incremental integration testing of two or more
integrated software components on a single platform to produce failures caused by
interface defects.
The task of the integration test is to check that components or software applications,
e.g. components in a software system or – one step up – software applications at the
company level – interact without error.
Test Results: All the test cases mentioned above passed successfully. No defects
encountered.
ECE, VLITS 29
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
Acceptance Testing
User Acceptance Testing is a critical phase of any project and requires significant
participation by the end user. It also ensures that the system meets the functional
requirements.
Test Results: All the test cases mentioned above passed successfully. No
defects encountered.
ECE, VLITS 30
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
CHAPTER 6
Modules
1. Tensor flow
2. Numpy
3. Pandas
6.1 Tensorflow
TensorFlow was developed by the Google Brain team for internal Google use. It was
released under the Apache 2.0 open-source license on November 9, 2015. TensorFlow
is an open source framework developed by Google researchers to run machine learning,
deep learning and other statistical and predictive analytics workloads. Like similar
platforms, it's designed to streamline the process of developing and executing advanced
analytics applications for users such as data scientists, statisticians and predictive
modelers.
The TensorFlow software handles data sets that are arrayed as computational nodes in
graph form. The edges that connect the nodes in a graph can represent multidimensional
vectors or matrices, creating what are known as tensors. Because TensorFlow programs
use a data flow architecture that works with generalized intermediate results of the
computations, they are especially open to very large-scale parallel processing
applications, with neural networks being a common example.
The framework includes sets of both high-level and low-level APIs. Google
recommends using the high-level ones when possible to simplify data pipeline
development and application programming. However, knowing how to use the low-
level APIs -- called TensorFlow Core -- can be valuable for experimentation and
debugging of applications, the company says; it also gives users a "mental model" of
the machine learning technology's inner workings, in Google's words.
ECE, VLITS 31
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
Google's first TPUs, detailed publicly in 2016, were used internally in conjunction with
TensorFlow to power some of the company's applications and online services,
including its RankBrain search algorithm and Street View mapping technology.
In early 2018, Google furthered its external TensorFlow efforts by making the second
generation of TPUs available to Google Cloud Platform users for training and running
their own machine learning models. TensorFlow-based workloads are billed on a per-
second basis; the Cloud TPU service initially was launched as a beta program with
only "limited quantities" of the devices available for use, according to Google
Applications of TensorFlow
For the most part, TensorFlow applications are advanced and large-scale AI
undertakings in the realms of machine learning and deep learning. In powering Google's
Rank Brain machine learning system, TensorFlow has been employed to improve the
information retrieval capabilities of the company's flagship search engine.
Google has also used the framework for applications that include automatic email
response generation, image classification and optical character recognition, as well as a
drug-discovery application that the company worked on with researchers from Stanford
University. Other companies listed on the TensorFlow website as users of the
framework include Airbnb, Coca-Cola, eBay, Intel, Qualcomm, SAP, Twitter, Uber
and Snapchat developer Snap Inc. Another user is STATS LLC.
TensorFlow-based deep learning has also been a part of experiments and tests
involving one of the larger-scaled proposed innovations today, that is self-
driving cars.Some smaller-scale uses have been found, too. For example, a
small Japanese farm uses TensorFlow to sort cucumbers based on their
textures.
6.2 Numpy
ECE, VLITS 32
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
pandas is a Python package providing fast, flexible, and expressive data structures
designed to make working with “relational” or “labeled” data both easy and intuitive. It
aims to be the fundamental high-level building block for doing practical, real-world
data analysis in Python. Additionally, it has the broader goal of becoming the most
ECE, VLITS 33
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
powerful and flexible open source data analysis/manipulation tool available in any
language. It is already well on its way toward this goal.
pandas is well suited for many different kinds of data:
• Easy handling of missing data (represented as NaN) in floating point as well as non-
floating point data
• Size mutability: columns can be inserted and deleted from DataFrame and higher
dimensional objects
• Automatic and explicit data alignment: objects can be explicitly aligned to a set of
labels, or the user can simply ignore the labels and let Series, DataFrame, etc.
automatically align the data for you in computations
• Powerful, flexible group by functionality to perform split-apply-combine operations on
data sets, for both aggregating and transforming data
• Make it easy to convert ragged, differently-indexed data in other Python and NumPy
data structures into DataFrame objects
• Intelligent label-based slicing, fancy indexing, and subsetting of large data sets
ECE, VLITS 34
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
• Robust IO tools for loading data from flat files (CSV and delimited), Excel files,
databases, and saving / loading data from the ultrafast HDF5 format
• Time series-specific functionality: date range generation and frequency conversion,
moving window statistics, date shifting, and lagging.
Many of these principles are here to address the shortcomings frequently experienced
using other languages / scientific research environments. For data scientists, working
with data is typically divided into multiple stages: munging and cleaning data,
analyzing / modeling it, then organizing the results of the analysis into a form suitable
for plotting or tabular display. pandas is the ideal tool for all of these tasks.
Some other notes
• pandas is fast. Many of the low-level algorithmic bits have been extensivel y
tweaked in Cython code. However, as with anything else generalization usually
sacrifices performance. So if you focus on one feature for your application you
may be able to create a faster specialized tool.
• pandas is a dependency of statsmodels, making it an important part of the
statistical computing ecosystem in Python.
• pandas has been used extensively in production in financial applications.
ECE, VLITS 35
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
CHAPTER 7
IMPLEMENTATION
Leaf disease detection using deep learning is a popular area of research that involves
developing computer algorithms capable of detecting and classifying cotton diseases
from digital images of cotton leaves. This technology has the potential to revolutionize
agriculture by allowing farmers to quickly and accurately identify and treat diseased
cottons, thereby reducing crop losses and increasing yields.
Deep learning is a subset of machine learning that utilizes artificial neural networks
with multiple layers to process and analyze large datasets. In the case of leaf disease
detection, deep learning algorithms are trained using thousands of images of healthy
and diseased cottons to learn the features that distinguish healthy cottons from those
affected by disease. Once trained, these algorithms can be used to classify new images
of cotton leaves as either healthyor diseased.
There are several deep learning models that can be used for leaf disease detection,
including Convolutional Neural Networks (CNNs) and Deep Convolutional Neural
Networks (DCNNs). These models have been used successfully to detect a wide range
of cotton diseases, including cotton leaf mold, citrus greening, and apple scab.
To develop an effective leaf disease detection system, several steps must be followed.
These include collecting a large dataset of cotton images, pre- processing the images to
remove noise and enhance features, training the deep learning model on the pre-
processed images, and validating the model using a separate set of images. Once
the model has been validated, it can be used to classify new images of cotton
leaves as either healthy or diseased.
Overall, leaf disease detection using deep learning has the potential to
significantly improve agricultural practices by allowing farmers to quickly and
accurately identify and treat diseased cottons, thereby increasing crop yields
and reducing losses.
ECE, VLITS 36
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
Data collection:
The first step is to collect a dataset of images of leaves affected by different
diseases, as well as images of healthy leaves. The dataset should be diverse,
containing leaves from different cotton species, different lighting
conditions, angles, and backgrounds.
Data pre-processing:
The collected dataset needs to be pre-processed to ensure that the images
are of the same size and format. Pre-processing may also involve data
augmentation techniques such as flipping, rotating, and scaling the images
to increase the diversity of the dataset.
Model selection:
The next step is to select a deep learning model suitable for image
classification. Popular models for this task include Convolutional Neural
Networks (CNNs) such as VGG, ResNet, and Inception.
Model training:
The selected model is then trained on the preprocessed dataset. The training
involves feeding the model with input images and their corresponding labels
(disease or healthy). The model then learns to classify the images based on
the patterns and features it learns from the dataset.
Model evaluation:
The trained model is then evaluated on a separate dataset to assess its
performance. The evaluation metrics used may include accuracy, precision,
recall, and F1 score.
Deployment:
The final step is to deploy the trained model to a production environment where it can
be used for real-time disease detection. This can be done by integrating the model into
an application or web-based system that can process images of leaves and provide a
diagnosis.
ECE, VLITS 37
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
def pred_cotton_dieas(cotton_cotton):
test_image = load_img(cotton_cotton, target_size = (128, 128)) # load image
print("@@ Got Image for prediction")
elif pred==1:
return "Cotton - Early Blight Disease", 'Cotton-Early_Blight.html'
elif pred==2:
return "Cotton - Healthy and Fresh", 'Cotton-Healthy.html'
ECE, VLITS 38
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
elif pred==3:
return "Cotton - Late Blight Disease", 'Cotton - Late_blight.html'
elif pred==4:
return "Cotton - Leaf Mold Disease", 'Cotton - Leaf_Mold.html'
elif pred==5:
return"Cotton-Septoria Leaf SpotDisease",'Cotton - Septoria_leaf_spot.html'
elif pred==6:
return "Cotton - Target Spot Disease", 'Cotton - Target_Spot.html'
elif pred==7:
return "Cotton - Tomoato Yellow Leaf Curl Virus Disease", 'Cotton -
Cotton_Yellow_Leaf_Curl_Virus.html'
elif pred==8:
return"Cotton- Cotton MosaicVirus Disease", 'Cotton - Cotton_mosaic_virus.html'
elif pred==9:
return "Cotton - Two Spotted Spider Mite Disease", 'Cotton - Two-
spotted_spider_mite.html'
# Create flask instance app = Flask( name )
# get input image from client then predict class and render respective .html page
for solution
@app.route("/predict", methods = ['GET','POST'])
def predict():
if request.method == 'POST':
file = request.files['image'] # fet input
filename = file.filename
print("@@ Input posted = ", filename)
ECE, VLITS 39
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
file_path = os.path.join('C:/Users/navee/OneDrive/Desktop/Cotton-
Leaf-Disease-Prediction-main/static/upload/', filename)
file.save(file_path)
ECE, VLITS 40
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
CHAPTER 8
RESULTS
Leaf disease detection using deep learning has shown promising results in recent years.
The use of deep learning models, such as Convolutional Neural Networks (CNNs), has
significantly improved the accuracy of leaf disease detection systems.
One of the most widely used datasets for leaf disease detection is the CottonVillage
dataset, which contains images of healthy and diseased leaves from various cotton
species. Researchers have used this dataset to train deep learning models, such as
CNNs, to accurately identify different types of leaf diseases.
The performance of these models varies depending on the architecture and training
parameters used. However, some studies have reported very high accuracy rates for leaf
disease detection. For example, a study published in the journal Computers and
Electronics in Agriculture reported an accuracy rate of 99.53% for cotton leaf disease
detection using a deep learning model based on the Inception-v3 architecture.
Overall, leaf disease detection using deep learning has shown great potential for
improving crop yield and reducing crop loss due to diseases. With further research and
development, it is likely that we will see even more accurate and efficient systems for
detecting and diagnosing leaf diseases in the future.
ECE, VLITS 41
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
ECE, VLITS 42
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
ECE, VLITS 43
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
ECE, VLITS 44
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
ECE, VLITS 45
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
CHAPTER 8
CONCLUSION
This project presents an automated, low cost and easy to use end-to- end
solution to one of the biggest challenges in the agricultural domain for farmers –
precise, instant and early diagnosis of crop diseases and knowledge of disease
outbreaks - which would be helpful in quick decision making for measures to be
adopted for disease control. This proposal innovates on known prior art with the
application of deep Convolutional Neural Networks (CNNs) for disease classification,
introduction of social collaborative platform for progressively improved accuracy,
usage of geocoded images for disease density maps and expert interface for analytics.
High performing deep CNN model “Inception” enables real time classification of
diseases in the Cloud platform via a user facing mobile app. Collaborative model
enables continuous improvement in disease classification accuracy by automatically
growing the Cloud based training dataset with user added images for retraining the
CNN model. User added images in the Cloud repository also enable rendering of
disease density maps based on collective disease classification data and availability of
geolocation information within the images.
Overall, the results of our experiments demonstrate that the proposal has significant
potential for practical deployment due to multiple dimensions the Cloud based
infrastructure is highly scalable and the underlying algorithm works accurately even
with large number of disease categories, performs better with high fidelity real -life
training data, improves accuracy with increase in the training dataset, is capable of
detecting early symptoms of diseases and is able to successfully differentiate between
diseases of the same family.
ECE, VLITS 46
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
REFERENCES
1. Liu, Bin, "Identification of apple leaf diseases based on deep convolutional neural
networks
2. Jeon, Wang-Su, and Sang-Yong Rhee. "Cotton leaf recognition using a convolution
neural network." International Journal of Fuzzy Logic and Intelligent Systems 17.1
(2017): 26-34.
3. Amara, Jihen, Bassem Bouaziz, and Alsayed Algergawy. "A Deep Learning-based
Approach for Banana Leaf Diseases Classification." BTW (Workshops). 2017.
4. Lee, Sue Han, et al. "How deep learning extracts and learns leaf features for cotton
classification." Pattern Recognition 71 (2017): 1-13.
5. Sladojevic, Srdjan, et al. "Deep neural networks-based recognition of cotton diseases
by leaf image classification." Computational intelligence and neuroscience 2016
(2016).
6. Lee, Sue Han, et al. "Cotton Identification System based on a Convolutional Neural
Network for the LifeClef 2016 Cotton ClassificationTask." CLEF (Working Notes).
2016.
7. He, Kaiming, et al. "Deep residual learning for image recognition." Proceedings of the
IEEE conference.
8. K.Padmavathi, and K.Thangadurai,“Implementation of RGB and Gray scale images in
cotton leaves disease detection –comparative study,”
9. Kiran R. Gavhale, and U. Gawande, “An Overview of the Research on Cotton Leaves
International Journal of Pure and Applied Mathematics Special Issue 882Disease
detection using Image Processing Techniques,” IOSR J. of Compu. Eng.
10. Y. Q. Xia, Y. Li, and C. Li, “Intelligent Diagnose System of Wheat
Diseases Based on Android Phone,” J. of Infor. & Compu. Sci., vol. 12,
pp. 6845-6852, Dec. 2015.
ECE, VLITS 47
IMPLEMENTATION OF DETECTION AND CLASSIFICATION OF COTTON LEAF
DISEASE USING LIGHT WEIGHT CNN ARCHITECTURE
ECE, VLITS 48