Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 74

IMAGE CLASSIFICATION USING DEEP LEARNING

A PROJECT REPORT

Submitted by

KANISH VISHNUBHAI PATEL

201130107029

In partial fulfilment for the award of the degree of

BACHELOR OF ENGINEERING

In

Computer Engineering

Sal College of Engineering ,Ahmedabad

Gujarat Technological University, Ahmedabad

May, 2024
Sal College of Engineering , Ahmedabad
Computer Engineering
Summer-2024

CERTIFICATE

This is to certify that the project report submitted along with the project entitled Image
Classification Using Deep Learning has been carried out by Patel Kanish Vishnubhai
(201130107029) under my guidance in Completion of Internship (3180701) degree of
Bachelor of Engineering in Computer Engineering, 8th Semester of Gujarat
Technological University, Ahmadabad during the academic year 2023-24.

Prof. Mikin Dagli Prof. Vijaysinh


Jadeja

Internal Guide Head of the


Department Department
Sal College of Engineering, Ahmedabad
Computer Engineering
Summar , 2024

DECLARATION

I hereby declare that the Internship report submitted along with the Internship entitled
Image Classification using Deep Learning submitted in partial fulfilment for the
degree of Bachelor of Engineering in Information Technology to Gujarat Technological
University, Ahmadabad, is a bonafide record of original project work carried out by me
at The Pioneer Tech Under the supervision Mr. Das Saurabh and that no part of this
report has been directly copied from any students’ report or taken from any other source,
without providing due reference.

Name of the Student Sign of


Student
Kanish Vishnubhai Patel

i
ACKNOWLEDGEMENT

I would like to express my sincere gratitude to several individuals for supporting


me throughout my internship project. First, I wish to express my sincere gratitude to my
Internal Guide, Prof. Vijaysinh Jadeja, for his enthusiasm, patience, insightful
comments, helpful information, practical advice and unceasing ideas that have helped me
tremendously at all times in my project. Without his support and guidance, this project
would not have been possible.

I would like to express my endless thanks to my external guide Mr. Das


Saurabh, at The Pioneer Tech. their sincere and dedicated guidance throughout the
project development.

I also wish to express my sincere thanks to Principal of Sal College of


Engineering, Prof. Vijaysinh Jadeja and to HOD of Computer Engineer Prof.
Vijaysinh Jadeja for providing the needful support throughout the timeline.
Additionally, I would acknowledge all the support staff and my friends for their constant
help and mental support.

ii
ABSTRACT

Image classification using deep learning has gained significant traction in


various domains, including agriculture, due potential for automating tasks
such as crop disease detection and treatment recommendation. In this study,
we propose a deep learning- based approach for the classification of images
depicting tomato, cotton, and corn leaf diseases.

Our methodology involves the development of a convolutional neural


network (CNN) architecture capable of effectively discerning between
healthy and diseased instances of these crops. Through extensive
experimentation and evaluation on a diverse dataset comprising annotated
images, we demonstrate the efficacy of our model in accurately identifying
and categorizing instances of tomato, cotton, and corn leaf diseases.
Furthermore, based on the identified diseases, we provide treatment
recommendations tailored to each crop's specific afflictions.

Our findings underscore the potential of deep learning techniques in aiding


agricultural decision-making processes, particularly in disease management
and crop health maintenance.

iii
LIST OF FIGURES

Figure No. Figure Description Page No.

Fig 2.4.1 Production Stages………........................................ 6

Fig 3.6.1 Modified Waterfall Model ………………………… 11

Fig 3.7.1 Gantt Chart……………………………………….. 12

Fig 4.5.1 User use case diagram ………………………... 16

Fig 4.6.1 Level 0 DFD Diagram ………………………….... 16

Fig 4.6.2 User level 1 DFD Diagram ………………….... 17

Fig 5.1.1 Modified Waterfall Mode ………………………... 20

Fig 5.4.1 Tomato Leaf Disease Classification……………... 23

Fig 5.4.2 Corn Leaf Disease Classification………………….. 23

Fig 5.4.3 Cotton Leaf Disease Classification…………………. 24

Fig 6.2.1 Data Augmentation………………......................... 28

Fig 6.2.2 Data Resize.…………………………...... 28

Fig 6.4.1 CNN model architecture…………………………… 29

Fig 6.4.2 Max pooling layer……………………………........... 30

Fig 6.4.3 Fully connected layer …………………………... 31

Fig 6.4.4 Model Architecture…………………………………... 32

iv
Fig 6.4.5 Model summary …………….……………… 33

Fig 6.5.1 Model fitting ………………………………. 35

Fig 6.5.2 Tomato leaf disease classification page ……... 35

Fig 6.5.3 Selection Tomato Image…………………….. 36

Fig 6.5.4 Show Upload Image ……………………….. 36

Fig 6.5.5 Classify image, confidence and suggest treatment … 37


Fig 7.4.1 Plotted the accuracy and loss for both train and validation 46
Fig 7.4.2 Uploaded image and the accuracy for tomato leaf disease 47
Fig 7.4.3 Plotted the accuracy and loss for both train and validation 43
Fig 7.4.4 Uploaded image and the accuracy for Corn leaf disease 43
Fig 7.4.5 Plotted the accuracy and loss for both train and validation 44
Fig 7.4.6 Uploaded image and the accuracy for cotton leaf disease 45

v
LIST OF TABLES

Table No. Table Name Page No.


Table 3.1.1 Project Summary ……......................................... 8

Table 3.5.1 Technologies Used to Develop Project ………... 10

Table 5.3.1 Leaf Dataset Collection …………………………. 22

Table 6.3.1 Tomato Dataset lengths for train, valid and test 29

Table 6.3.2 Corn Dataset lengths for train, valid and test …….. 29

Table 6.3.3 Cotton Dataset lengths for train, valid and test …... 29

Table 6.4.1 CNN model architecture………………………… 30

Table 6.4.2 Max pooling layer ……………………………… 31

Table 6.4.3 Fully connected layer …………………………….. 32

Table 6.4.4 Model Architecture ……………………………… 33

Table 6.4.5 Model summary…………………………………. 34

Table 6.5.1 Model fitting …………………………………….. 35

Table 7.4.1 Comparison of Loss and Accuracy for train and valid at 41
different epoch ……………………………………..

