0% found this document useful (0 votes)
430 views

Project Documentation

The document describes a project that aims to develop a machine learning model to detect plant diseases from images using convolutional neural networks. It will train models on image datasets of plants with and without diseases and develop an Android app that can predict the disease of a plant by taking an image of its leaf. The project report covers the system analysis, software requirements, development environment, and design of the plant disease detection system using machine learning.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
430 views

Project Documentation

The document describes a project that aims to develop a machine learning model to detect plant diseases from images using convolutional neural networks. It will train models on image datasets of plants with and without diseases and develop an Android app that can predict the disease of a plant by taking an image of its leaf. The project report covers the system analysis, software requirements, development environment, and design of the plant disease detection system using machine learning.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 75

A

Project Report on

PLANT DISEASE DETECTION USING MACHINE LEARNING

Submitted in partial fulfilment of the requirements for the Award of the degree of
BACHELOR OF TECHNOLOGY

IN

COMPUTER SCIENCE AND ENGINEERING

SUBMITTED BY

G.KEERTHANA 17L31A05J6

B.DHEERAJ VARMA 17L31A05I8

A. AMRUTHA 17L31A05L6

M.NISSY GRACE 17L31A05L9

Under the esteemed guidance of

Mrs. A. SRAVANI, M.TECH

Assistant Professor, CSE Department

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING

VIGNAN’S INSTITUTE OF INFORMATION TECHNOLOGY (Autonomous)


Affiliated to JNTU Kakinada & Approved by AICTE, New Delhi

Re-Accredited by NBA & NAAC (CGPA of 3.41/ 4.00)

ISO 9001:2008, ISO 14001:2004, OHSAS 18001:2007 Certified Institution

VISAKHAPATNAM – 530 039

June-2021
VIGNAN’S INSTITUTE OF INFORMATION TECHNOLOGY

Department of Computer Science and Engineering

CERTIFICATE

This is to certify that the project report entitled “PLANT DISEASE DETECTION USING
MACHINE LEARNING” is the bonafide record of project work carried out under my
supervision by G. Keerthana(17L31A05J6), B. Dheeraj Varma(17L31A05I8), A.
Amrutha (17L31A05L6), and M. Nissy Grace(17L31A05L9), during the academic year
2020-2021, in partial fulfilment of the requirements for the award of the degree of Bachelor
of Technology in Computer Science and Engineering of Jawaharlal Nehru Technological
University, Kakinada. The results embodied in this project report have not been submitted to
any other University or Institute for the award of any Degree Or Diploma.

Head of the Department Signature of Project Guide

Mr. B. Dinesh Reddy Mrs. A. Sravani

HOD, CSE Dept Assistant Professor, CSE Dept


DECLARATION

We hereby declare that the project report entitled “PLANT DISEASE DETECTION
USING MACHINE LEARNING” has been written by us and has not been submitted either
in part or whole for the award of any degree, diploma or any other similar title to this or any
other university .

1. Ms. G. Keerthana, 17L31A05J6


2. Mr. B. Dheeraj Varma, 17L31A05I8
3. Ms. A. Amrutha, 17L31A05L6
4. Ms. M. Nissy Grace, 17L31A05L9

Date:

Place:

i
ACKNOWLEDGEMENT

It gives us a great sense of pleasure to acknowledge the assistance and cooperation we have
received from several persons while undertaking this B. Tech. Final Year Project. We owe
special debt of gratitude to Mrs. A. Sravani, Department of Computer Science &
Engineering, for her constant support and guidance throughout the course of our work. Her
sincerity, thoroughness and perseverance have been a constant source of inspiration for us.

We also take the opportunity to acknowledge the contribution of Mr. B. Dinesh Reddy,
Head, Department of Computer Science & Engineering, for his full support and assistance
during the development of the project.

We also do not like to miss the opportunity to acknowledge the contribution of all faculty
members of the department for their kind assistance and cooperation during the development
of our project. Last but not the least, we acknowledge our friends for their contribution in the
completion of the project.

ii
ABSTRACT

Agriculture is the most primary and indispensable source to furnish national income of
numerous countries including India. Getting affected by a disease is very common in
plants due to various factors such as fertilizers , cultural practices followed by
environmental conditions etc. Diseases in plants/crops are the serious causes in
degrading the production quantity and quality, which results in economic losses. Any
technique or method to overcome this problem and getting a warning before the plants
are infected would aid farmers to efficiently cultivate crops or plants, both
qualitatively and quantitatively.

Thus, disease detection in plants plays a very important role in agriculture. Plant
disease symptoms are evident in various parts of plants. In this project we take an
image dataset of some plants with and without diseases. We will use machine learning
classification algorithms to design a model and we will embed that into an android
app which will be able to predict the disease of the plant on seeing an image of the
plant leaf.

iii
CONTENTS

PAGE NO

Declaration i
Acknowledgement ii
Abstract iii
List of Figures viii
List of Abbreviations viii

1. INTRODUCTION 01
1.1 About the Project 02
1.2 Problem statement 02
1.3 Objective of the Project 02
1.4 Achievements 03

2. SYSTEM ANALYSIS 04
2.1 Feasibility study 05
2.1.1 Technical feasibility 05
2.1.2 Social feasibility 05
2.1.3 Operational feasibility 06
2.2 Existing system 06
2.3 Proposed system 06
2.4 System design 07
2.4.1 Input design 07
2.4.2 Output design 07
2.5 System block diagram 08

iv
3. SOFTWARE REQUIREMENT SPECIFICATIONS 09
3.1 Functional requirements 10
3.1.1 Camera 10
3.2 Non functional requirements 10
3.2.1 Efficiency 10
3.2.2 Portability 11
3.2.3 Reliability 11
3.2.4 Availability 11
3.3 Environmental specifications 11
3.3.1 Software requirements 11
3.3.2 Hardware requirements 12

4. SYSTEM DEVELOPMENT ENVIRONMENT 13


4.1 Introduction to Python 14
4.1.1 Why Python? 14
4.1.2 Advantages & Limitations of Python 15
4.1.3 Limitations of Python 16
4.2 Introduction to Dart 17
4.3 Introduction to Flutter 17
4.3.1 Why Flutter uses Dart? 17
4.3.2 Core Principles of flutter 18
4.3.3 Widgets in Flutter 18
4.3.4 Composition > Inheritance 19
4.3.5 Layers in Flutter 20
4.3.6 Building widgets in Flutter 21
4.3.7 Handling User Interaction in Flutter 21
4.4 Google Colab Notebook 22
4.5 CNN Algorithm 22
4.5.1 Working on CNN 23
4.5.2 Architecture of CNN 23
4.5.3 Convolutional Layers 24
4.5.3.1 Convolutional Layer 24
v
4.5.3.2 Pooling Layer 24
4.5.3.3 Fully Connected Layer 25
4.5.3.4 Dropout 25
4.5.3.5 Activation Functions 26
4.6 Mobilenet 26
4.6.1 Mobilenet Architecture 26

5. SOFTWARE DESIGN 28
5.1 Introduction to UML Diagrams 29
5.1.1 Things 29
5.1.1.1 Structural Things 29
5.1.1.2 Behavioural Things 31
5.1.1.3 Grouping Things 32
5.1.1.4 Annotational Things 32
5.2 UML Diagram 32
5.2.1 Use case diagram 32
5.2.2 Sequence diagram 33
5.2.3 Activity Diagram 34

6. MODULES 36
6.1 OS Module 37
6.2 TensorFlow module 37
6.3 Keras module 37

7. CODING 39
7.1 Machine Learning model code 40
7.2 Android Application Code 45

