0% found this document useful (0 votes)
7 views53 pages

Intenship Final Report 1

The document is an internship training report submitted by Varshank H N for a 30-day program at Contriver, Mysore, focusing on web development. It includes a training certificate, acknowledgment of guidance received, a resume detailing academic qualifications and skills, and takeaway topics from the training covering HTML, CSS, and JavaScript. The report highlights the learning experience and professional development gained during the internship.

Uploaded by

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

Intenship Final Report 1

The document is an internship training report submitted by Varshank H N for a 30-day program at Contriver, Mysore, focusing on web development. It includes a training certificate, acknowledgment of guidance received, a resume detailing academic qualifications and skills, and takeaway topics from the training covering HTML, CSS, and JavaScript. The report highlights the learning experience and professional development gained during the internship.

Uploaded by

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

CONTRIVER®, Mysore

Department of Product designing and development

INTERNSHIP TRAINING REPORT


Submitted in partial fulfilment of the requirements for the certification of
30 days internship training program

SUBMITTED BY

VARSHANK H N
(U01IV21S0003)

Under the Guidance of


Ms. AFREEN ALAM

Department of Product designing and development

M/S CONTRIVER®
Contriver Recruitment Office. ( Mysore )
Building, 609,1st floor, Sinchana clinic, panchamantra Rd,
KuvempuNagara, Mysore, Karnataka 570023
2023 - 2024
CONTRIVER®
Contriver Recruitment Office. ( Mysore )
Building, 609,1st floor, Sinchana clinic, panchamantra Rd,
KuvempuNagara, Mysore, Karnataka 570023
Department of Product designing and development

TRAINING CERTIFICATE

This is to certify that Mr. VARSHANK H N(U01IV21S0003) Bonafide students of


Cauvery Degree College, Mandya in partial fulfillment for the award of “Training
Certificate” in Department of Web development of the CONTRIVER, Mysore during
the year 2023-2024. It is certified that he/she has undergone internship during the time
period from 16/08/2023 to 30/09/2023 of all working days corrections/suggestions
indicated for internal validation have been incorporated in the report deposited to the
guide and trainer. The training report has been approved as it satisfies the
organizational requirements in respect of Internship training prescribed for the said
qualification.

Ms. Afreen Alam Shri. SANJAY B


Bachelor of Computer science DMT, B.E.
and engineering Sr. Production Head and
Supervisor of Web Chief Executive Officer
Development
Guide
ACKNOWLEDGEMENT

The internship opportunity I had with Contriver was a great chance for learning and
professional development. Therefore, I consider myself as a very lucky individual as I was
provided with an opportunity to be a part of it. I am also grateful for having a chance to meet
so many wonderful people and professionals who led me though this internship period.

I express my deepest thanks to Shri. Sanjay B, Sr. Production Head and CEO for taking
part in useful decision & giving necessary advices and guidance and arranged all facilities to
make life easier. I choose this moment to acknowledge his contribution gratefully.

It is my radiant sentiment to place on record my best regards, deepest sense of gratitude


to Ms. Afreen Alam for their careful and precious guidance which were extremely valuable for
my study both theoretically and practically.

I perceive as this opportunity as a big milestone in my career development. I will strive


to use gained skills and knowledge in the best possible way, and I will continue to work on their
improvement, in order to attain desired career objectives. Hope to continue cooperation with all
of you in the future.

Date: VARSHANK H N
Place: Mysore
RESUME

VARSHANK H N
BACHELOR OF COMPUTER APPLICATION

CONTACT INFORMATION
ADDRESS:
S/O Ninganna
#32 2nd cross , marigidi Road,
Hoshahalli, Mandya 571401
EMAILID:[email protected]
CONTACT NO: +91 6364373957

OBJECTIVE
To take up a challenging job in my professional career and to do work in the area of
a high knowledge environment and develop good human relations and thus make myself
an asset to the company

ACADEMIC INFORMATION

EDUCATION QUALIFICATIONS:

COURSE/EXAM INSTITUTION YEAR OF PASSING MARKS OBTAINED


IN %

10th Adarsha High 2019 73.92


School, Mandya

PUC MDRS college, 2021 74.83


S hoskote,Mysuru

BACHELOR OF Cauvery Degree 2024 8.73CGPA


COMPUTER College,Mandya
APPLICATION

TRAINING /INTERNSHIP:

INTERNSHIP ML Using Python and Web Development


COMPUTER SKILLS
 Programming languages : C, C++, JAVA , PYTHON
 Web Programming languages : HTML,CSS,PHP
 Database Knowledge : SQL

PROJECT DETAILS
DEGREE PROJECT: RICE CROP DISEASE IDENTIFICATION

Abstract: Crop diseases pose a significant threat to global food security by causing substantial
yield losses. Traditional methods of disease detection are often time-consuming and require
expert knowledge, leading to delays in response and potential spread of diseases.

PERSONAL STRENGTH
 Hardworking, creative, problem solver, self-confident, positive, good team-work, leadership
skills. 

PERSONAL PROFILE
Name : VARSHANK H N

Father’s name : NINGANNA

DOB : 04 - 01 - 2004

Marital Status : Single

Nationality : Indian

Languages Known : Kannada , English

Personal address : S/O Ninganna ,#32, 2nd cross , Marigudi Road,


Hoshahalli, Mandya 571401

DECLARATION
I hereby declare that all the information’s are correct and true to the best of my knowledge and
belief.

DATE: Yours Sincerely,


Place: Mysuru (VARSHANK H N)
TAKEAWAY TOPICS FROM TRAINING

WEB DEVELOPMENT

INTRODUCTION TO HTML

HTML stands for Hyper Text Markup Language. It is used to design web pages using
markup language. HTML, is the combination of Hypertext and Markup language.
Hypertext defines the link between the web pages. HTML5 comes with a lot of flexibility
and it supports the following features-

 Uppercase tag names.

 Quotes are optional for attributes.

 Attribute values are optional.

 Closing empty elements are optional

ELEMENTS AND ATTRIBUTES WITH INTERNAL CSS

Cascading Style Sheets (CSS) is used to format the layout of a webpage. With CSS, you
can control the color, font, and the size of text, the spacing between elements, how elements
are positioned and laid out what background images or background colors are to be used,
different displays for different devices and screen sizes, and much more!

<!DOCTYPE html>
<html>
<head
<title>Page Title<title>
</head>
<body>
<h1>My First Heading</h1>
<p>My first paragraph</p>
</body>
</html
BASIC TAGS

HTML Headings

 HTML headings are defined with the <h1> to <h6> tags.

HTML Paragraphs: HTML paragraphs are defined with the <p> tag.
HTML Images

 HTML images are defined with the <img> tag.

 The source file (src), alternative text (alt), width, and height are provided as attributes.

HTML Attributes
 All HTML elements can have attributes.
 Attributes usually come in name/value pairs like: name="value".

Href Attribute
The <a> tag defines a hyperlink. The href attribute specifies the URL of the page the link
goes to another page.

Src Attribute
The <img> tag is used to embed an image in an HTML page. The src attribute specifies the path
to the image to be displayed.

There are two ways to specify the URL in the src attribute:

 Absolute URL - Links to an external image that is hosted on another website.

 Relative URL - Links to an image that is hosted within the website. Here, the URL does not
include the domain name. If the URL begins without a slash, it will be relative to the current
page.

INTRODUCTION OF CSS

Cascading Style Sheets (CSS) handles the look and feel part of a web page. Using CSS, you can control
the color of the text, the style of fonts, the spacing between paragraphs, how columns are sized and laid
out, what background images or colors are used, as well as a variety of other effects. CSS is combined
with the markup languages HTML or XHTML.

CSS Selectors

CSS selectors are used to "find" (or select) the HTML elements you want to style.