Table 7.4.2 Comparison of Loss and Accuracy for train and valid at 42
different epochs…………………………………….

Table 7.4.3 Comparison of Loss and Accuracy for train and valid at
different epoch……………………………………….
Table 8.3.1 Summary of internship…………………………. 56

vi
LIST OF SYMBOLS

vii
LIST OF ABBREVIATIONS

MPL Max Pooling layer

YLCV Yellow Leaf Curl Virus

EB Early Bligh

BB Bacterial Blight

LB Late Blight

CV Curl Virus

IC Image Classification
DL Deep Learing

viii
TABLE OF CONTENTS

Acknowledgement………………………………………………………… I

Abstract………………………………………………………………….... II

List of Figures…………………………………………………………….. III

List of IV

Tables……………………………………………………………… List V

of Symbols and Abbreviation……………………………………….. VI

Table of

Contents………………………………………………………….

Chapter 1 1.0 Overview of the Company…………………………….. 1


1.1 History……………………………………………... 2
1.2 Different Products………………………………….. 2

Chapter 2 2.0 Overview of Company Department …………………. 3

2.1 All Departments…………………………………… 4

2.2 Technical Specifications in Department……………. 4

2.3 Sequence of Operators…………………………….. 5

2.4 Product Stages……………………………………… 6

Chapter 3 3.0 Introduction to Internship……………………………. 7

3.1 Internship Project Summary ……………………….. 8

3.2 Purpose…………………………………………...... 9

3.3 Scope…………………………………………...….. 9

3.4 Objective…………………………………………... 9

3.5 Technology and Literature Review………………... 10


3.6 Planning………………………………………...…. 10
ix
3.7 Scheduling………………………………………….
14

x
Chapter 4 4.0 System Analysis……………………………………….. 15
4.1 Study of Current System…………………………… 16

4.2 Weaknesses of Current System…………………….. 16

4.3 Requirements of New System……………………… 17

4.4 Feasibility Study………………………………….… 18

4.5 Use Case Diagram………………………………….. 19

4.6 Data Flow Diagram……………………………….. 22

4.7 List of Main Modules …………….………………... 23

4.8 Features of New System……………………………. 23

4.9 Selection of Hardware and Software ………………. 24

Chapter 5 5.0 System Design…………………………………………. 25


5.1 System Design & Methodology……………………. 26
5.2 Database Design……………………………………. 28

5.3 Interface Design……………………………………. 33

Chapter 6 6.0 Implementation……………………………………….. 38

6.1 Implementation platform…………………………… 39


6.2 Module Specifications……………………………… 40

6.3 Output Screenshots…………………………………. 41

Chapter 7 7.0 Testing…………………………………………………. 46

7.1 Testing Plan ………………………………………... 47

7.2 Testing Strategy…………………………………….. 48

7.3 Testing Cases……………………………………….. 49

Chapter 8 8.0 Conclusion and Discussion…………………………… 53

8.1 Overall Analysis of Internship…………………….. 54

xi
Chapter9 9.0 Limitation and Future Work……………………….. 58
References ………………………………………………………………... 60

xii
Project ID: 421735 Overview of The Company

Chapter

1
=============================================================

1. OVERVIEW OF THE COMPANY


=============================================================

History

Different Products
=============================================================

Gujarat Technological University 1 SCE, Ahmedabad


Project ID: 421735 Overview of The Company

OVERVIEW OF THE COMPANY


The Pioneer Tech

History

Since 2006, Pioneer Tech has been at the forefront of enterprise IT solutions,
specializing in website development, custom software solutions, and Google
promotion.

Different Products / Scope of Work

Pioneer Tech offers a range of services including website development, custom


software solutions, Google promotion, E-commerce portal development, domain
registration, payment gateway integration, and server management.

Organization Chart

Pioneer Tech operates with a highly skilled team proficient in website development, AI
ML, data analytics, and graphics design.

Capacity of Plant

While Pioneer Tech primarily operates in the digital realm, its capacity extends to
serving clients across various industries and fulfilling their IT needs effectively.

Gujarat Technological University 2 SCE, Ahmedabad


Project ID: 421735 Overview of The Company Department

Chapter

2
=============================================================

2. OVERVIEW OF THE COMPANY


DEPARTMENT
=============================================================

All Departments

Technical Specifications in department

Sequence of operators

Product stages
=============================================================

Gujarat Technological University 3 SCE, Ahmedabad


Project ID: 421735 Overview of The Company Department

OVERVIEW OF THE COMPANY DEPARTMENT

2.1 All departments

 HR Department
 Sales Department
 Development Department
 Testing Department

2.2 Technical specifications in department

● HR Department
A HR department is tasked with maximizing employee productivity and
protecting the company from any issues that may arise within the
workforce. HR responsibilities include compensation and benefits,
recruitment, firing, and keeping up to date with any laws that may affect
the company and its employees.

● Sales Marketing Department


A sales and marketing department has the responsibility for deciding
where the company should sell and what its prices should be. it’s designed
to make the life of you and your field sales team easier while increasing
productivity and performance.

● Development Department
A Development department in different department like Web
Development, Android Development, iOS Development, UI/UX Design,
etc. Web development services help create all types of web-based software
and ensure great experience for web users.

Gujarat Technological University 4 SCE, Ahmedabad


Project ID: 421735 Overview of The Company Department

Android app development services comprise design,


development, and enhancement of mobile software that runs on all
supported Android OS versions. iOS developer is responsible for
developing applications for mobiledevices powered by Apple's iOS
operating system.

UI/UX design department focus on creating seamless and engaging


designs that align with each operating system's principles.

Testing Department

Testing is the process of evaluating a system or its component(s) with the


intent to find whether it satisfies the specified requirements or not. In
simple words, testing is executing a system in order to identify any gaps,
errors, or missing requirementsin contrary to the actual requirements.

2.3 Sequence of operators

The Pioneer Tech follows a systematic approach across its departments. The
HR team focuses on recruitment, onboarding, and resource allocation. Sales
engages with clients, generates proposals, and negotiates contracts.

Designing team collaborates with clients and internal teams for requirement
analysis and iterative design.

Development team receives project requirements, allocates tasks to specialized


teams, and executes coding and integration.

Testing team ensures quality through comprehensive testing, bug reporting,


and user acceptance testing.

This structured sequence ensures a cohesive workflow from client interaction