8. TESTING 50
8.1 Testing 51
8.1.1 Testing objectives 51
8.1.2 Testing Principles 51
vi
8.2 Test Plan 52
8.3 Testing Strategies 52
8.3.1 Types of testing 53
8.3.1.1 White-box testing 53
8.3.1.2 Black-box testing 54
8.3.1.3 Integration testing 54
8.3.1.4 System testing 54
8.3.1.5 Validation testing 55
8.4 Test case design 55
8.4.1 Information to include in a formal test case 55
8.4.2 Identification and classification 55
8.4.3 Instructions 55
8.4.4 Expected result 56
8.4.5 Levels of importance of test cases 56
8.5 Class testing 56

9. OUTPUT SCREENS 58
9.1 Splash Screen 59
9.2 Home page 60
9.3 Output page 61

10. CONCLUSION 62

11. REFERENCES 64

vii
LIST OF FIGURES
Figure No. Figure Name Page No
1 System Block Diagram 08

2 Composition Inheritance 19
3 Flutter Framework Layer 20
4 Handling User Interaction in Flutter 22
5 Architecture of CNN 24
6 Use case diagram 33
7 Sequence diagram 34
8. Activity diagram 35
9 Splash Screen 59
10 Home Page 60
11 Output Page 61

LIST OF ABBREVIATIONS
S.No. Abbreviations Expansion
1 CNN Convolutional Neural Network
2 UML Unified Modelling Language
3 OS Operating System
4 ReLu Rectified Linear Unit
5 GPU Graphics Processing Unit
6 VB Visual Basics
7 UI User Interface
8 JSX Javascript XML
9 XML eXtensible Markup Language
10 API Application Programming Interface
11 SDK Software Development Kit

viii
CHAPTER 1
INTRODUCTION

COMPUTER SCIENCE ENGINEERING Page 1


1.INTRODUCTION

1.1 ABOUT THE PROJECT

Indian economy is dependent on agricultural productivity. Over 70% of rural homes depend
on agriculture. Agriculture pays about 17% to the total GDP and provides employment to
over 60% of the population. Therefore detection of plant diseases plays a vital key role in the
arena of agriculture. Indian agriculture is composed of a wide range of crops. All these crops
grow based on the strength of leaves and roots. There are things that lead to different diseases
for the plant leaves, which spoil crops and finally it will affect the economy of the country.
These big losses can be avoided by early identification of plant diseases. Accurate detection
of plant disease is needed to strengthen the field of agriculture and economy of our country.
Various types of Disease kill leaves in a plant. Farmers get more difficulties in identifying
these diseases in its initial stage, they are unable to take precaution on those plants due to lack
of knowledge on those diseases. In the current day the Machine Learning methods are a
suitable, efficient and reliable field for disease detection with help of plant leaf images.
Farmers need fast and efficient techniques to detect all types of diseases of plants that can
save time. These systems can reduce efforts and use of pesticides. For measurement of yields
in agriculture different ideas are proposed by scientists with the help of laboratories and
systems for efficient identification of plant leaf diseases. The proposed Android Application
is one of the solutions to detect various plant diseases in its initial stage.

1.2 PROBLEM STATEMENT

Traditionally, identification of plant diseases has relied on human annotation by visual


inspection and the agricultural production cost can be significantly increased if plant diseases
are not detected and cured in their early stages of the disease . It will affect the farmers and
economy of the country very badly

1.3 OBJECTIVE OF THE PROJECT

The objective of the project is to help the farmers by detecting the diseases in the plants at an
early stage and reduce their crop damage and help in cost deduction.

COMPUTER SCIENCE ENGINEERING Page 2


1.4 ACHIEVEMENTS

The process of developing this model was an enriching experience. It made us identify and
utilize a variety of learning materials, resources and technology methods to support &
develop this model. A great deal of knowledge has been gained through the trials of the
project, these lessons will be valuable in future endeavors. We got an opportunity to learn
multiple things like tensor flow ,python and dart . The project pronded a unique opportunity
to know and learn about the technical functionalities which play a crucial role in the success
of the project

COMPUTER SCIENCE ENGINEERING Page 3


CHAPTER-2

SYSTEM ANALYSIS

COMPUTER SCIENCE ENGINEERING Page 4


2.SYSTEM ANALYSIS

2.1 FEASIBILITY STUDY

The feasibility of the project is analyzed in this phase and a Socio-beneficiary proposal is put
forth with a very general plan for the project and for the benefit of the farmers. During system
analysis the feasibility study of the proposed system is to be carried out. For feasibility
analysis, some understanding of the major requirements for the system is essential.

Three key consideration involved in the feasibility analysis are

❖ TECHNICAL FEASIBILITY
❖ SOCIAL FEASIBILITY
❖ OPERATIONAL FEASIBILITY

2.1.1 TECHNICAL FEASIBILITY

The system is developed for an Android environment. Python and Dart programming
languages have been used to develop the system. The technical feasibility has been carried
out. The system is technically feasible for development and can be developed with the
existing facility.

2.1.2 SOCIAL FEASIBILITY

The aspect of study is to check the level of acceptance of the Application by the user. This
includes the process of training the user to use the Application efficiently. The user must feel
the ease of using the Application. The level of acceptance by the users solely depends on the
methods that are employed to educate the user about the Application and to make him
familiar with it. His level of confidence must be raised so that he is also able to make some
constructive criticism, which is welcomed, as he is the final user of the system.

COMPUTER SCIENCE ENGINEERING Page 5


2.1.3 OPERATIONAL FEASIBILITY

Operational feasibility determines if the proposed Application satisfies user objectives and
can be fitted into current system operation. As the user requires minimum knowledge about
how to use an android phone, So it can be considered as operationally feasible.

2.2 EXISTING SYSTEM:

● In the existing system, A machine learning model is used to detect the disease of the
plant by taking the picture of the plant as input.

● This system gives an accuracy of 70-80% only.

Drawbacks:

● It will be difficult for the farmers to use this model since they have to input the
images in a computer.

● It has not focused on increasing the recognition rate and classification accuracy of the
diseases.

2.3 PROPOSED SYSTEM

● In the proposed system we can identify the diseases of the plant by giving the image
of the plant as input in the Android application which is embedded by our machine
learning model.
● The accuracy of this model of the proposed model is ranging around 80-90%.

Benefits:

● The Android Application was developed in such a way that is easy and user friendly
for the farmers to use.

● It has a good range of accuracy

COMPUTER SCIENCE ENGINEERING Page 6


2.4 SYSTEM DESIGN

2.4.1 INPUT DESIGN

The input design is the link between the information system and the user. It comprises the
developing specification and procedures for data preparation and those steps necessary to put
data into a usable form for processing and can be achieved by the Application to input data
from camera (capture image) or upload image from file manager.The input is designed in
such a way so that it provides security and ease of use with retaining privacy. Input Design
considered the following things:

• What data should be given as input?

• The user interface to guide the operating person in providing input

2.4.2 OUTPUT DESIGN

An output is one, which meets all the requirements of the goals of the project. In this
Application results are communicated to the users via screen.In output design it is determined
how the information is to be displaced for immediate need. It is the most important and direct
source of information to the user. Efficient and intelligent output design improves the
Application’s relationship to help people in plant disease Detection. Designing the
Application output should proceed in an organized, well thought out manner; the right output
must be developed while ensuring that each output so that users will find that the Application
can be used easily and effectively.

COMPUTER SCIENCE ENGINEERING Page 7


2.5 SYSTEM BLOCK DIAGRAM

Figure 1: System Block Diagram

COMPUTER SCIENCE ENGINEERING Page 8


CHAPTER-3

SOFTWARE REQUIREMENT SPECIFICATIONS

COMPUTER SCIENCE ENGINEERING Page 9


3. SOFTWARE REQUIREMENT SPECIFICATIONS

3.1. FUNCTIONAL REQUIREMENTS