id Selector

 The id selector uses the id attribute of an HTML element to select a specific element.
 To select an element with a specific id, write a hash (#) character, followed by the id of the
element.

Class Selector

 The class selector selects HTML elements with a specific class attribute.

 To select elements with a specific class, write a period (.) character, followed by the class name.

CSS Universal Selector

 The universal selector (*) selects all HTML elements on the page.

CSS Color:
 In CSS, a color can be specified by using a predefined color name.

 Background Color: You can set the background color for HTML
elements.

 Text Color: You can set the color of text.


 Border Color: You can set the color of borders.

 Color Values: In CSS, colors can also be specified using RGB values, HEX values, HSL values,
RGBAvalues, and HSLA values.

CSS Backgrounds

 The CSS background properties are used to add background effects for elements.

 Background-color: The background-color property specifies the background color of an element.


 Opacity: The opacity property specifies the opacity/transparency of an element. It can take a value from
 - 1.0. The lower value, the more transparent.

 Background-image: The background-image property specifies an image to use as the background of


an element. By default, the image is repeated so it covers the entire element.

 Background-position: The background-position property is used to specify the position of


the background image.

CSS MARGIN
 The CSS margin properties are used to create space around elements, outside of any defined borders.
 CSS has properties for specifying the margin for each side of an element:
 margin-top
 margin-right
 margin-bottom
 margin-left
CSS BRODER STYLE

The CSS border properties allow you to specify the style, width, and color of an element's border.
The following values are allowed:
 dotted - Defines a dotted border
 dashed - Defines a dashed border
 solid - Defines a solid border
 double - Defines a double border
 groove - Defines a 3D grooved border. The effect depends on the border-color value
 hidden - Defines a hidden border.

POSITION IN CSS
The position property specifies the type of positioning method used for an element
There are five different position values:

Static: Static positioned elements are not affected by the top, bottom, left, and right properties.
Relative: An element with position: relative; is positioned relative to its normal position.
Absolute: An element with position: absolute; is positioned relative to the nearest positioned
ancestor.
Sticky: n element with position: sticky; is positioned based on the user's scroll position.
A sticky element toggles between relative and fixed, depending on the scroll position.
Fixed: An element with fixed position, is positioned relative to its normal position.

CSS TABLE: To specify table borders in CSS, use the border property. The example below
specifies a solid border for <table>, <th>, and <td> elements

PADDING IN CSS: Padding is used to create space around an element's content, inside of any defined
borders.

TRANSITIONS IN CSS: CSS transitions allows you to change property values smoothly, over a
given duration.

CSS FLEX PROPERTY: The flex property is a shorthand property for:


 flex-grow
 flex-shrink
 flex-basis
CSS GRID PROPERTY:
The grid property is a shorthand property for:
 grid-template-rows
 grid-template-columns
 grid-template-areas
 grid-auto-rows
 grid-auto-columns
 grid-auto-flow

CSS Overflow

The overflow property specifies whether to clip the content or to add scrollbars when the content of an
element is too big to fit in the specified area.

The overflow property has the following values:

 visible - Default. The overflow is not clipped. The content renders outside the element's box
 hidden - The overflow is clipped, and the rest of the content will be invisible
 scroll - The overflow is clipped, and a scrollbar is added to see the rest of the content
 auto - Similar to scroll, but it adds scrollbars only when necessary.

CSS Z-INDEX

 The z-index property specifies the stack order of an element.

 z-index only works on positioned elements (position: absolute, position: relative, position: fixed,or
position: sticky) and flex items (elements that are direct children of display: flex elements).

 If two positioned elements overlap without a z-index specified, the element positioned last in the
HTML code will be shown on top.

INTRODUCTION TO JAVASCRIPT

JavaScript is a lightweight, cross-platform, and interpreted scripting language. Java Script can be used for
Client-side developments as well as Server-side developments. JavaScript contains a standard library of
objects, like Amu Date, and Math, and a core set of language elements like operators, control structures
and statements JavaScript can be added to your HTML file in two ways:

 Internal JS: We can add JavaScript directly to our HTML file by writing the code inside the
<script> tag. The <script tag can either be placed inside the head or the <body> tag according to
the requirements.
 External JS: We can write JavaScript code in other file having an extensions and then link this file
insidethe head tag of the HTML file in which we want to add this code.

JAVA SCRIPTS VARIABLES: Variables are containers for storing data. JavaScript Variable can be
declared using var, let, const, nothing.
JAVA SCRIPTS HTML DOM (Document Object Model)

When a web page is loaded, the browser creates a Document Object Model of the
page. The HTML DOM model is constructed as a tree of Objects.
 In the DOM, all HTML elements are defined as objects.
 The programming interface is the properties and methods of each object.
 A property is a value that you can get or set (like changing the content of an HTML element).
 A method is an action you can do (like add or deleting an HTML element).

JAVA SCRIPTS VARIABLES: Variables are containers for storing data (storing data values).
In this example, x, y, and z, are variables, declared with the var keyword.
JAVA SCRIPTS DATATYPES:
 Strings: A string (or a text string) is a series of characters.

 Number: All JavaScript numbers are stored as decimal numbers (floating point). Numbers can
be written with, or without decimals.

 Boolean: Booleans can only have two values: true or false.

 Undefined: in JavaScript, a variable without a value, has the value undefined. The type is
also undefined.
 Object: JavaScript objects are written with curly braces {}. Object properties are written
as name:value pairs, separated by commas.

JAVA SCRIPTS OPERATORS: There are different types of JavaScript operators:

Arithmetic Operators are used to perform arithmetic on numbers


Assignment operators assign values to JavaScript variables.
Addition Assignment Operator (+=) adds a value to a variable.
Comparison operators compare the two values it includes equal to (==), not equal (!=) etc.

JAVASCRIPT LOOPS:
Loops are handy, if you want to run the same code over and over again, each time with a different value.
Different Kinds of Loops: JavaScript supports different kinds of loops:

 for - loops through a block of code a number of times


 for/in - loops through the properties of an object
 for/of - loops through the values of an iterable object
 while - loops through a block of code while a specified condition is true
 do/while - also loops through a block of code while a specified condition is true.
JAVASCRIPTS CONDITIONS:
 Use if to specify a block of code to be executed, if a specified condition is true
 Use else to specify a block of code to be executed, if the same condition is false
 Use else if to specify a new condition to test, if the first condition is false
 Use switch to specify many alternative blocks of code to be executed.

getElementById Method

 The most common way to access an HTML element is to use the id of the element.

 In the example above the getElementById method used id="demo" to find the element.

Method Description

document.getElementById(id) Find an element by element id

document.getElementsByTagName(name) Find elements by tag name

document.htablegetElementsByClassName(name) Find elements by class name

INTRODUCTION TO WORDPRESS:
WordPress is a popular and widely-used content management system (CMS) and website creation
platform.It provides a user-friendly interface for building, managing, and maintaining websites and
blogs. Here's a brief overview of WordPress:
• Content Management System (CMS):WordPress is primarily known as a CMS, which means it
enables users to easily create, organize, and manage various types of content on a website. It is
particularly well-suited for blogs, news sites, e-commerce stores, portfolios, and small to medium-
sized business websites.
• Open Source: WordPress is open-source software, which means it is freely available for anyone to use,
modify, and distribute. This open nature has led to a large and active community of developers and users
who contribute to its growth and development.
• Themes: WordPress allows users to choose from thousands of themes (both free and premium) that
control the design and layout of their websites. Themes can be customized to match specific branding or
design preferences.
• Blogging: WordPress initially gained popularity as a blogging platform. It offers powerful blogging
tools, including categories, tags, and a comment system, making it a favorite among bloggers.
• SEO-Friendly: WordPress is known for being SEO-friendly out of the box. It generates clean and
structured HTML code, offers SEO plugins, and provides features like customizable permalinks, making
it easier for websites to rank well in search engines.
• Community and Support: The WordPress community is vast and active, providing ample support
through forums, documentation, and tutorials. Users can find answers to their questions and troubleshoot
issues easily.
TAKEAWAY TOPICS FROM GUEST LECTURER

INTRODUCTION TO PYTHON
Python is a high-level scripting language which can be used for a wide variety of text processing,
system administration and internet-related tasks. Unlike many similar languages, its core language is
very small and easy to master, while allowing the addition of modules to perform a virtually limitless
variety of tasks. Python is a true object-oriented language, and is available on a wide variety of
platforms. There's even a python interpreter written entirely in Java further enhancing python's
position as an excellent solution for internet-based problems. Python was developed in the early 1990's
by Guido van Rossum, then at CWT in Amsterdam, and currently at CNRI in Virginia. In some ways,
python grew out of a project to design a computer language which would be easy for beginners to
learn, yet would be powerful enough for even advanced users. This heritage is reflected in python's
small, clean syntax and the thoroughness of the implementation of ideas like object-oriented
programming. without eliminating the ability to program in a more traditional style. So python is an
excellent choice as a first programming language without sacrificing the power and advanced
capabilities that users will eventually need.

PYTHON VARIABLES

Variables are containers for storing data values. Python has no command for declaring a
variable. A variable is created the moment you first assign a value to it.

PYTHON DATA TYPES

Built-in Data Types in programming, data type is an important concept. Variables can store data of
different types, and different types can do different things. Python has the following data types built-in
by default, in these Categories:

Text Type: str


Numeric Types: int, float, complex
Sequence Types: list, tuple, range
Mapping Type: dict
Set Types: set, frozenset
Boolean Type: bool

PYTHON LIST

Lists are used to store multiple items in a single variable List items are ordered, changeable, and
allow duplicate values.

Example my list = ["apple", "banana", "cherry"]

PYTHON TUPLES

Tuples are used to store multiple items in a single variable. A tuple is a collection which is ordered and
unchangeable.
my list ("apple", "banana", "cherry")

PYTHON SETS
My list = ("apple", "banana", "cherry")

PYTHON DICTIONARIES

Dictionaries are used to store data values in key value pairs. A dictionary is a collection which is
ordered",changeable and does not allow duplicates.

Example: this dict ("brand": "Ford", "model": "Mustang", "year": 1964)

PYTHON CONDITION
Python supports the usual logical conditions from mathematics

 Equals: a==b

 Not Equals: a! = b

 Less than: a < b

 Less than or equal to: a <= b

 Greater than: a>b

 Greater than or equal to: a>=

PYTHON FUNCTIONS

A function is a block of code which only runs when it is called. You can pass data, known as puncters,
into a function. A function can return data as a result. In Python a function is defined using the def
keyword:
def my_function(): print("Hello froma
function") my_function()
INTRODUCTION TO MACHINE LEARNING
Machine learning (MI) is a type of artificial intelligence (AI) that allows software applications to become
more accurate at predicting outcomes without being explicitly programmed to do so. Machine learning
algorithms use historical data as input to predict new output values. Machine learning, tasks are generally
classified into broad categories. These categories are based on how learning is received or how feedback
on the learning is given to the system developed. Two of the most widely adopted machine learning
methods are supervised learning which train algorithms based on example input and output data that is
labeled by humans, and unsupervised learning which provides the algorithm with no labeled data in order
to allow it to find structure within its input data.

SUPERVISED LEARNING

In supervised learning, the computer is provided with example inputs that are labeled with their desired
outputs. The purpose of this method is for the algorithm to be able to "Team" by comparing its actual
output with the "Taught outputs to find errors, and modify the model accordingly. Supervised learning
therefore uses patterns to predict label values on additional unlabeled data.

UNSUPERVISED LEARNING

In unsupervised learning, data is unlabeled, so the learning algorithm is left to find commonalities among
its input data. As unlabeled data are more abundant than labeled data, machine learning methods that
facilitate unsupervised learning are particularly valuable.

REGRESSION

The ultimate goal of the regression algorithms is to plot a best-fit line or a curve between the data
Regression analysis is a fundamental concept in the field of machine learning. It falls under supervised
learning where in the algorithm is trained with both input features and output labels. It helps in establishing
a relationship among the variables by estimating how one variable affects the other.

PYTHON MODULES

NumPy:
NumPy is a general-purpose array-processing package. It provides a high-performance mulitdimensional
array object, and tools for working with these arrays. It is the fundamental package for scientific
computing with Python It is open-source software. It contains various features including these important
ones:
 A powerful N-dimensional array object
 Tools for integrating C/C++ and Fortran code
 Useful linear algebra, Fourier transform, and random number capabilities
Besides its obvious scientific uses, NumPy can also be used as an efficient multi-dimensional container
of generic data. Arbitrary data-types can be defined using NumPy which allows NumPy to seamlessly and
speedily integrate with a wide variety of databases.

PANDAS:
Pandas is an open-source library that is made mainly for working with relational or labeled data both easily
and intuitively. It provides various data structures and operations for manipulating numerical data and
time series. This library is built on top of the NumPy library. Pandas is fast and it has high performance&
productivity for users.

 It has a fast and efficient Data Frame object with the default and customized indexing. o Used for
reshaping and pivoting of the data sets. o Group by data for aggregations and transformations.
 It is used for data alignment and integration of the missing data.
 Provide the functionality of Time Series.
 Process a variety of data sets in different formats like matrix data, tabular heterogeneous, time series.

MATPLOTLIB (PYTHON PLOTTING LIBRARY)


Human minds are more adaptive for the visual representation of data rather than textual data. We can
easily understand things when they are visualized. It is better to represent the data through the graph where
we can analyze the data more efficiently and make the specific decision according to data analysis. Before
learning the matplotlib, we need to understand data visualization and why data visualization is important

DATA VISUALIZATION
Graphics provides an excellent approach for exploring the data, which is essential for presenting results.
Data visualization is a new term. It expresses the idea that involves more than just representing data in the
graphical form (instead of using textual form).

Visualize: We analyze the raw data, which means it makes complex data more accessible, understandable,
and more usable. Tabular data representation is used where the user will look up a specific measurement,
while the chart of several types is used to show patterns or relationships in the data for one or more
variables.
Analysis: Data analysis is defined as cleaning, inspecting, transforming, and modeling data to derive
useful Information. Whenever we make a decision for the business or in daily life, is by past experience.
What will happen to choose a particular decision, it is nothing but analyzing our past. That may be affected
in the future, so the proper analysis is necessary for better decisions for any business or organization.
Document Insight: Document insight is the process where the useful data or information is organized in
the document in the standard format.
Transform Data Set: Standard data is used to make the decision more effectively.
FEEDBACK/OPINION OF THE INTERNSHIP

Innovative topics/Methods:

New-hire panels are one of the best ways to showcase an organization to interns as a great place to
work. It was good experience learning innovative topics especially in the areas of web development,
Python, and machine learning. I found hands on project in web development particularly valuable.
However, I did face challenges in keeping up with the pace of the machine learning modules.
Overall, this internship has significantly expanded my skillset and to apply these skills in future
endeavors.

Industrial significance of the topics:

 HTML

HTML is the central innovation behind all that you find in a web program, and it's utilized(nearby
other tech like JavaScript and CSS) to fabricate everything from basic website pages to a complex web
applications and administrations. Html is necessary for the basic structure of the website.

 CSS

CSS is the language for decreasing the presentation of Web pages, including colors, layout, and fonts.
It allows one to adopt the presentation to different types of devices, such as large screens, small screens
or printers. CSS is independent of HTML, and can be used with any XML based markup language.

 ML

Machine Learning is used in internet search engines, email filters to sort out spam, websites to make
personalized recommendations, banking software to detect unusual transactions, and lots of apps on
our phones such as voice recognition. ML. enables computers and computing machines to search for
and identify hidden insights, without being programmed for where to look for, when exposed to new
data sets,

 JS

JavaScript is an object orient programming language designed to make web development easier and
more attractive. In most cases, JavaScript is used to create responsive, interactive elements for web
pages, enhancing the user experience.
Syllabus/Concepts that can be included/recommended in engineering
curriculum (Academics):

Some of the additional concepts that can be included in engineering should be to


study web development frameworks. DevOps, for efficient software development.
Study cyber security to secure software development practices. Learn Block
chain to secure data storage and also contribute to open source projects to gain
practical experience.

Area of improvements/Drawbacks in the internship program:

To improve, I would suggest offering more support for complex topics like machine learning.
Stay connected with the interns to help us know about upcoming opportunities and new job
openings. Keep relationships open and make sure they know there is always an open door. This
could potentially be a future employee.

Opinion of the internship:

The internship was extremely valuable for all of us. It was a great experience the supervisors are
so goodtheir way of teaching and interacting. We've learned that practical experience in skills such
as multitasking, communicating, learning to deal with real world, also dealing with deadlines are
really good experience and will help us in many ways.
The department was helpful and beneficial to encourage students to find their internship based
on their future career goals. As a whole this internship was successful in furthering my knowledge
of a career in the field of computer science.
CONTENTS

CHAPTER 1

INTRODUCTION…………………………………………………………..1-5
1.1 OVERVIEW……………………………………………………………2
1.2 EXISTING SYSTEM…………………………………………………..2-3
1.3 LIMITATIONS OF EXISTING SYSTEM…………………………….3-4
1.4 PROPOSED SYSTEM…………………………………………………4
1.5 ADVANTAGES OF PROPOSED SYSTEM…………………………. 4
1.6 ORGANIZATION OF THE PROJECT………………………………..5

CHAPTER 2
LITERATURE SURVEY………………………………………………...6-8
2.1 INTRODUCTION…………………………………………………… 6
2.2 TECHNICAL ASPECTS……………………………………………..7-8

CHAPTER 3
SYSTEM REQUIREMENT SPECIFICATION………………………..9-11
3.1 OBJECTIVE…………………………………………………………..9
3.2 FUNCTIONAL REQUIREMENTS…………………………………..9
3.3 NON-FUNCTIONAL REQUIREMENT……………………………..9-10
3.4 SYSTEM REQUIREMENTS………………………………………...10-11
3.5 SOFTWARE COMPONENTS………………………………………..10
3.6 HARDWARE COMPONENTS………………………………………10

CHAPTER 4
SYSTEM ANALYSIS AND DESIGN………………………………….12-15
4.1 HIGH LEVEL DIAGRAM…………………………………………12
4.2 FEATURES…………………………………………………....……12
4.3 SPECIFICATIONS………………………………………………….13
4.4 SYSTEM ARCHITECTURE………………………………………..13
4.5 PERFORMANCE……………………………………………………14
4.6 DATA FLOW DIAGRAM…………………………………………..14
4.7 USE CASE DIAGRAM……………………………………………...15
CHAPTER 5
IMPLEMENTATION…………………………………………………16-24
5.1 DATA SET CODE………………………………………………….17-18
5.2 TRAINED CODE…………………………………………………...19-22
5.3 OUTPUT CODE…………………………………………………….23-24

CHAPTER 6
TESTING……………………………………………………………….25

CHAPTER 7
RESULTS OR SNAPSHOTS…………………………………………26-28

CHAPTER 7
CONCLUSION…………………………………………………………29

CHAPTER 8
FUTURE ENHANCEMENT…………………………………………...29
BIBLIOGRAPHY……………………………………………………….30
LIST OF FIGURES

Figure 4.4 System Architecture………………………………………………………...13


Figure 4.6 Data Flow Diagram…………………………………………………………14
Figure 4.7 Use case Diagram…………………………………………………………..15
Figure 7.1 Before crop disease ( bacterial leaf )………………………………………..26
Figure 7.2 Before crop disease ( brown spot )………………………………………….26
Figure 7.3 Output……………………………………………………………………….27
Figure 7.4 Prediction…………………………………………………………………....27
Figure 7.5 Accuracy…………………………………………………………………….28
CROP DISEASE IDENTIFICATION 2023-24

ABSTRACT

Crop diseases pose a significant threat to global food security by causing substantial yield losses.
Traditional methods of disease detection are often time-consuming and require expert knowledge, leading
to delays in response and potential spread of diseases. In recent years, advancements in machine learning
(ML) and image processing techniques have offered promising solutions for automated crop disease
identification. This research aims to develop a robust and efficient system for crop disease identification
leveraging ML algorithms and image processing methodologies. The proposed system comprises several
stages: image acquisition, preprocessing, feature extraction, classification, and disease diagnosis. During
the image acquisition phase, images of diseased crops are captured using digital cameras or smartphones.
These images are then preprocessed to enhance quality and remove noise, ensuring optimal input for
subsequent analysis. Feature extraction techniques are employed to extract relevant information from the
preprocessed images, capturing distinctive patterns and characteristics indicative of different diseases. A
variety of ML algorithms, such as convolutional neural networks (CNNs), support vector machines
(SVMs), and decision trees, are evaluated for their effectiveness in classifying crop diseases based on
extracted features. The performance of these algorithms is assessed using metrics such as accuracy,
precision, recall, and F1-score. Furthermore, the system incorporates a user-friendly interface for farmers
and agricultural professionals to easily upload images, receive disease predictions, and access relevant
information and recommendations for disease management. In conclusion, this research contributes to the
advancement of precision agriculture by providing a reliable and efficient tool for crop disease
identification, thereby empowering farmers and stakeholders with the means to safeguard crop health and
enhance agricultural productivity.

Department of Product design and development, Contriver Page 1


CROP DISEASE IDENTIFICATION 2023-24

CHAPTER 1
INTRODUCTION

1.1 overview:

One of the important sectors of the Indian Economy is Agriculture. Employment to almost 50%
of the country’s workforce is provided by the Indian agriculture sector. Almost 70% of the
population depends upon agriculture and80% of the farmers are small-scale and/or marginal farmers.
India produces almost 275 million tones of Food grains, accounting for 16% GDP and 20% export.
One of the reasons that disease detection in plants plays an important role in the agriculture field,
is because there is almost a 50% of crop loss due to diseases in the plants and lack of proper
monitoring. Early rice disease detection is vital in preventing damage to agricultural product output
and quantity in the agricultural field. Manual observations of rice diseases are tedious, costly, and
time-consuming, especially when classifying disease patterns and color while dealing with non-
native diseases. Hence, image processing and Machine Learning (ML) techniques are used to detect
rice disease early and within a relatively brieftime period. This article aims to demonstrate the
performance of different ML algorithms in rice disease detection through image processing. We
critically examined different. techniques, and the outcomes of previous research have been
reviewed to compare the performance of rice disease classifications. Performance has been
evaluated based on the criteria of feature extraction, clustering, segmentation, noise reduction, and
level of accuracy of diseasedetection techniques. This paper also showcases various algorithms for
different datasets in terms of training methods, image preprocessing with clustering and filtering
criteria, and testing with reliable outcomes. Through this review, we provide valuable insights into
the current state of ML-based approaches for the early detection of rice diseases, and assist future
research and improvement. In addition, we discuss several challenges that must be overcome in
order to achieve effective identification of rice diseases.

1.2 Existing System:

Several existing systems for crop disease identification utilize machine learning (ML) and image
processing techniques to assist farmers and agricultural experts in detecting and diagnosing crop
diseases. Here are a few examples:

1.Plant Village: Plant Village is a platform that offers a mobile application for farmers to diagnose
crop diseases. It uses a vast database of images and ML algorithms to identify diseases based on
the symptoms observed in the images uploaded by users. The platform covers a wide range of
crops and diseases.

2.Agrio: Agrio is another mobile application that employs ML algorithms to diagnose crop
diseases. Users can upload images of diseased crops, and the application provides real-time
analysis and recommendations for treatment. Agrio also offers a community feature where users
can discuss agricultural issues and share insights.

Department of Product design and development, Contriver Page 2


CROP DISEASE IDENTIFICATION 2023-24

3. Deep Agro: Deep Agro is a system that integrates satellite imagery, drones, and ML algorithms
to monitor crop health and detect diseases. It uses high-resolution images captured from drones or
satellites to identify subtle changes in crop health, enabling early detection of disease and targeted.

4. CROPPRO: CROPPRO is a web-based platform that combines image processing techniques


with ML algorithms to diagnose crop diseases. It provides farmers with a user-friendly interfaceto
upload images of their crops, and the platform generates detailed reports on disease diagnosis,
including recommended treatments and preventive measures.

5. Pheno Crops: Pheno Crops is a system that utilizes ML algorithms to analyze plant phenotypes
and identify diseases based on visual symptoms. It employs advanced image processing
techniques to extract features from plant images and classify them into healthy or diseased
categories. Pheno Crops is designed to be scalable and adaptable to various crop types and
environmental conditions.

1.3 Limitations of Existing System:

1. Quality and Quantity: The performance of ML models heavily relies on the quality and
quantity of data available for training. Limited or biased datasets may lead to inaccuracies in
disease identification, especially for rare or region-specific diseases.

2.Overfitting: ML models may overfit to the training data, resulting in poor generalization to
unseendata. This can occur when the models capture noise or irrelevant patterns in the training
data, leading to decreased performance on real-world images.

3.Interpretability: Deep learning models, such as convolutional neural networks (CNNs), are
often considered black boxes, making it challenging to interpret their decision-making process.
Lack of interpretability may reduce user trust and confidence in the system's recommendations.

4.Hardware and Connectivity Requirements: Some existing systems rely on high-performance


computing resources or stable internet connectivity, which may not be readily available in rural or
remote agricultural areas. Limited access to hardware and connectivity can hinder the adoption of
thesesystems by farmers.

5.Crop and Disease Coverage: Existing systems may not cover all crop species or diseases,
limitingtheir applicability to specific regions or agricultural contexts. Some diseases may also exhibit
variations in symptoms, making them difficult to detect accurately using automated methods

6.Cost and Accessibility: Cost constraints and technical complexity may hinder the accessibility
of existing systems to small-scale farmers or resource-limited settings. High costs associated with
hardware, software licenses, and maintenance may pose barriers to adoption.

7.Expertise Requirement: Effective utilization of existing systems often requires a certain level
of technical expertise in image processing, machine learning, and agricultural domain knowledge.
Farmers and agricultural practitioners may require training and support to use these systems
effectively.

Department of Product design and development, Contriver Page 3


CROP DISEASE IDENTIFICATION 2023-24

8. Ethical and Privacy Concerns: The collection and sharing of agricultural data, including images
of crops, raise ethical and privacy concerns regarding data ownership consent, and potential
misuse. Addressing these concerns is essential for fostering trust and acceptance of crop disease
identificationsystems among stakeholders.

1.4 Proposed System:

The proposed system for crop disease identification integrates cutting-edge machine learning
algorithms, comprehensive datasets, and user-friendly interfaces to revolutionize agricultural
practices. By leveraging advanced techniques such as transfer learning and data augmentation, the
system achieves high accuracy in disease detection across a wide range of crops and regions.
Through edge computing optimization, the system operates efficiently even in remote areas with
limited connectivity, empowering farmers with offline support and real-time analysis capabilities.
A user-friendly interfaceenables seamless interaction, allowing farmers to easily upload images,
receive instant disease diagnosis, and access personalized treatment recommendations.

1.5 Advantages of Proposed System:

1.Automation: This automation leads to faster detection and diagnosis, enabling timely
interventionto mitigate crop losses.

2. Accuracy: ML algorithms trained on large datasets of crop images can achieve high levels of
accuracy in disease identification.

3. Scalability: The system can be easily scaled to analyze large volumes of crop images, making
it suitable for use in large agricultural operations.

4. Early Detection: This can identify diseases at their early stages, enabling farmers to take
prompt action to prevent the spread of diseases and minimize crop losses.

5. Cost-Effectiveness : By preventing crop losses and optimizing resource utilization, the


systemultimately leads to cost savings for farmers and agricultural stakeholders.

6. User-Friendly Interface: The system can be designed with a user-friendly interface that
allows farmers and agricultural professionals to easily upload images and receive disease
predictions.

Department of Product design and development, Contriver Page 4


CROP DISEASE IDENTIFICATION 2023-24

1.6Organizition of the Project:

Chapter 1:
Chapter 1 describes the overview, the existing system and the proposed system.

Chapter 2:
Chapter 2 contains the literature survey and technical aspects of the project.

Chapter 3:

Chapter 3 summarizes the functional. Non functional and system requirements, of


the project.

Chapter 4:

Chapter 4 signifies the system design and analysis with highlights of the system
architecture.

Chapter 5:

Chapter 5 includes the implementation part of the project along with the source
code.

Chapter 6:

Chapter 6 includes the various testing approaches performed.

Department of Product design and development, Contriver Page 5


CROP DISEASE IDENTIFICATION 2023-24

CHAPTER 2
LITERATURE SURVEY

The website is known to most people because of the internet network. The website in general is a
page designed in such a way as to be accessed by the whole world using the internet network to
obtain information. In the business world, the website is also used as apromotional medium which
can help in developing the buying and selling process of a company. The following is the definition
of a website according some experts, namely: According to Sibero in the journal Supriyanta
(2015:35): “World Wide Web(W3) also known as the web is a system related to documents used
as a medium for displaying texts, images, multimedia and others on the internet network”.

INTRODUCTION:

A literature survey on crop disease Image processing techniques are used to detect the citrus leaf
disease. This system includes: Image preprocessing, segmentation of the leaf using K means
clustering to determine the diseased areas, feature extraction and classification of disease. Uses
Gray-Level Co-Occurrence matrix (GLCM) for feature extraction and classification is done using
a support vector machine. This approach carriesout genetic algorithms, general image processing
techniques, K-mean clustering, SVM classifier, etc. Introduced a smartphone application that
assisted the rice farmers to determine nitrogen deficiency depending on the plant coloration. The
tool may be used instead of or in conjunction with conventional nitrogen use. An easy to use
technology for farmers was proposed without any training to the model. This paper introduced
automated image processing methods using Deep and Machine Learning

Farming accounts for approximately 17%of total GDP providing more than 60 % of the population
with employment. The recognition of crop diseases plays an important role throughout the
agricultural climate. Indian farming involves crops such as maize, wheat, and so on. With its root
and leaf energies, each of these crops is cultivated. For research incrops with visually recognizable
trends, the crop disease experiments apply

The control of crop health and diseases plays an important part in the effective cultivation of crops.
In the early times, the person with experience in this field was assigned responsibility to track and
examine crop disease manually. This requires a lot of work and considerable time for processing.
Image processing methods can be used to diagnose crop disease, and algorithms can be used to
predict two different crop diseases. The crop disease experiments apply to research on the crops
with visibly identifiable trends. we have performed a survey on various diseases of crops and
specific specialized techniques to diagnose these conditions.

Department of Product design and development, Contriver Page 6


CROP DISEASE IDENTIFICATION 2023-24

TECHNICAL ASPECTS:

Identifying paddy diseases using machine learning (ML) and image processing involves several
technical aspects. Here's a breakdown of the key components involved:

1.Image Acquisition: Acquiring high-quality images of paddy plants affected by diseases is


crucial. This may involve using digital cameras, drones, or satellite imagery to capture images of
paddy fields.

2.Image Preprocessing: Preprocessing techniques are applied to enhance the quality of images
and prepare them for analysis. This includes tasks such as noise reduction, contrast enhancement,
and image resizing.

3.Image Segmentation: Segmenting the paddy plant regions from the background and isolating
the diseased areas is essential. Various segmentation algorithms, such as thres holding, region
based segmentation, or deep learning-based methods, can be employed for this purpose.

4.Feature Extraction: Extracting relevant features from the segmented regions is criticalfor
distinguishing between healthy and diseased paddy plants. Features may include color
histograms, texture descriptors, shape characteristics, and spectral properties.

5.Machine Learning Models: ML models are trained using the extracted features to classify
paddy diseases. Commonly used ML algorithms include support vector machines(SVM), decision
trees, random forests, k-nearest neighbors (KNN), and convolutional neural networks (CNNs).

6.Dataset: A labeled dataset consisting of images of healthy and diseased paddy plants is required
for training and evaluating the ML models. This dataset should cover a wide range of disease types,
severities, and environmental conditions.

7.Model Training and Validation: The ML models are trained on the labeled dataset andvalidated
using techniques such as cross-validation to ensure their generalization ability and robustness.

8.Performance Evaluation: The performance of the trained models is evaluated using metrics
such as accuracy, precision, recall, F1-score, and receiver operating characteristic (ROC) curves.

9.Deployment and Integration: Once trained and validated, the ML models can be deployed for
real-time disease identification in paddy fields. Integration with mobile applications or drones can
facilitate on-site diagnosis and timely management of paddy diseases.

10.Robustness and Scalability: Ensuring that the developed system is robust to variations in
lighting conditions, image quality, and disease types is essential. Additionally, scalability
considerations should be addressed to accommodate large-scale paddy cultivation areas.

Department of Product design and development, Contriver Page 7


CROP DISEASE IDENTIFICATION 2023-24

By integrating these technical aspects, researchers and practitioners can develop effective
systems for paddy disease identification using ML and image processing techniques, contributing
to improved crop management and yield optimization in paddy cultivation

Department of Product design and development, Contriver Page 8


CROP DISEASE IDENTIFICATION 2023-24

CHAPTER 3

SYSTEM REQUIREMENT SPECIFICATION

A system requirements specification (SRS) is a specification for a software system which gives the
complete behavioral description of the system to be developed. It is comprised ofuse cases which
describes all the interactions of the user with the software. Along with theuse cases, it also contains
functional and non-functional requirements.

3.1 Objective:

The system requirement specification document details out all necessary requirement for the
development of the project. Clear and thorough understanding of the products to be developed is
important to derive requirement. This can be prepared after detailed communications with project
team and the customer. The objective of a crop disease identification system's requirements is to
create a comprehensive framework that enables accurate and efficient detection of diseases
affecting crops. This includes defining the functionality, performance metrics, user interface, data
sources, and integrationcapabilities necessary to develop a robust and user-friendly solution for
farmers and agricultural experts.

3.2 Functional Requirements:

The function of a software system or its component is defined by the functional requirement. A
function is given by set of inputs, behaviors and outputs. The functional requirement may comprise
of calculations, technical description, data modifications, processing and other specific
functionality defining what a system should accomplish. The use cases capture all the behavioral
requirements which describe all possible cases where system uses the functional requirement. In
general, the expression for functional requirement is in the form “system must do”.

3.3 Non-Functional Requirement:

A non-functional requirement specifies the criteria that may be used to judge the operationof a
system rather than the specific behavior. If differs from the functional requirement where it
specifies the specific behavior or functions. On the other hand, non-functional requirement defines
how the system is supposed to be.
They are expressed in the form “system shall be ”.

Department of Product design and development, Contriver Page 9


CROP DISEASE IDENTIFICATION 2023-24

Usability : DyScale supports large volumes of data and interactive queries. Also, supportsmultiple
users.

Security : Earlier Hadoop did not consider security issues. But in recent years, auditing and
authorization controls (HDFS file permissions) for both user and services have been evolved.

Availability : DyScale guarantees that every request of the user receives a response about whether
the request was successful or not. Performance Evaluation of DyScale with Job Schedulers for
Parallel Data Processing 2017-18 Department of Testing and Programing, Contriver Page 17

Timeliness : Job completion time is comparatively less compared to homogeneous core processor.

Extensibility : DyScale can be used to achieve job completion objectives once the servers with
heterogeneous multi-core processors become available.

Scalability : DyScale has reasonable ways to deal with the system’s growth in terms of data
volume, traffic volume and complexity.

3.4 System Requirements:

1.Hardware Requirements:

Computing Resources : Sufficient computational resources are needed to train and deploy ML
models. This may include CPUs, GPUs, or specialized hardware like TPUs for accelerating
computations.

Storage : Adequate storage capacity is required to store large datasets of images, trained models,
and intermediate results generated during the process.

Memory : Sufficient RAM is necessary, especially during training and inference stages, to
accommodate the processing of large image datasets and model parameters.

Operating System: windows 10


RAM : 2GB
Processor : Intel CORE i5

2. Software Requirements:

Programming Languages : Proficiency in programming languages commonly used in ML and


image processing, such as Python, is essential.

Libraries and Frameworks : Familiarity with ML libraries and frameworks like TensorFlow,
PyTorch, or scikit-learn for model development and deployment.

Image Processing Tools : Knowledge of image processing libraries like OpenCV for preprocessing,
feature extraction, and image manipulation tasks.

Department of Product design and development, Contriver Page 10


CROP DISEASE IDENTIFICATION 2023-24

Development Environment : Setting up a development environment with appropriate IDEs,


editors, and version control systems for collaborative development.

3.Data Requirements:

High-Quality Datasets: Access to high-quality labeled datasets containing images of healthy


crops and crops affected by various diseases is crucial for training accurate ML models.

Annotation Tools: Tools for annotating and labeling images with ground truth information to
facilitate supervised learning tasks.

4. Connectivity:

Internet Connectivity: Stable internet connectivity may be required for accessing online
resources, cloud-based services, or remote collaboration platforms.

Local Network: In some cases, local network connectivity may be necessary for communication
between edge devices and centralized servers.

5. Deployment Environment:

Edge Devices: Optimizing ML models for deployment on edge devices such as smartphones,
tablets, drones, or IoT devices may require considerations for resource constraints, power
efficiency, and real-time inference.

Department of Product design and development, Contriver Page 11


CROP DISEASE IDENTIFICATION 2023-24

CHAPTER 4

SYSTEM ANALYSIS AND DESIGN

The procedure of creating or modifying the systems, and the models and methodologies used by
people to build these systems is termed as the Systems Development Life Cycle (SDLC). In
software engineering, numerous software development methodologies are derived from the SDLC
concept. The framework called the software development processis planned and controlled for the
creation of an information system by these methodologies.

4.1 High Level Design:

High Level Design (HLD) is used for developing a software product as it explains the architecture.
It provides an overview of the entire system where it identifies the main components developed
for the product and the corresponding interfaces. Also it describes the affinity between various
module sand functions of the system. High Level Design documents are used for documenting
different modules, parts of the system and their relationships.

4.2 Features:

1.Image Acquisition: Collecting images of crops either through direct capture oruploaded by
users
.
2.Preprocessing: Enhancing image quality through techniques like noise reduction, contrast
adjustment, and normalization
.
3.Feature Extraction: Identifying and extracting relevant features such as color, texture, and shape
from the images
.
4.Machine Learning Models: Utilizing ML algorithms such as CNNs or decision treesto classify
images and identify diseases.

5.Disease Identification: Classifying crop images based on learned patterns to determine the
presence and type of disease.

Department of Product design and development, Contriver Page 12


CROP DISEASE IDENTIFICATION 2023-24

4.3 Specifications:

 Image resolution and format requirements.

 Training dataset size and diversity.

 ML algorithm selection (e.g., convolutional neural networks).

 Processing speed and resource requirements for real-time identification.

 Integration with existing agricultural systems or platforms.

 User interface design for ease of use by farmers or agricultural professionals.

4.4 System Architecture:

Department of Product design and development, Contriver Page 13


CROP DISEASE IDENTIFICATION 2023-24

4.5 Performance:
1.Accuracy: The primary metric for evaluating performance, accuracy measures the proportion of
correctly identified crop diseases among all instances.

2.Precision and Recall: Precision indicates the proportion of correctly identified disease cases
among all cases identified as diseased, while recall measures the proportion of correctly identified
disease cases among all actual diseased cases.

3.F1 Score: The harmonic mean of precision and recall, F1 score provides a balanced measure of
model performance, especially when dealing with imbalanced datasets.

4.Sensitivity and Specificity: Sensitivity (true positive rate) measures the proportion of actual
positives correctly identified by the model, while specificity (true negative rate) measures the
proportion of actual negatives correctly identified by the model.

5.Area Under the ROC Curve (AUC-ROC): AUC-ROC quantifies the overall performance of
the model across different thresholds, particularly useful for binary classification problems.

4.6 Data Flow Diagram:

Department of Product design and development, Contriver Page 14


CROP DISEASE IDENTIFICATION 2023-24

4.5 Use Case Diagram:

Department of Product design and development, Contriver Page 15


CROP DISEASE IDENTIFICATION 2023-24

CHAPTER 5

IMPLEMENTATION

The implementation process of crop disease identification typically involves several steps:

1.Data Collection: Gather a diverse dataset of images containing healthy crops and crops affected
by various diseases. This dataset is crucial for training the identification model.

2.Preprocessing: Clean and preprocess the collected images to ensure uniformity in size,
resolution, and color. This step may also involve data augmentation techniques to increase the
diversity of the dataset.

3.Model Selection: Choose an appropriate machine learning or deep learning model for image
classification tasks. Convolutional Neural Networks (CNNs) are commonly used for this purpose
due to their effectiveness in handling image data.

4.Training: Train the selected model using the preprocessed dataset. This involves feeding the
images into the model and adjusting its parameters to minimize the classification error.

5.Validation: Validate the trained model using a separate dataset (validation set) to assess its
performance and fine-tune hyper parameters if necessary.

6.Testing: Test the model on a new set of unseen images (test set) to evaluate its generalization
ability and overall accuracy in identifying crop diseases.

7.Deployment: Once the model performs satisfactorily, deploy it into a production environment
where it can be accessed by farmers or agricultural stakeholders. This may involve integratingthe
model into a mobile application, web service, or other platforms for easy access and usability.

8.Monitoring and Updates: Continuously monitor the performance of the deployed model and
periodically update it with new data to improve its accuracy and adaptability to evolving crop
diseases.

Department of Product design and development, Contriver Page 16


CROP DISEASE IDENTIFICATION 2023-24

5.1 DATA SET CODE:


import torch
from torchvision import datasets, transforms
from torch.utils.data import DataLoader, Subset
# Required constants.
ROOT_DIR = '../input/rice_leaf_diseases'
VALID_SPLIT = 0.1
IMAGE_SIZE = 224 # Image size of resize when applying transforms.
BATCH_SIZE = 16
NUM_WORKERS = 4 # Number of parallel processes for data preparation.
# Training transforms
def get_train_transform(IMAGE_SIZE):
train_transform = transforms.Compose([
transforms.Resize((IMAGE_SIZE, IMAGE_SIZE)),
transforms.RandomHorizontalFlip(p=0.5),
transforms.RandomVerticalFlip(p=0.5),
transforms.GaussianBlur(kernel_size=(5, 9), sigma=(0.1, 5)),
transforms.RandomAdjustSharpness(sharpness_factor=2, p=0.5),
transforms.RandomAutocontrast(p=0.5),
transforms.RandomGrayscale(p=0.5),
transforms.RandomRotation(45),
transforms.ToTensor(),
transforms.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]
)
])
return train_transform