to the delivery of high-quality products.

Gujarat Technological University 5 SCE, Ahmedabad


Project ID: 421735 Overview of The Company Department

2.4 Product stages

Fig 2.4.1 Production Stage

Gujarat Technological University 6 SCE, Ahmedabad


Project ID: 421735
Introduction to Internship

Chapter

3
=============================================================

3. INTRODUCTION TO INTERNSHIP
=============================================================

Project

Summary

Purpose

Objective

Scope

Technology and Literature Review

Planning

Scheduling
=============================================================

Gujarat Technological University 7 SCE , AHMADABAD


Project ID: 421735
Introduction to Internship

INTRODUCTION TO INTERNSHIP

3.1 Project Summary

Table 3.1.1: Project Summary

Project Title Image Classification Using Deep Learning

The main aim of this project is to develop a deep


learning-based image classification system capable
of accurately identifying and categorizing diseases
affecting tomato, cotton, and corn crops.
Aim
Additionally, the system aims to provide targeted
treatment recommendations for each identified
disease, thereby assisting farmers in promptly
addressing crop health issues and improving
agricultural productivity.

Developed At The Pioneer Tech.

Project Category Computer Vision


Visual Studio Code,
IDE Google Colab
Python
Tools Languages/Frameworks
(TensorFlow,
Matplotlib,
Streamlit)

Dataset PlantVillage

Duration 12 Weeks (January 2024 to April 2024)

Gujarat Technological University 8 SCE , AHMADABAD


Project ID: 421735
Introduction to Internship

3.1Purpose

The purpose of this project is to leverage advanced deep learning techniques to


develop a robust image classification system capable of identifying common diseases
affecting tomato, cotton, and corn crops. By accurately classifying these diseases, the
project aims to assist farmers and agricultural professionals in swiftly detecting and
diagnosing crop health issues. Additionally, the project seeks to provide actionable
treatment recommendations tailored to each identified disease, thereby aiding in the
efficient management of crop diseases and promoting higher yields and sustainable
agricultural practices.

3.2Objective

The main objective of our project is Develop a user-friendly interface for farmers and
agricultural practitioners to easily upload images, receive disease classification results, and
access corresponding treatment advice.
1. Develop a comprehensive dataset consisting of annotated images depicting various
diseases affecting tomato, cotton, and corn crops.
2. Design and implement a convolutional neural network (CNN) architecture
optimized for multi-class classification of crop diseases.
3. Train the CNN model on the dataset to achieve high accuracy in distinguishing
between healthy and diseased instances of tomato, cotton, and corn plants.
4. Develop a user-friendly interface for farmers and agricultural practitioners to easily
upload images, receive disease classification results, and access corresponding treatment
advice.

3.2 Scope

The Scope of this project The developed deep learning model can be extended to
include more crop varieties beyond tomato, cotton, and corn, enabling broader coverage of
agricultural diseases and supporting a wider range of farmers and crops.

Gujarat Technological University 9 SCE , AHMADABAD


Project ID: 421735
Introduction to Internship

3.3 Technology and Literature Review

Table 3.5.1 Technologies Used to Develop Project

Front End Streamlit

Back End Python (NumPy, TensorFlow, Matplotlib)

Dataset Plant Village

3.4 Planning

3.4.1 Internship Development Approach and Justification

1. Define Project Goals and Requirements:


● Clearly define the goals and objectives of the resume analyzer project.
Determine the specific functionalities, features, and performance
requirements expected from the analyzer.
● Identify the target audience and their needs to ensure the resume analyzer
meets their expectations.
2. Gather and Prepare Data:
● Collect a diverse set of resume data for training and testing the analyzer.
Ensure the data represents different industries, roles, and levels of
experience.
● Preprocess the data by cleaning and normalizing it, removing unnecessary
information, and standardizing the format to ensure consistency.
3. Design the System Architecture:
● Determine the overall system architecture and components required for the
resume analyzer. This may include modules for data parsing, keyword
matching, semantic analysis, and evaluation.
● Decide on the appropriate technologies, frameworks, and programming
languages that align with the project requirements.

MODIFIED WATERFALL MODEL:

The waterfall model is a sequential design process, often used in software development
processes, in which progress is seen as following steadily downwards (like a waterfall)
through the phases of conception, initiation, design, analysis, construction, testing,
production/implementation, and maintenance.

Gujarat Technological University 10 SCE , AHMADABAD


Project ID: 421735
Introduction to Internship

Fig 3.6.1 Modified Waterfall Model .

Why did we use the waterfall model?

✔ The advantage of waterfall development is that it allows


for departmentalization and control.
✔ A schedule can be set with deadlines for each stage of development and a
product can proceed through the development process model phases one by
one.

✔ Development moves from concept, through design, implementation, testing,


✔ installation, troubleshooting, and ends up at operation and
maintenance. Each phase of development proceeds in strict order.

3.4.2 Roles and Responsibilities

Product Owner

Product is the representative of the stakeholders and customers who use the
software. They focus on the business part and is responsible for the ROI of the
project. They translate the vision of the project to the team, validate the
benefits in stories to be incorporated into the Product Backlog and prioritize
them on a regular basis.

Team
A group of professionals with the necessary technical knowledge who develop

Gujarat Technological University 11 SCE , AHMADABAD


Project ID: 421735
Introduction to Internship
the project jointly carrying out the stories they commit.

Gujarat Technological University 12 SCE , AHMADABAD


Project ID: 421735
Introduction to Internship

3.5 Scheduling

Week 1 2 3 4 5 6 7 8 9 10 11 12 13

January February March April

Planning and
Research
Design and
Architecture

Backend Development

Testing and
Quality Assurance
Optimization and
Deployment
Documentation and
Training

Project Handover

Fig 3.7.1 Gantt Chart

The scheduling of our project is shown in the above timeline chart where we can see tasks which we
had done in this semester like problem identification, Project definition, Requirement gathering,
Analysis and design. Then at which date start and finish the particular task. How much duration
required for the task completion and finally all the dates at which we had done the particular task.

Gujarat Technological University 13 SCE , AHMADABAD


System Analysis
Project ID: 421735

Chapter

4
=============================================================

4 SYSTEM ANALYSIS
=============================================================

Study of Current System

Weakness of Current System

Requirement of New System

Feasibility Study

Use case Diagram