It describes what the Application should do i.e. the services provided for the users by the
Application.
The functional requirements should include:
1. Everything that a user of the Application would need to know regarding what the
Application does.
2. Everything that would concern any other that has to interface with the Application.
The functional requirements can be further categorized as follows:
● Which type of input the Application should accept and undergo conditions. This includes
data and commands both from the user and the other Applications.
● What computations the Application should produce.

3.1.1 CAMERA
Input:The camera ensures to capture the image which is used in the further process
Processing:The Application which is designed ensures to detect the type of disease of the
plant.
Output:If the model is processed successfully we will get the output as which type of disease
is it.

3.2. NON-FUNCTIONAL REQUIREMENTS


Non-functional requirements describe user-visible aspects of the Application that are not
directly related to functionally of the system.These requirements define what qualities are
exhibited by the system.
The following are the non-functional requirements of the system

3.2.1. EFFICIENCY
Efficiency is concerned with the system resources used when providing the required
functionality. The amount of disk space, memory, network etc. provides a good indication of
this characteristic.This application focuses on increasing the recognition rate and

COMPUTER SCIENCE ENGINEERING Page 10


classification accuracy of the diseases. Thus the Application can provide efficiency in the
results.

3.2.2. PORTABILITY
Portability specifies the ease with which the application can be installed on all
necessary platforms, and the platforms on which it is expected to run. We had to use Dart and
Python for developing our project. Since our application is an android application we can run
only on mobile phones which have android operating system.So our Application is
moderately portable

3.2.3. RELIABILITY
Reliability characteristic defines the capability of the application to maintain its
service provision under defined conditions for defined periods of time. One aspect of this
characteristic is fault tolerance that is the ability of an application to withstand component
failure. All the details provided by the user are recorded. Hence we can say the application is
extremely reliable.

3.2.4. AVAILABILITY
Availability is the ratio of time an application or component is functional to the total
time it is required or expected to function. The user can always use the application when he
has an android mobile phone in which the application is installed.Our application can be
accessed by users at any time and place since it is easier to use unlike a Machine Learning
Model.

3.3. ENVIRONMENT SPECIFICATION

3.3.1. SOFTWARE REQUIREMENTS


● Operating system : Windows 7 and above
● Coding Languages : Python 3.7 and Dart
● IDE : Colab and Android Studio

COMPUTER SCIENCE ENGINEERING Page 11


3.3.2. HARDWARE REQUIREMENTS

● CPU : I5 or later
● RAM : 8GB or above
● INPUT DEVICE : Android Mobile phone
● OUTPUT DEVICE : Android Mobile Phone
● SPEED : 1.1GHZ

COMPUTER SCIENCE ENGINEERING Page 12


CHAPTER-4

SYSTEM DEVELOPMENT ENVIRONMENT

COMPUTER SCIENCE ENGINEERING Page 13


4. SYSTEM DEVELOPMENT ENVIRONMENT

4.1 INTRODUCTION TO PYTHON


Python Programming Language is a high-level, interpreted and general-purpose
dynamic programming language that focuses on code readability. The syntax in Python helps
the programmers to do coding in fewer steps as compared to Java or C++. The language,
founded in the year 1991 by the developer Guido Van Rossum, is easy and fun to do. Python
is widely used in bigger organizations because of its multiple programming paradigms. They
usually involve imperative and object-oriented functional programming. It has a
comprehensive and large standard library that has automatic memory management and
dynamic features.

4.1.1 WHY PYTHON?


Python has topped the charts in recent years over other programming languages like C,
C++, and Java and is widely used by programmers. The language has undergone a
drastic change since its release 25 years ago as many add-on features are introduced.
Python 1.0 had the module system of Modula-3 and interacted with the Amoeba
Operating System with varied functioning tools. Python 2.0 introduced in the year 2000
had features of the garbage collector and Unicode Support. Python 3.0 introduced in the
year 2008 had a constructive design that avoids duplicate modules and constructs. With
the added features, now the companies are using Python 3.7.
The software development companies prefer Python language because of its versatile
features and fewer programming codes. Nearly 14% of the programmers use it on
operating systems like UNIX, Linux, Windows and Mac OS. The programmers of big
companies use Python as it has created a mark for itself in the software development
with characteristic features like-

● Interactive

● Interpreted

● Modular

● Dynamic

COMPUTER SCIENCE ENGINEERING Page 14


● Object-oriented

● Portable
● High level

● Extensible in C++ & C

4.1.2 ADVANTAGES OF PYTHON


The Python language has diversified applications in the software development companies
such as in gaming, web frameworks and applications, language development,
prototyping, graphic design applications, etc.
This provides the language a higher plethora over other programming languages used in
the industry. Some of its advantages are
1. Extensive Support Libraries
It provides large standard libraries that include areas like string operations, Internet, web
service tools, operating system interfaces, and protocols. Most of the highly used
programming tasks are already scripted into it that limits the
length of the codes to be written in Python.
2. Integration Feature
Python integrates the Enterprise Application Integration that makes it easy to develop
Web services by invoking COM or COBRA components. It has powerful control
capabilities as it calls directly through C, C++ or Java via Python. Python also processes
XML and other mark-up languages as it can run on all modern operating systems
through the same byte code.
3. Improved Programmer's Productivity
The language has extensive support libraries and clean object-oriented designs that
increase two to tenfold of programmer's productivity while using languages like Java,
VB, Perl, C, C++, and C#.

4. Productivity
With its strong process integration features, unit testing framework and enhanced control
capabilities contribute towards the increased speed for most applications and
productivity of applications. It is a great option for building scalable multi-protocol
network applications.

COMPUTER SCIENCE ENGINEERING Page 15


4.1.3 LIMITATIONS OF PYTHON
Python has varied advantageous features, and programmers prefer this language to other
programming languages because it is easy to learn and code too.
However, this language has still not made its place in some computing arenas that
includes Enterprise Development Shops. Therefore, this language may not solve
some of the enterprise solutions, and limitations include

1. Difficulty in Using Other Languages


Python lovers become so accustomed to its features and its extensive libraries, so they
face problems in learning or working on other programming languages. Python experts
may see the declaring of cast "values" or variable "types", syntactic requirements of
adding curly braces or semicolons as an onerous task.

2. Weak in Mobile Computing


Python has made its presence on many desktop and server platforms, but it is seen as a
weak language for mobile computing. This is the reason very few mobile applications
are built in it like Carbonnelle.

3. Gets Slow in Speed


Python executes with the help of an interpreter instead of the compiler, which causes it to
slow down because compilation and execution help it to work normally. On the other
hand, it can be seen that it is fast for many web applications too.

4. Run-time Errors
The Python language is dynamically typed so it has many design restrictions that are
reported by some Python developers.
It is even seen that it requires more testing time, and the errors show up when the
applications are finally run.

5. Underdeveloped Database Access Layers


As compared to popular technologies like JDBC and ODBC, Python's database access
layer is found to be a bit underdeveloped and primitive.

COMPUTER SCIENCE ENGINEERING Page 16


However, it cannot be applied in the enterprises that need smooth interaction of complex
legacy data.

4.2 INTRODUCTION TO DART


Dart is an open-source, general-purpose, object-oriented programming language with C-style
syntax developed by Google in 2011. The purpose of Dart programming is to create a
frontend user interface for the web and mobile apps. It is under active development, compiled
to native machine code for building mobile apps, inspired by other programming languages
such as Java, JavaScript, C#, and is Strongly Typed. Since Dart is a compiled language so
you cannot execute your code directly; instead, the compiler parses it and transfers it into
machine code.

4.3 INTRODUCTION TO FLUTTER