# Validation transforms
def get_valid_transform(IMAGE_SIZE):
valid_transform = transforms.Compose([
transforms.Resize((IMAGE_SIZE, IMAGE_SIZE)),
transforms.ToTensor(),
transforms.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]
)
])
return valid_transform

Department of Product design and development, Contriver Page 17


CROP DISEASE IDENTIFICATION 2023-24

def get_datasets():
"""
Function to prepare the Datasets.
Returns the training and validation datasets along
with the class names.
"""
dataset = datasets.ImageFolder(
ROOT_DIR,
transform=(get_train_transform(IMAGE_SIZE))
)
dataset_test = datasets.ImageFolder(
ROOT_DIR,
transform=(get_valid_transform(IMAGE_SIZE))
)
dataset_size = len(dataset)
# Calculate the validation dataset size.
valid_size = int(VALID_SPLIT*dataset_size)
# Radomize the data indices.
indices = torch.randperm(len(dataset)).tolist()
# Training and validation sets.
dataset_train = Subset(dataset, indices[:-valid_size])
dataset_valid = Subset(dataset_test, indices[-valid_size:])
return dataset_train, dataset_valid, dataset.classes
def get_data_loaders(dataset_train, dataset_valid):
"""
Prepares the training and validation data loaders.
:param dataset_train: The training dataset.
:param dataset_valid: The validation dataset.
Returns the training and validation data loaders.
"""
train_loader = DataLoader(
dataset_train, batch_size=BATCH_SIZE,
shuffle=True, num_workers=NUM_WORKERS
)
valid_loader = DataLoader(
dataset_valid, batch_size=BATCH_SIZE,
shuffle=False, num_workers=NUM_WORKERS
)
return train_loader, valid_loader