Data flow Diagram

List of main Modules

Features of New System

Selection of Hardware and Software


=============================================================

Gujarat Technological University 14 SCE, Ahmedabad


System Analysis
Project ID: 421735

SYSTEM ANALYSIS

4.1 Study of Current System

 Manual Inspection: Currently, farmers rely primarily on manual inspection to detect


crop diseases, which is time-consuming and prone to human error.
 Limited Accessibility to Expertise: Access to agricultural experts for disease
diagnosis and treatment recommendations is often limited, particularly in remote or
rural areas.
 Reliance on Traditional Methods: Many farmers still rely on traditional methods such
as visual observation and symptom recognition, which may not be accurate or reliable
for early disease detection.
 Challenges in Disease Identification: Identifying crop diseases accurately can be
challenging, especially for inexperienced farmers or those lacking access to
comprehensive disease databases and reference materials.

4.2 Weakness of Current System


● Subjectivity in Diagnosis: Manual inspection methods rely on subjective interpretation
of symptoms, leading to inconsistencies in disease diagnosis and treatment decisions.

● Limited Coverage: Accessibility to agricultural experts is restricted, particularly in


remote areas, resulting in inadequate disease diagnosis and treatment support for
farmers.

● Delayed Detection: Manual inspection processes are time-consuming, leading to


delayed disease detection and allowing infections to spread rapidly, causing significant
crop damage.

● Dependency on Expertise: Farmers with limited agricultural knowledge may struggle


to accurately identify crop diseases, exacerbating the risk of misdiagnosis and
ineffective treatment.

4.3 Requirement of Current System


● Accuracy: The new system should offer high accuracy in disease detection to ensure
reliable diagnosis and effective management strategies.

● Accessibility: The system should be accessible to farmers and agricultural


Gujarat Technological University 15 SCE, Ahmedabad
System Analysis
Project ID: 421735
practitioners, including those in remote or underserved areas, through user-friendly
interfaces and mobile applications.

Gujarat Technological University 16 SCE, Ahmedabad


System Analysis
Project ID: 421735

4.4 Feasibility Study


Table: 4.4.1 Activity of Proposed System

Title Date Status

Planning and Research 15/01/2024 to 19/01/2024 Completed

Design and Architecture 20/01/2024 to 24/01/2024 Completed

Data Gathering &


25/01/2024 to 29/01/2024 Completed
Requirement Analysis

Design Diagrams 30/01/2024 to 03/02/2024 Completed

Data Dictionary 04/02/2024 to 05/02/2024 Completed

Database, Stored Procedure 06/02/2024 to 16/02/2024 Completed

Template Design, Reports 17/02/2024 to 29/02/2024 Completed

Coding/Implementation 01/03/2024 to 04/03/2024 Completed

Change Detection 05/03/2024 to 12/03/2024 Completed

Testing 13/03/2024 to 15/03/2024 Completed

Referencing the change 16/03/2024 to 22/03/2024 Completed

Gujarat Technological University 17 SCE, Ahmedabad


System Analysis
Project ID: 421735

4.5 Use Case Diagram

● User/farmer Use Case Diagram:

Fig 4.5.5 user Use case diagram

4.6 Data Flow Diagram

● Level 0 DFD Diagram:

Fig 4.6.1 Level 0


DFD Diagram

Gujarat Technological University 18 SCE, Ahmedabad


System Analysis
Project ID: 421735

● User Level 1 DFD Diagram:

Fig 4.6.2 user Level 1 DFD Diagram

4.7 List of Modules

● System consists mainly one main modules:


i. User (Farmer)

4.8 Selection of Hardware and Software


● Hardware
o Development Machine Requirement (Average performance)
▪ 12GB RAM
▪ 100 GB SSD
▪ T4 GPU
▪ Internet
o Client Machine Requirement
▪ 4 GB RAM
▪ 5 GB of HDD space
▪ Network related tools
o Host Machine Requirement

Gujarat Technological University 19 SCE, Ahmedabad


System Analysis
Project ID: 421735

▪ 32 GB RAM
▪ 500 GB of HDD space
▪ Network related tools
● Software
o Development Machine Requirements
▪ Python (NumPy, pandas, matplotlib, PIL, TensorFlow, Streamlit)
▪ Google Colab
▪ Browser
▪ Visual Studio Code
o Client Machine Requirements
▪ Browser with Internet Connectivity
o Host Machine Requirements
▪ Python (NumPy, pandas, matplotlib, PIL, TensorFlow, Streamlit)
▪ Browser with Internet Connectiviry

Gujarat Technological University 20 SCE, Ahmedabad


Project ID: 421735
System Design

Chapter

5
=============================================================

5 SYSTEM DESIGN
=============================================================

System Design and Methodology


Dataset Collection
Interface Design

============================================================

Gujarat Technological University 21 SCE, Ahmedabad


Project ID: 421735
System Design

SYSTEM DESIGN

5.1 System Design and Methodology


The modified waterfall model is an adaptation of the traditional waterfall
model, which is a sequential software development process model. The
modified waterfall model introduces certain iterative elements to address
some of the limitations of the traditional waterfall model, such as the lack
of flexibility once the development process has progressed past a certain
stage. Here's an overview of the modified waterfall model with a focus on
system design and methodology:

Fig 5.1.1 Modified Waterfall Model .

Modified Waterfall Methodology & Process


Requirements Gathering: This phase remains similar to the traditional
waterfall model. The requirements for the system are gathered from
stakeholders and documented thoroughly.

Gujarat Technological University 22 SCE, Ahmedabad


Project ID: 421735
System Design

System Design: In the modified waterfall model, the system design phase
incorporates some iterative elements. Initially, high-level system
architecture and design are created based on the gathered requirements.

After the initial design phase, there could be a prototype or proof-of-


concept stage where key design aspects are prototyped or validated with
stakeholders.

Feedback from stakeholders and initial testing may lead to adjustments or


refinements in the design before moving forward.

Implementation: Once the system design is finalized, implementation


begins. This phase involves writing code, integrating components, and
building the system according to the design specifications.

While the implementation phase is still predominantly linear, there may be


iterative cycles within this phase for incremental development or to
accommodate changes identified during testing.

Feedback from testing is used to refine the system design and


implementation. This feedback loop ensures that issues are addressed early
in the development process.