Flutter is an open-source mobile SDK developer can use to build native-looking Android and
iOS applications from the same code base. Flutter has been around since 2015 when Google
introduced it and remained in the beta stage before its official launch in December 2018.
Since then, the buzz around Flutter has been growing stronger.Flutter is now the top 11
software repos based on GitHub stars. Moreover, we’ve already seen thousands of Flutter
apps being published on app stores. One of the most notable examples is the Xianyu app
created by the Alibaba team, used by over 50 million people.
Flutter consists of two important parts:

● An SDK (Software Development Kit): A collection of tools that are going to help you
develop your applications. This includes tools to compile your code into native
machine code (code for iOS and Android).
● A Framework (UI Library based on widgets): A collection of reusable UI elements
(buttons, text inputs, sliders, and so on) that you can personalize for your own needs

4.3.1 WHY FLUTTER USES DART


● Dart is AOT (Ahead of Time) compiled to fast, predictable, native code, which
allows almost all of Flutter to be written in Dart. This not only makes Flutter fast,
virtually everything (including all the widgets) can be customized.

COMPUTER SCIENCE ENGINEERING Page 17


● Dart can also be JIT (Just In Time) compiled for exceptionally fast development
cycles and game-changing workflow (including Flutter’s popular sub-second
stateful hot reload).
● Dart makes it easier to create smooth animations and transitions that run at 60fps.
Dart can do object allocation and garbage collection without locks. And like
JavaScript, Dart avoids preemptive scheduling and shared memory (and thus locks).
Because Flutter apps are compiled to native code, they do not require a slow bridge
between realms (e.g., JavaScript to native). They also start up much faster.
● Dart allows Flutter to avoid the need for a separate declarative layout language like
JSX or XML, or separate visual interface builders, because Dart’s declarative,
programmatic layout is easy to read and visualize. And with all the layout in one
language and in one place, it is easy for Flutter to provide advanced tooling that
makes layout a snap.

4.3.2 CORE PRINCIPLES OF FLUTTER


Flutter includes a modern react-style framework, a 2D rendering engine, ready-made
widgets, and development tools. These components work together to help you design, build,
test, and debug apps. Everything is organized around a few core principles.

4.3.3 WIDGETS IN FLUTTER


Widgets are the basic building blocks of a Flutter app’s user interface. Each widget is an
immutable declaration of part of the user interface. Unlike other frameworks that separate
views, view controllers, layouts, and other properties, Flutter has a consistent, unified
object model: the widget.
A widget can define:
● a structural element (like a button or menu)
● a stylistic element (like a font or color scheme)
● an aspect of layout (like padding)
Widgets form a hierarchy based on composition. Each widget nests inside, and inherits
properties from, its parent. There is no separate “application” object. Instead, the root
widget serves this role.

COMPUTER SCIENCE ENGINEERING Page 18


You can respond to events, like user interaction, by telling the framework to replace a
widget in the hierarchy with another widget. The framework then compares the new and
old widgets and efficiently updates the user interface.

4.3.4 COMPOSITION > INHERITANCE


Widgets are themselves often composed of many small, single-purpose widgets that combine
to produce powerful effects. For example, Container, a commonly-used widget, is made up
of several widgets responsible for layout, painting, positioning, and sizing. Specifically,
Container is made up of LimitedBox, ConstrainedBox, Align, Padding, DecoratedBox, and
Transform widgets. Rather than subclassing Container to produce a customized effect, you
can compose these, and other, simple widgets in novel ways.The class hierarchy is shallow
and broad to maximize the possible number of combinations.

Figure 2: Composition>Inheritance

You can also control the layout of a widget by composing it with other widgets. For example,
to centre a widget, you wrap it in a Centre widget. There are widgets for padding, alignment,
row, columns, and grids. These layout widgets do not have a visual representation of their
own. Instead, their sole purpose is to control some aspect of another widget’s layout. To
understand why a widget renders in a certain way, it’s often helpful to inspect the
neighbouring widgets.

COMPUTER SCIENCE ENGINEERING Page 19


4.3.5 LAYERS IN FLUTTER
The Flutter framework is organized into a series of layers, with each layer building
upon the previous layer.

Figure 3: Flutter Framework Layer

The upper layers of the framework are used more frequently than the lower layers. For the
complete set of libraries that make up Flutter's layered framework, see API documentation.
The goal of this design is to help you do more with less code. For example, the Material
layer is built by composing basic widgets from the widgets layer, and the widgets layer
itself is built by orchestrating lower-level objects from the rendering layer.
The layers offer many options for building apps. Choose a customized approach to unlock
the full expressive power of the framework, or use building blocks from the widgets layer,
or mix and match. You can compose the ready-made widgets Flutter provides, or create
your own custom widgets using the same tools and techniques that the Flutter team used to
build the framework.
Nothing is hidden from you. You reap the productivity benefits of a high-level, unified
widget concept, without sacrificing the ability to dive as deeply as you wish into the lower
layers.

COMPUTER SCIENCE ENGINEERING Page 20


4.3.6 BUILDING WIDGETS IN FLUTTER
You define the unique characteristics of a widget by implementing a build() function that
returns a tree (or hierarchy) of widgets. This tree represents the widget’s part of the user
interface in more concrete terms. For example, a toolbar widget might have a build function
that returns a horizontal layout of some text and various buttons. The framework then
recursively asks each of these widgets to build until the process bottoms out in fully concrete
widgets, which the framework then stitches together into a tree.
A widget’s build function should be free of side effects. Whenever it is asked to build, the
widget should return a new tree of widgets regardless of what the widget previously returned.
The framework does the heavy lifting of comparing the previous build with the current build
and determining what modifications need to be made to the user interface.
This automated comparison is quite effective, enabling high-performance, interactive apps.
And the design of the build function simplifies your code by focusing on declaring what a
widget is made of, rather than the complexities of updating the user interface from one state
to another.

4.3.7 HANDLING USER INTERACTION IN FLUTTER


If the unique characteristics of a widget need to change based on user interaction or other
factors, that widget is stateful. For example, if a widget has a counter that increments
whenever the user taps a button, the value of the counter is the state for that widget. When
that value changes, the widget needs to be rebuilt to update the UI.
These widgets subclass StatefulWidget (rather than StatelessWidget) and store their mutable
state in a subclass of State.

Figure 4: Handling user interaction in Flutter

COMPUTER SCIENCE ENGINEERING Page 21


Whenever you mutate a State object (for example, by incrementing the counter), you must
call setState() to signal the framework to update the user interface by calling the State’s
build method again. For an example of managing state, see the MyApp template that’s
created with each new Flutter project. Having separate state and widget objects lets other
widgets treat stateless and stateful widgets in the same way, without being concerned about
losing state. The framework does all the work of finding and reusing existing state objects
when appropriate.

4.4 GOOGLE COLAB NOTEBOOK


Google colaboratory is a free Jupyter notebook environment that runs on Google’s cloud
servers, letting the user leverage backend hardware like GPUs and TPUs. This lets you do
everything you can in a Jupyter notebook hosted in your local machine, without requiring
the installations and setup for hosting a notebook in your local machine.
Google colab notebook is a web application that allows you to create and share documents
that contain.
● live code (e.g. Python code)
● visualization
● explanatory text (written in markdown syntax)

Google colab Notebook is great for the following use cases:

● learn and try out Python


● data processing / transformation
● numeric simulation
● statistical modelling
● machine learning

4.5 CNN ALGORITHM

COMPUTER SCIENCE ENGINEERING Page 22


In machine learning, a convolutional neural network (CNN/ConvNet) is a class of neural
networks, most commonly applied to analyze visual imagery. Now when we think of a neural
network we think about matrix multiplications but that is not the case with ConvNet. It uses a
special technique called Convolution. Now in mathematics convolution is a mathematical
operation on two functions that produces a third function that expresses how the shape of one
is modified by the other.