Department of Product design and development, Contriver Page 18


CROP DISEASE IDENTIFICATION 2023-24

5.2 TRAINED CODE:

import torch
import argparse
import torch.nn as nn
import torch.optim as optim
import time
from tqdm.auto import tqdm
from model import build_model
from datasets import get_datasets, get_data_loaders
from utils import save_model, save_plots
# Construct the argument parser.
parser = argparse.ArgumentParser()
parser.add_argument(
'-e', '--epochs', type=int, default=20,
help='Number of epochs to train our network for'
)
parser.add_argument(
'-lr', '--learning-rate', type=float,
dest='learning_rate', default=0.001,
help='Learning rate for training the model'
)
args = vars(parser.parse_args())
# Training function.
def train(model, trainloader, optimizer, criterion):
model.train()
print('Training')
train_running_loss = 0.0
train_running_correct = 0
counter = 0
for i, data in tqdm(enumerate(trainloader), total=len(trainloader)):
counter += 1
image, labels = data
image = image.to(device)
labels = labels.to(device)
optimizer.zero_grad()
# Forward pass.
outputs = model(image)
# Calculate the loss.

Department of Product design and development, Contriver Page 19


CROP DISEASE IDENTIFICATION 2023-24

loss = criterion(outputs, labels)


train_running_loss += loss.item()
# Calculate the accuracy.
_, preds = torch.max(outputs.data, 1)
train_running_correct += (preds == labels).sum().item()
# Backpropagation
loss.backward()
# Update the weights.
optimizer.step()