Testing: Testing in the modified waterfall model occurs at various levels


throughout the development process. Unit testing, integration testing, and
system testing are performed as components are developed and integrated.

Deployment and Maintenance: Once testing is complete and the system


meets the acceptance criteria, it is deployed to the production environment.

Maintenance activities, including bug fixes, updates, and enhancements,


continue after deployment. Feedback from users and ongoing testing may
result in further iterations and refinements to the system.

Gujarat Technological University 23 SCE, Ahmedabad


Project ID: 421735
System Design

5.2 Dataset Collection

The dataset collection process involves gathering a comprehensive and diverse set of
annotated images depicting tomato, cotton, and corn leaf diseases. This entails
collaborating with agricultural research institutions, farming communities, and data
providers to acquire high-quality images representing various disease types, stages, and
environmental conditions. Additionally, manual collection efforts may be undertaken to
supplement existing datasets and ensure adequate coverage of relevant diseases.
Emphasis is placed on inclusivity, ensuring representation across different geographical
regions, crop varieties, and cropping systems.

5.3 Dataset Collection Table

Table 5.3.1 Leaf Dataset Collection

S.NO Type of leaf disease No. of images

1 Tomato_Early_blight 1000

2 Tomato_Late_blight 1649

3 Tomato Tomato_YellowLeaf Curl_Virus 1744

4 Tomato_healthy 1591

5 Cotton_bacterial_blight 1325

6 Cotton_curl_virus 1400

7 Cotton_fussarium_wilt 1271

8 Cotton_healthy 1589

9 Corn_Blight 1600

10 Corn_Common_Rust 1478

11 Corn_Gray_Leaf_Spot 1386

12 Corn_Healthy 1256

Gujarat Technological University 24 SCE, Ahmedabad


Project ID: 421735
System Design

5.4 Interface Design

Fig 5.4.1 Tomato Leaf Disease Classification

Description: Tomato Leaf Disease Classification: Farmer can upload a tomato


leaf image and classification of disease farmer can upload image to already
clicked image or real time click image throw camara.

Fig 5.4.2 Corn Leaf Disease Classification

Description: Corn Leaf Disease Classification: Farmer can upload a corn leaf
image and classification of disease farmer can upload image to already clicked
image or real time click image throw camara.

Gujarat Technological University 25 SCE, Ahmedabad


Project ID: 421735
System Design

Fig 5.4.3 Cotton Leaf Disease Classification

Description: Cotton Leaf Disease Classification: Farmer can upload a Cotton leaf
image and classification of disease farmer can upload image to already clicked
image or real time click image throw camara.

Gujarat Technological University 26 SCE, Ahmedabad


Project ID: 421735 Implementation
201130107029

Chapter

6
==============================================================

6. IMPLEMENTATION
==============================================================

Implementation Platform
Data Preprocessing
Dataset Split
CNN Model Architecture
Model Training
Output Screenshot
==============================================================

Gujarat Technological University 27 SCE, Ahmedabad


Implementation
Project ID: 421735

IMPLEMENTATION

6.1 Implementation Platform

● Google Colab

Google Colab, short for Google Colaboratory, is a cloud-based platform


provided by Google that allows users to write and execute Python code in a
collaborative environment. It offers free access to computing resources,
including GPUs and TPUs, enabling users to run machine learning and deep
learning experiments without the need for expensive hardware.

For the "Image Classification" project, Google Colab provides an ideal


environment for developing and training deep learning models. Here's a
short note on how Google Colab can be utilized for this project.

Free Access to GPU/TPU: Google Colab provides free access to GPU and
TPU resources, which are essential for training deep learning models
efficiently, especially for image classification tasks like leaf disease
classification.

● Visual Studio Code

Visual Studio Code, also commonly referred to as VS Code is a source-


code editor made by Microsoft for Windows, Linux and MacOS. Features
include support for debugging, syntax highlighting, intelligent code
completion, snippets, code refactoring, and embedded Git. Users can
change the theme, keyboard shortcuts, preferences, and install extensions
that add additional functionality.

In the Stack Overflow 2021 Developer Survey, Visual Studio Code was
ranked the most popular developer environment tool, with 70% of 82,000
respondents reporting that they use it.

● Git & GitHub


Working with Git and other SCM providers has never been easier. Review
different, stage files, and make commits right from the editor. Push and pull

Gujarat Technological University 28 SCE, Ahmedabad


Implementation
Project ID: 421735

from any hosted SCM service. It provides Version Control, and


Collaboration and Documentation.

● Deploy with confidence and ease


Streamlit is an excellent choice for deploying the "Tomato Leaf Disease
Classification" project for several reasons:

Ease of Use: Streamlit allows developers to create interactive web applications


directly from Python scripts with minimal code, making it accessible even to
those with limited web development experience.

Rapid Development: With Streamlit's intuitive API and interactive widgets,


developers can quickly prototype and iterate on their web applications, reducing
development time and effort.

Sharing and Collaboration: Streamlit applications can be easily deployed to


the web and shared with others using a simple URL, facilitating collaboration
between team members and enabling stakeholders to access and interact with
the deployed model from anywhere.

6.2 Data Preprocessing


Before training the CNN model, the dataset was preprocessed using several
techniques such as data augmentation, normalization, and resizing. Data
Augmentation is a very popular technique in image processing, especially
computer vision to increase the diversity and amount of training data by applying
random (but realistic) transformations. Data augmentation techniques such as
rotation, flipping (horizontal and vertical), and random cropping were applied to
increase the size of the dataset and introduce more variability in the data.

Normalization was applied to scale the pixel values between 0 and 255 to
improve the convergence of the model during training.

Gujarat Technological University 29 SCE, Ahmedabad


Implementation
Project ID: 421735

Fig 6.2.1 Data Augmentation

Resizing was also applied to standardize the image size to 256x256 pixels to reduce
the computational cost of training the mode and also send the images as batches as
the batch size is 32.

Fig 6.2.2 Data Augmentation

6.3 Dataset Split


To evaluate the performance of the CNN model, the dataset was split into three
subsets, namely the training dataset, validation dataset, and test dataset. The training
dataset was used to train the model, the validation dataset was used to tune the
hyperparameters, and the test dataset was used to evaluate the performance of the
model on unseen data.