4.5.1 WORKING OF CNN

Convolutional neural networks are composed of multiple layers of artificial neurons.


Artificial neurons, a rough imitation of their biological counterparts, are mathematical
functions that calculate the weighted sum of multiple inputs and output an activation
value. When you input an image in a ConvNet, each layer generates several activation
functions that are passed onto the next layer.
The first layer usually extracts basic features such as horizontal or diagonal edges. This
output is passed on to the next layer which detects more complex features such as corners
or combinational edges. As we move deeper into the network it can identify even more
complex features such as objects, faces, etc

4.5.2 ARCHITECTURE OF CNN


There are two main parts to a CNN architecture
● A convolution tool that separates and identifies the various features of the image for

analysis in a process called as Feature Extraction

● A fully connected layer that utilizes the output from the convolution process and

predicts the class of the image based on the features extracted in previous stages.

COMPUTER SCIENCE ENGINEERING Page 23


Figure 5: Architecture of CNN

4.5.3 CONVOLUTION LAYERS

There are three types of layers that make up the CNN which are the convolutional layers,
pooling layers, and fully-connected (FC) layers. When these layers are stacked, a CNN
architecture will be formed. In addition to these three layers, there are two more important
parameters which are the dropout layer and the activation function which are defined below.

4.5.3.1. CONVOLUTIONAL LAYER

This layer is the first layer that is used to extract the various features from the input images.
In this layer, the mathematical operation of convolution is performed between the input
image and a filter of a particular size MxM. By sliding the filter over the input image, the dot
product is taken between the filter and the parts of the input image with respect to the size of
the filter (MxM).The output is termed as the Feature map which gives us information about
the image such as the corners and edges. Later, this feature map is fed to other layers to learn
several other features of the input image.

4.5.3.2. POOLING LAYER

COMPUTER SCIENCE ENGINEERING Page 24


In most cases, a Convolutional Layer is followed by a Pooling Layer. The primary aim of this
layer is to decrease the size of the convolved feature map to reduce the computational costs.
This is performed by decreasing the connections between layers and independently operates
on each feature map. Depending upon the method used, there are several types of Pooling
operations.

In Max Pooling, the largest element is taken from the feature map. Average Pooling
calculates the average of the elements in a predefined size Image section. The total sum of the
elements in the predefined section is computed in Sum Pooling. The Pooling Layer usually
serves as a bridge between the Convolutional Layer and the FC Layer

4.5.3.3. FULLY CONNECTED LAYER

The Fully Connected (FC) layer consists of the weights and biases along with the neurons
and is used to connect the neurons between two different layers. These layers are usually
placed before the output layer and form the last few layers of a CNN Architecture.

In this, the input image from the previous layers are flattened and fed to the FC layer. The
flattened vector then undergoes few more FC layers where the mathematical functions
operations usually take place. In this stage, the classification process begins to take place.

4.5.3.4. DROPOUT

Usually, when all the features are connected to the FC layer, it can cause overfitting in the
training dataset. Overfitting occurs when a particular model works so well on the training
data causing a negative impact in the model’s performance when used on new data.

To overcome this problem, a dropout layer is utilised wherein a few neurons are dropped
from the neural network during training process resulting in reduced size of the model. On
passing a dropout of 0.3, 30% of the nodes are dropped out randomly from the neural
network.

COMPUTER SCIENCE ENGINEERING Page 25


4.5.3.5. ACTIVATION FUNCTIONS

Finally, one of the most important parameters of the CNN model is the activation function.

They are used to learn and approximate any kind of continuous and complex relationship

between variables of the network. In simple words, it decides which information of the model

should fire in the forward direction and which ones should not at the end of the network.

It adds non-linearity to the network. There are several commonly used activation functions

such as the ReLU, Softmax, TanH and the Sigmoid functions. Each of these functions have a

specific usage. For a binary classification CNN model, sigmoid and softmax functions are

preferred and for a multi-class classification, generally softmax is used.

4.6 MOBILENET

MobileNet is a CNN architecture model for Image Classification and Mobile Vision.There

are other models as well but what makes MobileNet special that it very less computation

power to run or apply transfer learning to.This makes it a perfect fit for Mobile

devices,embedded systems and computers without GPU or low computational efficiency with

compromising significantly with the accuracy of the results.It is also best suited for web

browsers as browsers have limitation over computation,graphic processing and storage.

4.6.1 MOBILENET ARCHITECTURE

● MobileNets for mobile and embedded vision applications is proposed, which are
based on a streamlined architecture that uses depth wise separable convolutions to
build light weight deep neural network

COMPUTER SCIENCE ENGINEERING Page 26


● Two simple global hyper-parameters that efficiently trade off between latency and
accuracy are introduced.

The core layer of MobileNet is depthwise separable filters, named as Depthwise


Separable Convolution. The network structure is another factor to boost the
performance. Finally, the width and resolution can be tuned to trade off between
latency and accuracy.

COMPUTER SCIENCE ENGINEERING Page 27


CHAPTER-5
SOFTWARE DESIGN

COMPUTER SCIENCE ENGINEERING Page 28


5. SOFTWARE DESIGN

5.1. INTRODUCTION TO UML DIAGRAMS:


The Unified Modelling Language (UML) is a standard language for writing software
blueprints. The UML is used to visualize, specify, construct and document the artifacts of a
software intensive system. The UML is a language and also is just one part of a software
development method. To design and construct the UML we have to encompass three kinds of
building blocks.

5.1.1. THINGS:
These are the abstractions that are first class citizens in a model. These are four kinds
of things mostly used in UML:
● Structural Things
● Behavioural Things
● Grouping Things
● Annotational Things

5.1.1.1. STRUCTURAL THINGS


The structural things define the static part of the model. They represent physical and
conceptual elements. Following are the brief descriptions of the structural things.
● Class
Class represents a set of objects having similar responsibilities. A class implements
one or more interfaces. Graphically, a class is rendered as a rectangle, usually including its
name, attributes, and operations.

Class_Name

Attributes

Operations

COMPUTER SCIENCE ENGINEERING Page 29


● Interface
Interface defines a set of operations which specify the responsibility of a class. An
interface therefore describes the externally visible behaviour of that element. An
interface might represent the complete behaviour of a class or component or only a
part of that behaviour. An interface is rendered as a small circle attached to the class
box by a line.

Interface

● Collaboration
Collaboration defines interaction between elements. Collaborations have structural, as
well as behavioural, dimensions. Collaboration is rendered as an ellipse with dashed
lines, sometimes including only its name.

Chain of responsibility

● Use case
Use case represents a set of actions performed by a system for a specific goal.
Graphically, a use case is rendered as an ellipse with solid lines, usually including
only its name.

Place order

● Active Class
An active class is a class whose objects own one or more processes or threads and
therefore can initiate control activity. It is just like a class except that its objects
represent elements whose behaviour is concurrent with other elements.
Class_Name

COMPUTER SCIENCE ENGINEERING Page 30


Operations

● Component
Component describes the physical part of a system. Graphically, a component is
rendered like a class with a special icon in the upper right corner.

Orderform.java

● Node
A node can be defined as a physical element that exists at run time. Graphically, a
node is rendered as a cube.

5.1.1.2. BEHAVIOURAL THINGS


A behavioural thing consists of the dynamic parts of UML models. Following are the
behavioural things:

● Interaction
Interaction is defined as a behaviour that consists of a group of messages exchanged
among elements to accomplish a specific task. Graphically, a message is rendered as a
directed line.
Message

● State machine
State machine is useful when the state of an object in its life cycle is important. It
defines the sequence of states an object goes through in response to events. Events are
external factors responsible for state change.

COMPUTER SCIENCE ENGINEERING Page 31


State

5.1.1.3. GROUPING THINGS