# Loss and accuracy for the complete epoch.


epoch_loss = train_running_loss / counter
epoch_acc = 100. * (train_running_correct / len(trainloader.dataset))
return epoch_loss, epoch_acc
# Validation function.
def validate(model, testloader, criterion, class_names):
model.eval()
print('Validation')
valid_running_loss = 0.0
valid_running_correct = 0
counter = 0
# We need two lists to keep track of class-wise accuracy.
class_correct = list(0. for i in range(len(class_names)))
class_total = list(0. for i in range(len(class_names)))
with torch.no_grad():
for i, data in tqdm(enumerate(testloader), total=len(testloader)):
counter += 1

image, labels = data


image = image.to(device)
labels = labels.to(device)
# Forward pass.
outputs = model(image)
# Calculate the loss.
loss = criterion(outputs, labels)
valid_running_loss += loss.item()
# Calculate the accuracy.
_, preds = torch.max(outputs.data, 1)
valid_running_correct += (preds == labels).sum().item()
# Calculate the accuracy for each class

Department of Product design and development, Contriver Page 20


CROP DISEASE IDENTIFICATION 2023-24

correct = (preds == labels).squeeze()


for i in range(len(preds)):
label = labels[i]
class_correct[label] += correct[i].item()
class_total[label] += 1