Normalization The dataset was split randomly into the three subsets, with the
training dataset containing 80% of the images, the validation dataset containing 10%
of the images, and the test dataset containing 10% of the images. Table 2 shows the
dataset lengths for the train, validation, and test datasets.

Gujarat Technological University 30 SCE, Ahmedabad


Implementation
Project ID: 421735

Fig 6.2.3 Spiting dataset

Table 6.3.1 Tomato Dataset lengths for train, valid and test
Train dataset length 149
Valid dataset length 18
Test dataset length 20
Total dataset length 149+18+20 = 187

Table 6.3.2 Corn Dataset lengths for train, valid and test
Train dataset length 112
Valid dataset length 14
Test dataset length 14
Total dataset length 112+14+14 = 140

Table 6.3.3 Cotton Dataset lengths for train, valid and test
Train dataset length 125
Valid dataset length 15
Test dataset length 17
Total dataset length 125+15+17 = 156

The dataset split ensures that the model is trained on a sufficiently large dataset
while also allowing for a fair evaluation of its performance on unseen data.

Gujarat Technological University 31 SCE, Ahmedabad


Implementation
Project ID: 421735

6.4 CNN Model Architecture


A Convolutional Neural Network (CNN) is a type of artificial neural network
commonly used for image and video analysis, recognition, and processing. It is
designed to automatically extract meaningful features from raw pixel data of an
image, enabling it to recognize objects, faces, shapes, and patterns.

CNNs are inspired by the structure and function of the visual cortex in the brain.
The network is made up of a series of interconnected layers, each consisting of
several neurons that perform simple computations on the input data. The layers are
typically arranged in a specific order, including convolutional layers, pooling
layers, and fully connected layers. The following fig shows the CNN model
architecture with properly connected layers.

Fig 6.4.1 CNN model architecture

Convolution Layer

Convolutional layers are the core building blocks of a CNN. They apply filters or
kernels to the input image, sliding over the entire image and performing a dot
product between the filter and the input pixels. This process generates a feature
map, highlighting the regions of the input image that are most important for
recognizing a particular pattern or object.

Gujarat Technological University 32 SCE, Ahmedabad


Implementation
Project ID: 421735

Pooling Layers

Pooling layers are an essential component of Convolutional Neural Networks


(CNNs) used in computer vision applications. They are used to reduce the spatial
dimensionality (width and height) of the input data while retaining its essential
features.

Max pooling is a commonly used type of pooling layer in which the maximum
value within a defined region of the input feature map is selected and then passed on
to the next layer.
For example, let's say we have an input feature map with a size of 6x6 and a pooling
window size of 2x2. The max pooling operation would take place as follows:

1. The input feature map is divided into non-overlapping regions of size 2x2.
2. The maximum value within each region is identified.
3. A new feature map is created with a size of 3x3, consisting of the maximum
values from each region.

Fig 6.4.2 Max pooling layer

Pooling Layers
Fully connected input layer – The preceding layers' output is
"flattened" and turned into a single vector which is used as an input for
the next stage.
The first fully connected layer – adds weights to the inputs from the feature
analysis to anticipate the proper label.

Gujarat Technological University 33 SCE, Ahmedabad


Implementation
Project ID: 421735
Fully connected output layer – offers the probability for each label in the end.

Gujarat Technological University 34 SCE, Ahmedabad


Implementation
Project ID: 421735

Fig 6.4.3 Fully connected layer

Softmax Activation Function

The softmax activation function is a mathematical function that is commonly used


in artificial neural networks, particularly in multi-class classification problems. It is
used to produce a probability distribution over the possible classes in the output
layer of a neural network.

Summary of The CNN Model

The construction of a Convolutional Neural Network (CNN) model with multiple


levels, each consisting of convolution layers and max pooling layers. The model has
six levels with decreasing output shape reduction, and the input data is sent as

Gujarat Technological University 35 SCE, Ahmedabad


Implementation
Project ID: 421735

batches with a batch size of 32. The convolution layers have 32, 64, 64, 64, 64, and
64 filters, respectively, with a kernel size of 3x3 and ReLU activation. Each
convolution layer is followed by a max pooling layer with a pool size of 2x2. The
output shape of each layer is calculated based on the input size, kernel size,
padding, and stride. The output parameters of each convolution layer are calculated
based on the kernel filter size, number of filters, and number of previous filters,
while the output parameters of the dense layer are based on the input and output
channel numbers.

The data is given format as following way are :

Fig 6.4.4 Model Architecture

Fig 6.4.4 Model Architecture

Gujarat Technological University 36 SCE, Ahmedabad


Implementation
Project ID: 421735

Fig 6.4.5 model summary

Gujarat Technological University 37 SCE, Ahmedabad


Implementation
Project ID: 421735

Fig 6.4.5 model summary

6.5 Model Training


The training process involves initializing the model parameters, defining the
loss function, selecting an optimization algorithm, and iteratively updating the
model parameters using backpropagation and gradient descent. It discuss step-by-
step process involved in training a neural network:

1. The first step in the training process is loading and preprocessing the training
data. This involves normalizing the data, splitting it into batches, and
converting it into the appropriate format for the model.
2. The second step in the training process is defining the model architecture. This
step involves specifying the neural network's architecture, including the
number and type of layers, activation functions, optimizer, and loss function.
The architecture of the CNN model is discussed in section 6.4.
3. The third step in the training process is compiling the model. This step
involves configuring the model for training by specifying the optimizer, loss
function, and any additional metrics to track during training. The Adam
optimizer and Sparse Categorical Cross entropy loss function are discussed in
current chapter.
4. The final step in the training process is training the model. This step involves
Gujarat Technological University 38 SCE, Ahmedabad
Implementation
Project ID: 421735

feeding the training data into the model, computing the output, and adjusting the
model parameters using the Adam optimizer algorithm to minimize the loss function.
The number of training epochs determines how many times the entire training dataset
is used to train the model. The trained model is used for testing on the test set in the
next chapter.

Fig 6.5.1 Model fiting

After trained CNN model saved with saved_model.h5, at the time of predicting an image
reload it and do predictions. In this project, the interface designed a dynamic path for image
predictions using a web interface page, a web page with an interface that allows end- users to
select images of their choice and perform predictions on them.

6.6 Output Screenshot

Gujarat Technological University 39 SCE, Ahmedabad


Implementation
Project ID: 421735

Fig 6.4 Tomato leaf disease classification page