Grouping things can be defined as a mechanism to group elements of a UML model
together. There is only one grouping thing available.
● Package
Package is the only one grouping thing available for gathering structural and
behavioural things. Packages are the basic grouping things with which you may
organize a UML model.

Package

5.1.1.4. ANNOTATIONAL THINGS


Annotational things can be defined as a mechanism to capture remarks, descriptions, and
comments of UML model elements. Note is the only one Annotational thing available.
● Note
A note is used to render comments, constraints etc., of an UML element. Graphically,
a note is rendered as a rectangle with a dog-eared corner, together with a textual or
graphical comment.

5.2. UML DIAGRAMS


5.2.1. USE CASE DIAGRAM
A use case diagram is ― “a diagram that shows the relationship among actors and use
cases within a system”.
Use case diagrams are often used to:
● Provide an overview of all or part of the usage requirements for a system or
organization in the form of an essential model or a business model.
● Communicate the scope of a development project.

COMPUTER SCIENCE ENGINEERING Page 32


Figure 6: Use Case Diagram

5.2.2. SEQUENCE DIAGRAM


● A sequence diagram shows, as parallel vertical lines (lifelines), different processes or
objects that live simultaneously, and, as horizontal arrows, the messages exchanged
between them, in the order in which they occur.
● This allows the specification of simple runtime scenarios in a graphical manner.
● Sequence Diagrams commonly contain the following things: Object, Link, Messages,
and Lifeline.

Figure 7: Sequence Diagram

COMPUTER SCIENCE ENGINEERING Page 33


5.2.3 ACTIVITY DIAGRAM
Activity diagram is another important diagram in UML to describe dynamic aspects
of the system. Activity diagram is basically a flowchart to represent the flow from one
activity to another activity. The activity can be described as an operation of the system. So
the control flow is drawn from one operation to another. This flow can be sequential,
branched or concurrent. Activity diagrams deal with all types of flow control by using
different elements like fork, join etc. It captures the dynamic behavior of the system. Activity
diagrams are not only used for visualizing the dynamic nature of a system but they are also
used to construct the executable system by using forward and reverse engineering techniques.
The only missing thing in the activity diagram is the message part.
● Activity diagrams are graphical representations of workflows of stepwise activities
and actions with support for choice, iteration and concurrency.
● In the unified Modelling Language, activity diagrams can be used to describe the
business and operational step-by-step workflows of components in a system.
● An activity diagram shows the overall flow of control.
● Activity is a particular operation of the system.
● It shows different flows like parallel, branched, concurrent and single.
The main element of an activity diagram is the activity itself. An activity is a function
performed by the system. So before drawing an activity diagram we should identify the
following elements:
● Activities
● Association
● Conditions
● Constraints
Once the above mentioned parameters are identified we need to make a mental layout
of the entire flow. This mental layout is then transformed into an activity diagram.

COMPUTER SCIENCE ENGINEERING Page 34


Figure 8: Activity Diagram

COMPUTER SCIENCE ENGINEERING Page 35


CHAPTER-6

MODULES

COMPUTER SCIENCE ENGINEERING Page 36


6. MODULES

6.1 OS MODULE:

The OS module in Python provides functions for interacting with the operating system. OS
comes under Python’s standard utility modules. This module provides a portable way of
using operating system dependent functionality. The *os* and *os.path* modules include
many functions to interact with the file system.

6.2 TENSORFLOW MODULE:

TensorFlow is a software library or framework, designed by the Google team to


implement machine learning and deep learning concepts in the easiest manner. It
combines the computational algebra of optimization techniques for easy calculation of
many mathematical expressions.
Features of TensorFlow:-
● It includes a feature that defines, optimizes and calculates mathematical
expressions easily with the help of multi-dimensional arrays called tensors.
● It includes programming support of deep neural networks and machine learning
techniques.
● It includes a highly scalable feature of computation with various data sets.
● TensorFlow uses GPU computing, automating management. It also includes a
unique feature of optimization of the same memory and the data used.

6.3 KERAS MODULE:

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

COMPUTER SCIENCE ENGINEERING Page 37


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.

COMPUTER SCIENCE ENGINEERING Page 38


CHAPTER-7

CODING

COMPUTER SCIENCE ENGINEERING Page 39


7. CODING

7.1. MACHINE LEARNING MODEL CODE


#Importing libraries

!pip install tf-nightly-gpu-2.0-preview

!pip install 'tensorflow-hub == 0.4'

from __future__ import absolute_import, division, print_function, unicode_literals

import tensorflow as tf

#tf.logging.set_verbosity(tf.logging.ERROR)

#tf.enable_eager_execution()

import tensorflow_hub as hub

import os

from tensorflow.keras.layers import Dense, Flatten, Conv2D

from tensorflow.keras import Model

from tensorflow.keras.preprocessing.image import ImageDataGenerator

from tensorflow.keras.optimizers import Adam

from tensorflow.keras import layers

#from keras import optimizers

#Mounting Drive to Colab

from google.colab import drive

drive.mount('/content/drive')

#Linking kaggle to colab

COMPUTER SCIENCE ENGINEERING Page 40


! pip install -q kaggle

from google.colab import files

files.upload()

! mkdir ~/.kaggle

! cp kaggle.json ~/.kaggle/

! chmod 600 ~/.kaggle/kaggle.json

#Load data

! kaggle datasets download -d kalpeshkhandelwal/plantvillagek

file_folder="/content/plantvillagek.zip"

zip_file = !unzip "$file_folder"

#Prepare Training and Validation Dataset

train_dir = "/content/PlantVillage/train/"

validation_dir = "/content/PlantVillage/val/"

import time

import os

from os.path import exists

def count(dir, counter=0):

"returns number of files in dir and subdirs"

for pack in os.walk(dir):

for f in pack[2]:

counter += 1

return dir + " : " + str(counter) + "files"

print('total images for training :', count(train_dir))

print('total images for validation :', count(validation_dir))

COMPUTER SCIENCE ENGINEERING Page 41


#labelling classes

classes = ['Apple___Apple_scab', 'Apple___Black_rot', 'Apple___Cedar_apple_rust',


'Apple___healthy', 'Blueberry___healthy', 'Cherry_(including_sour)___Powdery_mildew',
'Cherry_(including_sour)___healthy', 'Corn_(maize)___Cercospora_leaf_spot
Gray_leaf_spot', 'Corn_(maize)___Common_rust_', 'Corn_(maize)___Northern_Leaf_Blight',
'Corn_(maize)___healthy', 'Grape___Black_rot', 'Grape___Esca_(Black_Measles)',
'Grape___Leaf_blight_(Isariopsis_Leaf_Spot)', 'Grape___healthy',
'Orange___Haunglongbing_(Citrus_greening)', 'Peach___Bacterial_spot', 'Peach___healthy',
'Pepper,_bell___Bacterial_spot', 'Pepper,_bell___healthy', 'Potato___Early_blight',
'Potato___Late_blight', 'Potato___healthy', 'Raspberry___healthy', 'Soybean___healthy',
'Squash___Powdery_mildew', 'Strawberry___Leaf_scorch', 'Strawberry___healthy',
'Tomato___Bacterial_spot', 'Tomato___Early_blight', 'Tomato___Late_blight',
'Tomato___Leaf_Mold', 'Tomato___Septoria_leaf_spot', 'Tomato___Spider_mites Two-
spotted_spider_mite', 'Tomato___Target_Spot',
'Tomato___Tomato_Yellow_Leaf_Curl_Virus', 'Tomato___Tomato_mosaic_virus',
'Tomato___healthy']

#Data Preprocessing

IMAGE_SHAPE = (224, 224)

BATCH_SIZE = 64

validation_datagen = tf.keras.preprocessing.image.ImageDataGenerator(rescale=1./255)