# Loss and accuracy for the complete epoch.


epoch_loss = valid_running_loss / counter
epoch_acc = 100. * (valid_running_correct / len(testloader.dataset))
# Print the accuracy for each class after every epoch.
print('\n')
for i in range(len(class_names)):
print(f"Accuracy of class {class_names[i]}:
{100*class_correct[i]/class_total[i]}")
print('\n')
return epoch_loss, epoch_acc
if _name_ == '_main_':
# Load the training and validation datasets.
dataset_train, dataset_valid, dataset_classes = get_datasets()
print(f"[INFO]: Number of training images: {len(dataset_train)}")
print(f"[INFO]: Number of validation images: {len(dataset_valid)}")
print(f"[INFO]: Class names: {dataset_classes}\n")
# Load the training and validation data loaders.
train_loader, valid_loader = get_data_loaders(dataset_train, dataset_valid)
# Learning_parameters.
lr = args['learning_rate']
epochs = args['epochs']
device = ('cuda' if torch.cuda.is_available() else 'cpu')
print(f"Computation device: {device}")
print(f"Learning rate: {lr}")
print(f"Epochs to train for: {epochs}\n")
# Load the model.
model = build_model(
pretrained=True,
fine_tune=True,
num_classes=len(dataset_classes)
).to(device)

# Total parameters and trainable parameters.


total_params = sum(p.numel() for p in model.parameters())

Department of Product design and development, Contriver Page 21


CROP DISEASE IDENTIFICATION 2023-24

print(f"{total_params:,} total parameters.")


total_trainable_params = sum(
p.numel() for p in model.parameters() if p.requires_grad)
print(f"{total_trainable_params:,} training parameters.")
# Optimizer.
optimizer = optim.Adam(model.parameters(), lr=lr)
# Loss function.
criterion = nn.CrossEntropyLoss()
# Lists to keep track of losses and accuracies.
train_loss, valid_loss = [], []
train_acc, valid_acc = [], []
# Start the training.
for epoch in range(epochs):
print(f"[INFO]: Epoch {epoch+1} of {epochs}")
train_epoch_loss, train_epoch_acc = train(model, train_loader,
optimizer, criterion)
valid_epoch_loss, valid_epoch_acc = validate(model, valid_loader,
criterion, dataset_classes)
train_loss.append(train_epoch_loss)
valid_loss.append(valid_epoch_loss)
train_acc.append(train_epoch_acc)
valid_acc.append(valid_epoch_acc)
print(f"Training loss: {train_epoch_loss:.3f}, training acc:
{train_epoch_acc:.3f}")
print(f"Validation loss: {valid_epoch_loss:.3f}, validation acc:
{valid_epoch_acc:.3f}")
print('-'*50)
time.sleep(5)

# Save the trained model weights.


save_model(epochs, model, optimizer, criterion)
# Save the loss and accuracy plots.
save_plots(train_acc, valid_acc, train_loss, valid_loss)
print('TRAINING COMPLETE')

Department of Product design and development, Contriver Page 22


CROP DISEASE IDENTIFICATION 2023-24

5.3 OUTPUT CODE:

import torch
import cv2
import numpy as np
import glob as glob
import os
from model import build_model
from torchvision import transforms
# Constants.
DATA_PATH = '../input/test_data'
IMAGE_SIZE = 224
DEVICE = 'cpu'
# Class names.
class_names = ['Bacterial leaf blight', 'Brown spot', 'Leaf smut']
# Load the trained model.
model = build_model(pretrained=False, fine_tune=False, num_classes=3)
checkpoint = torch.load('../outputs/model.pth', map_location=DEVICE)
print('Loading trained model weights...')
model.load_state_dict(checkpoint['model_state_dict'])
# Get all the test image paths.
all_image_paths = glob.glob(f"{DATA_PATH}/*")
# Iterate over all the images and do forward pass.
for image_path in all_image_paths:
# Get the ground truth class name from the image path.
gt_class_name = image_path.split(os.path.sep)[-1].split('.')[0]
# Read the image and create a copy.
image = cv2.imread(image_path)
orig_image = image.copy()

# Preprocess the image


image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)
transform = transforms.Compose([
transforms.ToPILImage(),
transforms.Resize((IMAGE_SIZE, IMAGE_SIZE)),
transforms.ToTensor(),
transforms.Normalize(
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]

Department of Product design and development, Contriver Page 23


CROP DISEASE IDENTIFICATION 2023-24

)
])
image = transform(image)
image = torch.unsqueeze(image, 0)
image = image.to(DEVICE)

# Forward pass throught the image.


outputs = model(image)
outputs = outputs.detach().numpy()
pred_class_name = class_names[np.argmax(outputs[0])]
print(f"GT: {gt_class_name}, Pred: {pred_class_name.lower()}")
# Annotate the image with ground truth.
cv2.putText(
orig_image, f"GT: {gt_class_name}",
(10, 25), cv2.FONT_HERSHEY_SIMPLEX,
0.8, (0, 255, 0), 2, lineType=cv2.LINE_AA
)
# Annotate the image with prediction.
cv2.putText(
orig_image, f"Pred: {pred_class_name.lower()}",
(10, 55), cv2.FONT_HERSHEY_SIMPLEX,
0.8, (100, 100, 225), 2, lineType=cv2.LINE_AA
)
cv2.imshow('Result', orig_image)
cv2.waitKey(0)
cv2.imwrite(f"../outputs/{gt_class_name}.png", orig_image)

Department of Product design and development, Contriver Page 24


CROP DISEASE IDENTIFICATION 2023-24

CHAPTER 6
TESTING
The testing process for crop disease identification involves collecting diverse datasets of healthy
and diseased crops, preprocessing the data, extracting distinguishing features, training machine
learning models, validating their performance, and deploying them into user-friendly applications
for real-time disease detection.

The testing process for crop disease identification typically involves:

1.Data Collection: Gathering images or samples of diseased and healthy crops.

2.Preprocessing: Cleaning and preparing the data, which may involve resizing, cropping, and
enhancing images for better analysis.

3.Feature Extraction: Identifying distinguishing features or patterns in the images, such as color,
texture, or shape.

4.Model Training: Using machine learning or deep learning algorithms to train a model on the
extracted features, often using techniques like convolutional neural networks (CNNs).

5.Validation: Testing the trained model on a separate dataset to evaluate its performance and
fine-tune parameters if necessary.

6.Deployment: Implementing the model into a user-friendly application or platform for real-time
or near-real-time disease identification in crops.

Throughout the process, it's essential to iterate and refine the model based on feedback and new
data to improve accuracy and reliability.

Department of Product design and development, Contriver Page 25


CROP DISEASE IDENTIFICATION 2023-24

CHAPTER 7

RESULTS

FIG 7.1 BEFORE CROP DISEASE


( BACTERIAL LEAF BLIGHT)

FIG 7.2 BEFORE CROP DISEASE


( BROWN SPOT)

Department of Product design and development, Contriver Page 26


CROP DISEASE IDENTIFICATION 2023-24

FIG 7.3 OUTPUT

FIG 7.4 PRIDICTION

Department of Product design and development, Contriver Page 27


CROP DISEASE IDENTIFICATION 2023-24

FIG 7.5 ACCURACY

Department of Product design and development, Contriver Page 28


CROP DISEASE IDENTIFICATION 2023-24

CONCLUSION
In conclusion, crop disease identification using machine learning and image processing holds
immense potential for revolutionizing agricultural practices and mitigating the impact of diseases
on crop yields and food security. Through the integration of advanced technologies, such as
convolutional neural networks and image preprocessing techniques, these systems enable timely
and accurate detection of crop diseases based on visual symptoms captured in images. By
providing farmers and agricultural experts with actionable insights and recommendations for
disease management, these systems empower stakeholders to make informed decisions, optimize
resource allocation, and implement targeted interventions to protect crops and livelihoods.
However, while significant progress has been made in the development and deployment of crop
disease identification systems, challenges remain in ensuring scalability, accessibility, and
reliability in real-world agricultural settings. Addressing these challenges requires
interdisciplinary collaboration, stakeholder engagement, and ongoing research to enhance the
accuracy, efficiency, and usability of these systems. With continued innovation and investment,
crop disease identification using ML and image processing has the potential to significantly
improve agricultural productivity, resilience, and sustainability, thereby contributing to global
efforts to address food security challenges in the 21st century.

FUTURE ENHANCEMENT
Future enhancements in crop disease identification utilizing machine learning (ML) and image
processing technologies promise to revolutionize agricultural practices. ML algorithms, trained on
extensive datasets of crop images, can analyze visual cues and patterns to accurately diagnose
diseases. Through deep learning techniques, these algorithms can continuously improve their
accuracy, enabling faster and more precise identification of crop diseases than ever before.
Additionally, image processing techniques such as segmentation and feature extraction can further
enhance the analysis of crop images, isolating affected areas and extracting relevant information
for diagnosis. By combining ML and image processing, farmers can receive real-time insights into
the health of their crops, allowing for proactive disease management strategies and ultimately
leading to increased yields and sustainability in agriculture

Department of Product design and development, Contriver Page 29


CROP DISEASE IDENTIFICATION 2023-24

BIBILIOGRAPHY

[1]. R. I. L. Jayasooriya, Samantha Mathara Arachchi,"Rice Leaves Diseases Using Image


Processing".

[2]. Pranesh Kulkarni, Atharva Karwande, Tejas Kolhe, Soham Kamble, Akshay Joshi, Medha
Wyawahare,"Plant Disease Detection Using Image Processing and Machine Learning".

[3]. Monishanker,Ananya Sarkar,Habibullah Bahar,"PLANT DISEASE DETECTION BY


IMAGE PROCESSING: A LITERATURE REVIEW".

[4]. Wasswa Shafik,Ali Tufail,Abdallah Namoun, Liyanage Chandratilak De Silva, Rosyzie Anna
Awg, Haji Mohd Apong, "A Systematic Literature Review on Plant Disease Detection:
Motivations, Classification Techniques, Datasets, Challenges, and Future Trends".

[5]. P.Sobiyaa ,K.S. Jayareka, K. Maheshkumar, S. Naveena, Koppula Srinivas Rao,"Paddy disease
classification using machine learning technique".

[6]. Vasantha Sandhya Venu,S. Rama Krishna,Bejjam Kiranmai ,"Techniques for Rice Leaf
Disease Detection using Machine learning algorithms".

[7]. Lethcsmy Priya, Ignisha Rajathi G and Vedhapriyavadhana Rajamani , “Crop Disease
Detection and Monitoring System”, June 2020

[8].Tiago Domingues , Tomas Brandao and Joao C.Ferreira , “Machine Learing for Detection and
Prediction of Crop Diseases and Pests”(published September 2022)

Department of Product design and development, Contriver Page 30

You might also like