Description: Tomato leaf disease classification: This is by default page of a


website farmer can classify the tomato leaf disease .

Fig 6.5.2 SelectionTomato Image

Description: When you click on the browse files page then it’s automatically redirect
to the our file explorer page and then you need to select your resume in the pdf format
and then it’s attach with the below of this selector.

Gujarat Technological University 40 SCE, Ahmedabad


Implementation
Project ID: 421735

Fig 6.5.3 Show Upload Image

Description: After the upload the Image from the file explorer then it’s show the
image and after you can classify .

Fig 6.5.4 classify image, confidence and suggest treatment

Description: When you click on the classify button then it’s classify tomato leaf
disease and provide a confidence of the disease and after that suggest a treatment of
that disease.

Gujarat Technological University 41 SCE, Ahmedabad


Testing
Project ID: 421735

Chapter

7
==============================================================

7 TESTING
==============================================================

Testing Plan
Testing
Strategy Testing
Methods
Testing Cases

==============================================================

Gujarat Technological University 42 SCE, Ahmedabad


Testing
Project ID: 421735

TESTING

7.1 Testing Plan


A test plan is the cornerstone of a successful testing implementation.
The testing plan represents the overall approach to the test. In many ways, the test plan
serves as a summary of the test activities that will be performed. It shows how the tests
will be organized, and outlines all of the tester’s needs that must be met in order to
properly carry out the test.

The goal of test planning is to establish the list of tasks that, if performed, will identify all
of the requirements that have not been met in the software. There are many standards that
can be used for developing test plans. Early in the deployment planning phase, the testing
effort, and identifies the methodology that your team will use to conduct tests. It also
identifies the hardware, software, and tools required for testing and the features and
functions that will be tested. A well-rounded test plan notes any risk factors that
jeopardize testing and includes a testing schedule. So I can say that Test Planning details
the activities, dependencies and effort required to conduct the system test.

7.2 Testing Strategy


The test strategy is a formal description of how a software product
will be tested. A test strategy is developed for all levels of testing, as required. The test
team analyzes the requirements, writes the test strategy and reviews the plan with the
project team. The test plan may include test cases, conditions, and the test environment, a
list of related tasks, pass/fail criteria and risk assessment.

The purpose of the testing strategy is to define the overall context for the entire testing
process. The process is different depending on the specific characteristics of your
solution. In many respects, this is the most important part of the testing process, since all
future testing decisions will be made within the context of the strategy. As a programmer,
we have to just do unit testing which is a part of White Box testing. Other type of testing
in each phase of the software is done by the testing department.

Gujarat Technological University 43 SCE, Ahmedabad


Testing
Project ID: 421735

7.3 Testing Methods

Unit Testing
Unit testing is a software development process in which the smallest testable parts of an
application, called units, are individually and independently scrutinized for proper
operation. Unit testing is often automated but it can also be done manually.

Unit testing involves only those characteristics that are vital to the performance of the unit
under test. This encourages developers to modify the source code without immediate
concerns about how such changes might affect the functioning of other units or the most
efficient and error-free manner possible, larger components of the program can be
evaluated by means of integration testing.

The unit test verifies that the requirements are being met. The unit testing generally tests
two types of requirements.

1) User requirements: - User requirements typically specify some combination of


function, performance, data,and workflow. A general template for this can be illustrated
as: The user typically thinks in terms of the user interface, clicking on a button that does
something, and having the user interface change as a result. The user also specifies the
data, from the presentation level perspective. The program implements this workflow by
decomposing it into a set of functions, again, often functions familiar to the customer.
Unit testing of the customer requirements therefore consists of several things, each at a
different quantization. From bottom up: Testing each function, Testing each process, and
Testing the workflow.

2) Implementation requirements: - During the design/implementation phase, what’s


really going on is that the the programmer is translating the customer requirements to
schema and implementations. The following is a rough idea of this concept.
● Translating between user data presentation to more optimal internal data
presentation.

Gujarat Technological University 44 SCE, Ahmedabad


Testing
Project ID: 421735

● Translating functions into objects.


● Translating data store into schema.

7.4 Testing Cases


Testing: - Software testing is a critical element of software quality assurance and
represents the ultimate review or specification, design and code generation.
Test Case 1 (Tomato Leaf Disease):

CNN model was trained at 10epochs, 20 epochs and 50epochs.

Table 7.4.1 Comparison of Loss and Accuracy for train and valid at different epochs.
S. No. of Train Train Valid Accuracy Valid
No eporchs Accuracy Loss Loss
1 10 0.91 0.22 0.87 0.26

2 20 0.94 0.15 0.94 0.13

3 50 0.98 0.05 0.98 0.04

Figure 7.4.1 Plotted the accuracy and loss for both train and validation

Gujarat Technological University 45 SCE, Ahmedabad


Testing
Project ID: 421735

Figure 7.4.2 uploaded image and the accuracy for tomato leaf disease

Test Case 2 (Corn Leaf Disease):

Table 7.4.2 Comparison of Loss and Accuracy for train and valid at different epochs.
S. No .of Train Train Valid Valid
No eporch Accuracy Loss Accuracy Loss
s
1 10 0.86 0.34 0.85 0.36

2 20 0.92 0.22 0.91 0.24

3 50 0.95 0.08 0.94 0.09

Gujarat Technological University 46 SCE, Ahmedabad


Testing
Project ID: 421735

Figure 7.4.3 Plotted the accuracy and loss for both train and validation

Figure 7.4.4 uploaded image and the accuracy for Corn leaf diseas

Gujarat Technological University 47 SCE, Ahmedabad


Testing
Project ID: 421735

Test Case 3 (Cotton Leaf Disease):

CNN model was trained at 10epochs, 20 epochs and 50epochs.

Table 7.4.3 Comparison of Loss and Accuracy for train and valid at different epochs.
S. No.of eporchs Train Accuracy Train Loss Valid Accuracy Valid Loss
No

1 10 0.89 0.23 0.86 0.27

2 20 0.92 0.15 0.91 0.13

3 50 0.95 0.03 0.94 0.04

Figure 7.4.5 Plotted the accuracy and loss for both train and validation

Gujarat Technological University 48 SCE, Ahmedabad


Testing
Project ID: 421735

Figure 7.4.6 uploaded image and the accuracy for cotton leaf diseas