validation_generator = validation_datagen.flow_from_directory(

validation_dir,

shuffle=False,

seed=42,

color_mode="rgb",

class_mode="categorical",

target_size=IMAGE_SHAPE,

batch_size=BATCH_SIZE)

COMPUTER SCIENCE ENGINEERING Page 42


do_data_augmentation = True

if do_data_augmentation:

train_datagen = tf.keras.preprocessing.image.ImageDataGenerator(

rescale = 1./255,

rotation_range=40,

horizontal_flip=True,

width_shift_range=0.2,

height_shift_range=0.2,

shear_range=0.2,

zoom_range=0.2,

fill_mode='nearest' )

else:

train_datagen = validation_datagen

train_generator = train_datagen.flow_from_directory(

train_dir,

subset="training",

shuffle=True,

seed=42,

color_mode="rgb",

class_mode="categorical",

target_size=IMAGE_SHAPE,

batch_size=BATCH_SIZE)

COMPUTER SCIENCE ENGINEERING Page 43


#Building the Model

model = tf.keras.Sequential([

hub.KerasLayer("https://tfhub.dev/google/tf2-preview/mobilenet_v2/feature_vector/4",

output_shape=[1280],trainable=False),

tf.keras.layers.Dropout(0.4),

tf.keras.layers.Dense(512, activation='relu'),

tf.keras.layers.Dropout(rate=0.2),

tf.keras.layers.Dense(train_generator.num_classes, activation='softmax')

])

#Specifying Loss Function and optimizer

EPOCHS=20

history = model.fit_generator(

train_generator,

steps_per_epoch=train_generator.samples//train_generator.batch_size,

epochs=EPOCHS,

validation_data=validation_generator,

validation_steps=validation_generator.samples//validation_generator.batch_size)

#Getting weights and Converting into Tflite

model.save('weights.h5')

model.save(filepath="/content/weights.h5")

new_model= tf.keras.models.load_model(filepath="/content/weights.h5")

model.load("/content/weights.h5")

COMPUTER SCIENCE ENGINEERING Page 44


tensorflow_graph = tf.saved_model.load("my_model")

x = np.random.uniform(size=(4, 32)).astype(np.float32)

predicted = tensorflow_graph(x).numpy()

model.save(KERAS_MODEL_NAME)

tf_lite_converter = tf.lite.TFLiteConverter.from_keras_model(KERAS_MODEL_NAME)

tflite_model = tf_lite_converter.convert()

7.2 ANDROID APPLICATION CODE

Main.dart:

Home.dart:

COMPUTER SCIENCE ENGINEERING Page 45


COMPUTER SCIENCE ENGINEERING Page 46
COMPUTER SCIENCE ENGINEERING Page 47
COMPUTER SCIENCE ENGINEERING Page 48
Splash Screen.dart:

COMPUTER SCIENCE ENGINEERING Page 49


CHAPTER-8

TESTING

COMPUTER SCIENCE ENGINEERING Page 50


8. TESTING

8.1. TESTING
Software testing is a critical element of software quality assurance and represents the
ultimate service of specification design and coding. The increasing visibility of software as a
system element and the attended costs associated with the software failure and motivating
forces for well planned, through testing. It is not unusual for a software developer to spend
between 30 and 40 percent of total project effort in testing.
System Testing Strategies for this system integrate test case design techniques into a
well-planned series of steps that result in the successful construction of this software. It also
provides a road map for the developer, the quality assurance organization and the customer, a
roadmap that describes the steps to be conducted as a path of testing, when these steps are
planned and then undertaken and how much effort, time and resources will be required. The
test provisions are as follows.

8.1.1. TESTING OBJECTIVES


The following are the testing objectives -
● Testing is a process of executing a program with the intent of finding an error.
● A good test case is one that has a high probability of finding an as yet undiscovered
error.
● A successful test is one that uncovers a yet undiscovered error.
The above objectives imply a dramatic change in view point. They move counter to
the commonly held view that a successful test is one in which no errors are found. Our
objective is to design tests that systematically different clauses of errors and do so with a
minimum amount of time and effort.

8.1.2. TESTING PRINCIPLES


Before applying methods to design effective test cases, a software engineer must
understand the basic principles that guide software testing.
● All tests should be traceable to customer requirements.
● Tests should be planned long before testing begins.

COMPUTER SCIENCE ENGINEERING Page 51


● Testing should begin "in the small" and progress towards testing "in the large".
● Exhaustive testing is not possible.

8.2. TEST PLAN


A test plan is a document that contains a complete set of test cases for a system, along
with other information about the testing process. The test plan should be returned long before
the testing starts.
Test plan identifies
● A task set to be applied as testing commences ,
● The work products to be produced as each testing task is executed
● The manner in which the results of testing are evaluated, recorded and reused when
regression testing is conducted.
In some cases the test plan is indicated with the project plan. In others the test plan is
a separate document.

8.3. TESTING STRATEGIES


A strategy for software testing indicates software test case design methods into a well-
planned series of steps that results in the successful construction of software. The strategy
provides a road map that describes the steps to be conducted as part of testing, when these
steps are planned and then undertaken, and how much effort, time and resources will be
required. It must be rigid enough to promote reasonable planning and management tracking
as the project progresses.
The strategies for testing are envisioned by the following methods – A number of
software testing strategies have been proposed. All provide the software developer with a
template for testing and all the following generic characteristics.
● To perform effective testing, a software team should conduct effective formal
technical reviews. By doing this, many errors will be eliminated before testing
commences.
● Testing begins at the component level and works ―outward‖ toward the integration of
entire computer based system.
● Different testing techniques are appropriate at different points in time.
● Testing is conducted by the developer of the software and an independent test group.

COMPUTER SCIENCE ENGINEERING Page 52


● Testing and debugging are different activities, but debugging must be accommodated
in any testing strategy.

8.3.1. TYPES OF TESTING


The primary objective of test case design is to derive a set of tests that have the
highest likelihood for uncovering errors in the software. To accomplish this objective two
different categories of test case design techniques are used.

8.3.1.1. WHITE-BOX TESTING


White box testing, sometimes-called glass box testing is a test case design that focuses
on the program control structure. Test cases are derived to ensure that
1. Guarantee that all independent paths within a module have been exercised at least
once.
2. Exercise all logical design on their true and false sides
3. Executes all loops at their boundaries and within their operational boundaries.
4. Exercise internal data structure to ensure their validity.
Several methods are used in the white box testing
● Statement Coverage In this each statement in a program is executed at least once.
This is done by checking the program in debug mode and verifying each statement.
● Branch Coverage In this each and every branch cases are tested whether the different
branch conditions are true or false. It is a strong test criterion over statement coverage
testing.
● Condition Coverage Condition testing is a test case design method that exercises
logical conditions contained in a program module. The purpose of condition testing is
to detect not only errors in the condition of a program but also other errors in the
program.
● Path Coverage In this testing all the linearly independent paths in a program are
executed once.
● Cyclomatic Complexity Software metric provides a quantitative measure of a
program. The Mc Cabe‘s Cyclomatic complexity of a program defines the number of
independent paths in a program.

COMPUTER SCIENCE ENGINEERING Page 53


8.3.1.2. BLACK BOX TESTING
Tests can be conducted at software interface by knowing the specified function that a
product has been designed to perform, tests can be conducted that demonstrate each function
is fully operational, at the same time searching for errors in what is called black box testing,
sometimes called behavioural testing.
Black box testing is not an alternative to white box techniques. Rather a
complementary approach is likely to uncover a different class of errors than white box
methods. Black box tests are designed to uncover errors in functional requirements without
regard to the internal workings of a program. Black box testing techniques focus on the
information domain of the software.
Black box testing attempts to find errors in the following categories –
a) Incorrect or missing functions.
b) Interface errors
c) Errors in the data structures or external database access
d) Performance errors
e) Initialization and termination errors

8.3.1.3. INTEGRATION TESTING


Integration testing is a systematic technique for constructing the program structure
and to conduct tests for uncovered errors with interfacing. In this system, Top-Down
integration is performed for the construction of program structures.

8.3.1.4. SYSTEM TESTING


System tests are designed to validate a fully developed system with a view to assuming
that it meets its requirements. There are three kinds of system testing:
1. Alpha Testing Alpha testing refers to the system testing that is carried by the
customer within the organization along with the developer. The alpha tests are
conducted in a controlled manner.
2. Beta Testing Beta testing is the system performed by a selected group of customers,
the developer is not present at the site and the user will inform the problems that are
encountered during testing. The software developer makes the necessary changes and
submits to the customer.

COMPUTER SCIENCE ENGINEERING Page 54


3. Acceptance Testing Acceptance testing is the system testing performed by the
customer to whether or not to accept the delivery of the system.

8.3.1.5. VALIDATION TESTING


This testing is performed to ensure that the system functions in a manner that can be
reasonably seen by the users.
Here input data is validated first at interface (authentication), before sending it to the
server. In this system, for example user ID and password is checked whether the user is an
authorized user or not to ensure authentication in each module.
By this testing, we can ensure that all functional requirements are satisfied, and all
performance requirements are achieved.

8.4. TEST CASE DESIGN


Test case is an explicit set of instructions designed to detect a particular class of
defect in a software system, by bringing about a failure. A test case can give rise to many
tests. Each test is a particular run of the test case on a particular version of the system.

8.4.1. INFORMATION TO INCLUDE IN A FORMAL TEST CASE


Each test case should have the following information.

8.4.2. IDENTIFICATION AND CLASSIFICATION


Each test case should have a number, and may be given a descriptive title that
indicates its purpose. The system, subsystem or module being tested should also be clearly
indicated, with a reference to the related requirements and design documents.

8.4.3. INSTRUCTIONS
These tell the tester exactly what to do. The instructions must tell the tester how to put
the system into the required initial state and what inputs to provide.

COMPUTER SCIENCE ENGINEERING Page 55


8.4.4. EXPECTED RESULT
This tells the tester how the system should behave in response to the instructions i.e.
what it should output and what state it should then be in. The tester reports the failure if
he/she does not encounter the expected result.

8.4.5. LEVELS OF IMPORTANCE OF TEST CASE


It is a good idea to classify the test cases according to their importance, or severity
level. The most important test cases are executed first, and are designed to detect the most
severe classes of defect. A typical scheme for levels of importance is:
● Level 1 First, pass critical test cases- These are designed to verify that the system runs
and is safe. Any level 1 failure normally means that no further testing is possible.
● Level 2 General Test cases- These verify that the system performs its day-to-day
functions correctly and is therefore a ‗success‘. A level two failure, while important
to fix, may still permit testing of other aspects of the testing to continue in the
meantime.
● Level 3 Detailed Test Cases- These test requirements are of lesser importance. If
desired, level 3 test cases can also be used to provide some redundancy. If there are
many failures of level 3 test cases the system can probably be used, but is lacking in
overall quality.

8.5. CLASS TESTING


In object oriented programs control flow switches from one object to another by inter-
object communication and state of the object displays an important role in invocation of
methods. Hence testing technique is to test all the methods of a class, one by one, against the
set of states that the object can take, also termed as state-based testing. State-based testing is a
technique to test whether or not the methods of a class interact correctly among themselves
by monitoring the data members of the class. Steps to be followed for test case design
1. Each test case should be uniquely identified and explicitly associated with the class to
be tested.
2. The purpose of the test should be stated.
3. A list of steps should be developed for each test and should contain

COMPUTER SCIENCE ENGINEERING Page 56


● A list of specified states for the object that is to be tested.
● A list of messages and operations that will be exercised because of the test.
● A list of exceptions that may occur as the object is tested.
● A list of external conditions.
4. Supplementary information that will aid in understanding or implementing tests.

COMPUTER SCIENCE ENGINEERING Page 57


CHAPTER-9

OUTPUT SCREENS

COMPUTER SCIENCE ENGINEERING Page 58


9. OUTPUT SCREENS

9.1. SPLASH SCREEN:


After Opening our Application we will get a screen as shown in the below figure.

Figure 9: Splash Screen

COMPUTER SCIENCE ENGINEERING Page 59


9.2.HOME PAGE:
After Splash screen the Home page will be displayed as shown in the below figure
below

Figure 10: Home page

COMPUTER SCIENCE ENGINEERING Page 60


9.3. OUTPUT PAGE:
After selecting (Figure 9.1.1) capturing a photo we will be redirected to a mobile
camera and input image will be taken (Figure 9.2.1)We can select from our gallery of mobile
phones too. The output(Predicted disease) will displayed as shown in the below figure

Figure 11: Output page

COMPUTER SCIENCE ENGINEERING Page 61


CHAPTER 10

CONCLUSION

COMPUTER SCIENCE ENGINEERING Page 62


10. CONCLUSION

This project proposes an Android Application which is embedded with a machine learning
model helpful in detecting the plant's diseases. This project was made for the benefit of
farmers .. We used Dart, python,tensorflow, keras and CNN to detect diseases of some plants.
The model is tested with real time images and gives a good accuracy above 80%.This
specific model could be used as a use case for edge analytics. Furthermore, the proposed
method achieves state-of-the-art results on a plant disease detection dataset. By the
development of plant disease detection we can detect diseases in the earlier stage and reduce
the crop damage.This project has a good future scope in helping the farmers and improves
cost reduction for farmers. This is a socio beneficiary project

COMPUTER SCIENCE ENGINEERING Page 63


CHAPTER 11

REFERENCES

COMPUTER SCIENCE ENGINEERING Page 64


11.REFERENCES

1. Sachin D. Khirade, A.B. Patil, “Plant Disease Detection Using Image Processing”
IEEE, International Conference on Computing Communication Control and
Automation Feb 2015.

2. Gittaly Dhingra, Vinay Kumar, Hem Dutt Joshi ,“Study of digital image processing
techniques for leaf disease detection and classification,” Springer-Science, 29
November 2017

3. Dr.K.Thangadurai, K.Padmavathi, “Computer Vision Image Enhancement For Plant


Leaves Disease Detection”, 2014 World Congress on Computing and Communication
Technologies.

4. Aakanksha Rastogi, Ritika Arora and Shanu Sharma, "Leaf disease detection and
grading using computer vision technology & fuzzy logic", 2015 2nd International
Conference on Signal Processing and Integrated Networks(SPIN) 2015.

5. Santosh Kumar.S, B.K.Raghavendra, “Diseases Detection of Various Plant Leaf


Using Image Processing Techniques”,IEEE,2019 5th International Conference on
Advanced Computing & Communication Systems (ICACCS)

6. Anil A.Bharate and M.S. Shirdhonkar, “Plant Disease Detection using image
processing”, 2017 International Conference on Intelligent Sustainable
Systems(ICISS),2017

7. M. Abadi et al.. "TensorFlow: A System for Large-Scale Machine Learning


TensorFlow. A system for large-scale machine learning". 12th USENIX Symposium
on Operating Systems Design and Implementation (OSDF16), 2016.

8. A. Krizhevsky. I. Sutskever. G. E. Hinton. "Imagenet classification with deep


convolutional neural networks". Proc. Adv. Neural Inf. Process,2012.

9. C. Szegedy et al., "Going deeper with convolutions, 2015 IEEE Conference on


Computer Vision and Pattern Recognition (CVPR), Boston, MA, 2015.

COMPUTER SCIENCE ENGINEERING Page 65

You might also like