Gujarat Technological University 49 SCE, Ahmedabad


Project ID: 421735 Conclusion and Discussion

Chapter

8
==============================================================

8 CONCLUSION AND DISCUSSION


==============================================================

CONCLUSION

=============================================================
=

Gujarat Technological University 53 SCE, Ahmedabad


Project ID: 421735 Conclusion and Discussion

CONCLUSION

In conclusion, image classification using deep learning has demonstrated remarkable


effectiveness in various applications, ranging from medical diagnosis to autonomous driving.
Through the utilization of convolutional neural networks (CNNs) and advancements in network
architectures such as ResNet, Inception, and EfficientNet, significant strides have been made in
improving accuracy, robustness, and efficiency of image classification models. Transfer
learning techniques further enhance performance by leveraging pre-trained models on large-
scale datasets like ImageNet. However, challenges such as dataset bias, interpretability, and
computational resources remain pertinent areas for future research and development. Overall,
the continuous evolution of deep learning methodologies holds promise for further
breakthroughs in image classification, paving the way for impactful real-world applications
across diverse domains.

In addition to its successes, image classification using deep learning also faces ongoing
challenges. One such challenge is the need for large amounts of labeled data for training, which
can be costly and time-consuming to acquire, especially in specialized domains. Furthermore,
ensuring the robustness of models to diverse real-world conditions, such as variations in
lighting, viewpoint, and occlusion, remains an active area of research.

Gujarat Technological University 54 SCE, Ahmedabad


Project ID: 421735 Conclusion and Discussion

a. Problem Encountered and Possible Solutions

Problem Encountered:

1. Data Availability and Quality: Obtaining a comprehensive and diverse


dataset of images depicting healthy and diseased leaves for corn, cotton, and
tomato crops was a significant challenge. Ensuring the quality of the data,
including accurate labeling and minimizing noise and inconsistencies, was
crucial for training reliable classification models.

2. Model Selection and Optimization: Selecting the most suitable machine


learning or deep learning model architecture for leaf classification required
extensive experimentation and evaluation. Optimizing hyperparameters and
tuning model architectures to achieve the desired classification accuracy
while avoiding overfitting presented challenges that needed careful
consideration.

3. Scalability and Deployment: Deploying the classification and treatment


solution in a scalable and user-friendly manner presented challenges related
to infrastructure requirements, deployment environment setup, and user
interface design. Ensuring that the solution could handle large volumes of
incoming data and provide timely recommendations to farmers or agricultural
stakeholders was crucial for its practical utility.

4. Generalization to Real-world Conditions: Ensuring that the developed


classification models could generalize well to unseen data and real-world
conditions was essential. Factors such as variations in lighting, environmental
conditions, and leaf orientation could affect the model's performance and
required robustness testing and validation.

Gujarat Technological University 55 SCE, Ahmedabad


Project ID: 421735 Conclusion and Discussion

Possible Solutions:

1. Integration of Domain Knowledge: In addition to machine learning


approaches, incorporating domain knowledge from agronomists and plant
pathologists can enhance the accuracy and relevance of the classification and
treatment recommendations. Domain-specific rules or heuristics based on
agronomic principles can complement the predictive power of machine
learning models and provide actionable insights for crop management.

2. Data Augmentation: To mitigate the issue of limited and imbalanced datasets,


data augmentation techniques such as rotation, flipping, scaling, and adding
noise can be applied to artificially increase the dataset size and balance the
distribution of classes. This approach can help improve model generalization
and performance.

3. Interactive User Interface: Developing an interactive user interface that


allows farmers or agricultural stakeholders to easily upload leaf images,
receive classification results, and access treatment recommendations can
enhance the usability and practicality of the solution. Intuitive visualization
tools and explanatory text can help users interpret the classification outputs
and make informed decisions regarding crop treatment strategies.

Gujarat Technological University 56 SCE, Ahmedabad


Project ID: 421735 Limitation and Future Work

b. Summary of Internship

Table 8.c.1: Summary of Internship

Project Title Image Classification Using Deep Learning

The main aim of this project is to develop a deep


learning-based image classification system capable
of accurately identifying and categorizing diseases
affecting tomato, cotton, and corn crops.
Aim
Additionally, the system aims to provide targeted
treatment recommendations for each identified
disease, thereby assisting farmers in promptly
addressing crop health issues and improving
agricultural productivity.

Developed At The Pioneer Tech.

Project Category Computer Vision


Visual Studio Code,
IDE
Google Colab
Python
Tools Languages/Frameworks
(TensorFlow,
Matplotlib,
Streamlit)

Dataset PlantVillage

Duration 12 Weeks (January 2024 to April 2024)

Gujarat Technological University 57 SCE, Ahmedabad


Project ID: 421735 Limitation and Future Work

Gujarat Technological University 58 SCE, Ahmedabad


Project ID: 421735 Limitation and Future Work

Chapter

9
==============================================================

9 Limitation and future Work


==============================================================

Limitation and future Work

==============================================================

Gujarat Technological University 59 SCE, Ahmedabad


Project ID: 421735 Limitation and Future Work

Limitations and Future Work

● Limitations:

1. Limited leaf disease classification


2. Dependency on External Services
3. Platform-Specific Features
4. User Onboarding Complexity
5. Limited Offline Functionality

● Future Enhancements:

1. Internationalization and Localization.


2. Advanced Deep Learning Algorithms.
3. Future will add more types of plans.
4. Improving Generalization

Gujarat Technological University 60 SCE, Ahmedabad


Project ID: 421735 Week Wise Work report

REFERENCE

1. To get more information on visual studio code and its shortcuts


https://en.wikipedia.org/wiki/Visual_Studio_Code
2. To get more information of data frame https://pandas.pydata.org/docs/
3. To get more information of graphs https://matplotlib.org/stable/index.html
4. Reference about Python. https://www.w3schools.com/
5. To get solutions of error https://stackoverflow.com/
6. Lutz, Mark. Programming python. " O'Reilly Media, Inc.", 2001.
7. Langtangen, Hans Petter. A primer on scientific programming with Python.
Vol. 6. Springer, 2014.
8. Ullman, Jeffrey D. Elements of ML programming (ML97 ed.). Prentice-Hall,
Inc., 1998.

Gujarat Technological University 61 SCE, Ahmedabad

You might also like