A PROJECT REPORT ON
TOMATO LEAF DISEASE DETECTION AND
PRESCRIPTION SYSTEM
SUBMITTED TO THE SAVITRIBAI PHULE UNIVERSITY, PUNE
IN THE FULFILLMENT OF THE REQUIREMENTS
FOR THE AWARD OF THE DEGREE
OF
BACHELOR OF ENGINEERING (Computer Engineering)
SUBMITTED BY
RUTVIJ DEO Exam No: B400050369
HARSHADA JADHAV Exam No: B400050418
ADITYA LONDHE Exam No: B400050480
BHUSHAN THOMBARE Exam No: B400050613
DEPARTMENT OF COMPUTER ENGINEERING
Pune Institute of Computer Technology
Dhankawadi, Pune - 411043
SAVITRIBAI PHULE PUNE UNIVERSITY
2024-2025
CERTIFICATE
This is to certify that the project report entitled
TOMATO LEAF DISEASE DETECTION AND PRESCRIPTION SYSTEM
Submitted by
RUTVIJ DEO Exam No: B400050369
HARSHADA JADHAV Exam No: B400050418
ADITYA LONDHE Exam No: B400050480
BHUSHAN THOMBARE Exam No: B400050613
is a bonafide student of this institute and the work has been carried out by
him/her under the supervision of Prof. P. S. Joshi and it is approved for
the fulfillment of the requirement of Savitribai Phule Pune University, for the
award of the degree of Bachelor of Engineering (Computer Engineering).
Prof. P. S. Joshi Dr. G. V. Kale
Internal Guide Head
Dept. of Computer Engg. Dept. of Computer Engg.
Dr. S. T. Gandhe
Principal
Pune Institute of Computer Technology
Place: Pune
Date: 13/05/2024
ACKNOWLEDGEMENT
It gives us great pleasure in presenting the project report on TOMATO
LEAF DISEASE DETECTION AND PRESCRIPTION SYS-
TEM’.
We would like to thank our project guide Prof. P. S. Joshi for giving
us all the help and guidance we needed. We are really grateful to them for
their kind support and valuable suggestions.
We are also grateful to Dr G. V. Kale, Head of Computer Engineering
Department, PICT for her indispensable support and suggestions throughout
the project. We also express our gratitude to Dr. A. R. Deshpande, BE
project coordinator, for her timely guidance and support.
Rutvij Deo
Harshada Jadhav
Aditya Londhe
Bhushan Thombare
(B.E. Computer Engg.)
ABSTRACT
This project, ”Tomato Leaf Disease Detection and Prescription,” presents
a technology-driven solution to this issue. Leveraging the power of image pro-
cessing and convolutional neural networks (CNNs), the system can accurately
identify tomato leaf diseases from images and provide corresponding treat-
ment recommendations. The model, trained on a diverse dataset, achieves
an accuracy of approximately 97%, demonstrating both reliability and scal-
ability.
By integrating disease detection with practical prescriptions, the system
empowers farmers to take timely action, reducing crop losses and improving
overall productivity. This approach underscores the potential of AI-based
tools in transforming conventional farming practices and contributing to sus-
tainable agricultural development. Tomato crops play a crucial role in global
agriculture, yet they remain highly susceptible to a range of leaf diseases that
can significantly impact both yield and quality. Traditional detection meth-
ods are largely manual, often requiring expert intervention, which may not be
accessible to every farmer—especially in remote or underserved regions.
This project, ”Tomato Leaf Disease Detection and Prescription,” presents
a technology-driven solution to this issue. Leveraging the power of image pro-
cessing and convolutional neural networks (CNNs), the system can accurately
identify tomato leaf diseases from images and provide corresponding treat-
ment recommendations. The model, trained on a diverse dataset, achieves
an accuracy of approximately 97%, demonstrating both reliability and scala-
bility.
By integrating disease detection with practical prescriptions, the system
empowers farmers to take timely action, reducing crop losses and improv-
ing overall productivity. This approach underscores the potential of AI-based
tools in transforming conventional farming practices and contributing to sus-
tainable agricultural development.
Contents
1 Introduction 1
1.1 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Problem Definition and Objectives . . . . . . . . . . . . . . . 2
1.4 Project Scope & Limitations . . . . . . . . . . . . . . . . . . 3
1.5 Methodology of Problem solving . . . . . . . . . . . . . . . . . 3
2 Literature Survey 5
2.1 Literature Survey . . . . . . . . . . . . . . . . . . . . . . . . . 6
3 Software Requirements Specification 8
3.1 Assumptions and Dependencies . . . . . . . . . . . . . . . . . 9
3.2 Functional Requirements . . . . . . . . . . . . . . . . . . . . . 9
3.2.1 System Requirements . . . . . . . . . . . . . . . . . . . 9
3.2.2 User Interface and Experience Design Requirements . . 10
3.3 External Interface Requirements . . . . . . . . . . . . . . . . . 11
3.3.1 Hardware Interfaces . . . . . . . . . . . . . . . . . . . . 11
3.3.2 Software Interfaces . . . . . . . . . . . . . . . . . . . . 11
3.3.3 Other Requirements . . . . . . . . . . . . . . . . . . . 12
4 System Design 13
4.1 Dataset Structure . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.2 Project Architecture . . . . . . . . . . . . . . . . . . . . . . . 16
4.3 Flow Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.4 Usecase Diagram . . . . . . . . . . . . . . . . . . . . . . . . . 18
5 Project Plan 19
5.1 Project Estimate . . . . . . . . . . . . . . . . . . . . . . . . . 20
5.1.1 Reconciled Estimates . . . . . . . . . . . . . . . . . . . 20
5.1.2 Project Resources . . . . . . . . . . . . . . . . . . . . . 21
5.2 Risk Management . . . . . . . . . . . . . . . . . . . . . . . . . 22
5.2.1 Risk Identification . . . . . . . . . . . . . . . . . . . . 22
5.2.2 Risk Analysis . . . . . . . . . . . . . . . . . . . . . . . 22
5.2.3 Overview of Risk Mitigation, Monitoring, and Man-
agement . . . . . . . . . . . . . . . . . . . . . . . . . . 23
5.3 Project Schedule . . . . . . . . . . . . . . . . . . . . . . . . . 24
5.3.1 Project Task Set . . . . . . . . . . . . . . . . . . . . . 24
5.3.2 Timeline Chart . . . . . . . . . . . . . . . . . . . . . . 25
5.4 Team Organization . . . . . . . . . . . . . . . . . . . . . . . . 25
5.4.1 Team structure . . . . . . . . . . . . . . . . . . . . . . 25
6 Project Implementation 26
6.1 Overview of Project Modules . . . . . . . . . . . . . . . . . . . 27
6.2 Implementation of Model . . . . . . . . . . . . . . . . . . . . . 28
6.3 Tools and Technologies Used . . . . . . . . . . . . . . . . . . . 30
6.4 Algorithm Details . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.4.1 Algorithm 1: Image Preprocessing Algorithm . . . . . . 31
6.4.2 Algorithm 2: CNN Model Architecture for Disease Clas-
sification . . . . . . . . . . . . . . . . . . . . . . . . . . 31
6.4.3 Algorithm 3: Disease Prediction from Image . . . . . . 32
6.4.4 Algorithm 4: Image Data Generators for Training and
Validation . . . . . . . . . . . . . . . . . . . . . . . . . 32
7 Software Testing 34
7.1 Type of Testing . . . . . . . . . . . . . . . . . . . . . . . . . . 35
7.2 Test Cases & Test Results . . . . . . . . . . . . . . . . . . . . 36
8 Conclusions 38
8.1 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
8.2 Future Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
8.3 Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
9 Appendix 41
9.1 Appendix A . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
9.1.1 Survey Paper Details . . . . . . . . . . . . . . . . . . . 42
9.2 Appendix B . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
9.2.1 Research Paper Details . . . . . . . . . . . . . . . . . . 43
9.3 Appendix C . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
9.3.1 Plagiarism Report . . . . . . . . . . . . . . . . . . . . 44
10 References 45
List of Figures
4.1 Model Architecture . . . . . . . . . . . . . . . . . . . . . . . . 16
4.2 System Architecture . . . . . . . . . . . . . . . . . . . . . . . 16
4.3 Flow Diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
4.4 Usecase Diagram . . . . . . . . . . . . . . . . . . . . . . . . . 18
5.1 Timeline Chart . . . . . . . . . . . . . . . . . . . . . . . . . . 25
6.1 Home Page . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
6.2 Upload Tomato Leaf Image . . . . . . . . . . . . . . . . . . . 28
6.3 Re-upload or proceed to classify the disease . . . . . . . . . . 29
6.4 Get the info and prescription of the disease . . . . . . . . . . . 29
7.1 Upload Image Testing . . . . . . . . . . . . . . . . . . . . . . 36
7.2 Prediction and Prescription . . . . . . . . . . . . . . . . . . . 37
7.3 Model Performance Score . . . . . . . . . . . . . . . . . . . . 37
List of Tables
4.1 Training dataset . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4.2 Validation dataset . . . . . . . . . . . . . . . . . . . . . . . . . 15
CHAPTER 1
INTRODUCTION
Tomato Leaf Disease Detection And Prescription System
1.1 Overview
This project centers on developing an intelligent and accessible tool for de-
tecting tomato leaf diseases and providing treatment recommendations. Us-
ing a web-based interface, the system allows users—primarily farmers—to
upload images of affected tomato leaves. These images are processed through
a trained CNN model that identifies the disease class and suggests specific
remedies or pesticides accordingly.
Designed with a focus on usability and performance, the system is built
using a Python backend with integration into a Streamlit-based application.
It supports real-time disease classification and prescription generation, mak-
ing it a practical resource for users with limited technical background. This
solution aims not only to improve early disease detection but also to enhance
farm-level decision-making in an efficient, cost-effective manner.
1.2 Motivation
Tomato crops are among the most widely cultivated and consumed vegeta-
bles globally. However, they are highly vulnerable to leaf diseases, which can
spread rapidly and severely reduce yields. Farmers—especially smallhold-
ers—often rely on outdated or observational techniques that are subjective
and error-prone, which delays treatment and results in significant economic
losses.
This project is motivated by the need to bridge that gap using modern,
AI-driven tools. Tomatoes were chosen specifically due to their high com-
mercial value, global significance, and the diverse range of leaf diseases they
face. By offering a data-driven disease diagnosis and prescription platform,
the system aims to support more sustainable farming practices and improve
food security through early intervention and informed treatment.
1.3 Problem Definition and Objectives
Farmers often encounter difficulties in accurately identifying tomato leaf dis-
eases at an early stage. Misidentification or delays in diagnosis can result
in improper treatments, further damaging the crop and increasing costs.
Moreover, access to agricultural experts is often limited in rural or resource-
constrained areas.
This project seeks to address these challenges by developing an auto-
mated system capable of detecting diseases through leaf images and suggest-
PICT, Department of Computer Engineering 2024-25
2
Tomato Leaf Disease Detection And Prescription System
ing appropriate prescriptions. The goal is to provide a solution that is both
accurate and easy to use, requiring minimal technical knowledge from the
end user. Ultimately, the system intends to enhance disease management in
tomato farming by making timely, informed decisions more accessible.
1.4 Project Scope & Limitations
While the system shows promising results in disease detection and treatment
recommendation, there are inherent challenges and limitations that need to
be acknowledged. The model’s performance can be influenced by the quality
of input images, which may vary due to lighting conditions, camera reso-
lution, or background noise. Ensuring robustness across such varied inputs
remains a key consideration.
Another limitation is the localization of prescriptions. While the sys-
tem provides generic treatment recommendations, integrating region-specific
agricultural practices or chemical availability would require additional data
and customization. Furthermore, in regions with poor internet connectivity
or limited access to digital devices, user adoption may be constrained.
Despite these limitations, the project demonstrates the feasibility and
value of deploying intelligent disease detection systems in agriculture. Future
iterations could focus on expanding the model’s capabilities, improving its
adaptability, and making it even more accessible to end users.
1.5 Methodology of Problem solving
The development of this tomato leaf disease detection and prescription sys-
tem followed a structured and iterative methodology. The process began
with the collection and curation of a large dataset of tomato leaf images,
representing a wide range of common diseases as well as healthy specimens.
This dataset formed the foundation for training our machine learning model.
We employed Convolutional Neural Networks (CNNs) due to their
strong performance in image classification tasks. The model was trained to
detect visual patterns and features associated with specific tomato diseases.
To ensure practical reliability, we conducted tests using real-world im-
ages collected from various sources. These real-life testing phases helped us
assess the model’s robustness under different environmental conditions such
as varied lighting and image quality.
PICT, Department of Computer Engineering 2024-25
3
Tomato Leaf Disease Detection And Prescription System
In addition to disease detection, the system was designed to provide tai-
lored treatment suggestions using Google’s Gemini. These recommendations
were based on the classified disease and aligned with commonly accepted
agricultural practices.
By adhering to this methodology, the project succeeded in developing
a system that is not only accurate but also user-friendly and field-ready for
deployment among farming communities.
PICT, Department of Computer Engineering 2024-25
4
CHAPTER 2
LITERATURE SURVEY
Tomato Leaf Disease Detection And Prescription System
2.1 Literature Survey
In recent years, the integration of deep learning and machine learning tech-
niques for plant disease detection has gained notable attention, specifically in
the field of tomato crop diagnosis, due to its economically valuable crop and
risk of infection. Convolutional Neural Networks (CNNs) have come into exis-
tence as an innovative solution owing to their ability to learn without manual
inputting from raw image data. An evaluation metric study by Hughes and
Salathe [4] applied CNNs trained on the PlantVillage dataset consisting of
54,000 images of 14 different crop species and 26 diseases achieving a re-
markable mean F1 score of 0.9934. This work displayed the effectiveness of
mobile-enabled disease detection systems in real-world agricultural settings.
Early-stage approaches in tomato disease classification, as pointed out
in [1], used brute approach machine learning classifiers consisting of Sup-
port Vector Machines (SVM), Decision Trees, and Artificial Neural Networks
(ANN) on a tomato dataset which has 5,000 images indicating 5 distinct types
of disease.Even though the SVM model secured the highest model accuracy
of 87.3%, the study depended on manual feature extraction, and its scope
was restricted by dataset size and class diversity. [2] Built on this by in-
troducing deep learning-based detection of three major tomato leaf diseases
Early blight, Late blight, and Leaf mold using CNN with achieving the ac-
curacy of 98.9%, which trained on 3,000 images.
The trend toward hybrid and ensemble methods is explored in Pa-
per [6], which introduces a feature-engineered stacking ensemble model for
tomato disease and pest prescription. Through RFECV-GDBT-based di-
mensionality reduction, the authors reduced features from 50 to 37, improv-
ing model efficiency. Integration of classifiers—LGBM, XGBoost, Random
Forest, GDBT, and Decision Trees used in a Model stacking, with LGBM
attaining the highest model accuracy of 80.09%. Distinct aspect of this study
is the integration of prescription data and a focus on both spatial and tempo-
ral trends in disease occurrence, offering a comprehensive pipeline for disease
control and management.
Architectural developments are further described in [7], which eval-
uates multiple CNN architectures such as AlexNet, VGG16, Inception V4,
ResNet, and DenseNet for tomato disease identification. The study focuses
on the effect of hyperparameters like learning rate, batch size, and momen-
tum on performance. Different approaches consisting of lesion heatmaps
PICT, Department of Computer Engineering 2024-25
6
Tomato Leaf Disease Detection And Prescription System
and saliency maps were employed to increase model interpretability. A 3-
stage training strategy involving lesion localization plays a significant role
in performance gains, especially when dealing with leaf images exhibiting
varying symptom locations and quality. This paper strongly advocates for
transparency and dataset diversity as core elements of effective CNN-based
diagnosis systems.
[8] Distinguish between traditional machine learning methods and emerg-
ing deep learning techniques. It presents a three-stage system comprising
image pre-processing, feature extraction, and classification with SVM, KNN,
and ANN. The authors evaluate the traditional approach for its dependence
on manual features and non-uniform data distribution. To handle these lim-
itations, they introduced a CNN-based method trained on 14,828 tomato
images across nine disease classes, discarding the need for feature extraction
and completing significantly better performance and scalability.
Collectively, these works represent an evolution in technology in tomato
disease detection from traditional human-crafted processes advancing to deep
learning-driven, automatic, and intelligent systems. [1, 3] introduce the foun-
dational basis for disease detection evolution, moving from old ML classifiers
to more complex architectures like ResNet with self-learning. [4] sets a gold
standard for CNN-based classification accuracy, while [6] combines multi-
model hybrid learning with feasible prescription insights. [7] Adds architec-
tural and transparency levels, and [8] Supports the scalability and efficiency
of end-to-end CNN models. Concurrently, these works contribute to an over-
all understanding of disease detection systems and form a robust foundation
for developing scalable, intelligent, and user-friendly diagnostic tools adapted
for real-world agricultural use.
PICT, Department of Computer Engineering 2024-25
7
CHAPTER 3
SOFTWARE REQUIREMENTS
SPECIFICATION
Tomato Leaf Disease Detection And Prescription System
3.1 Assumptions and Dependencies
In the development of the Tomato Leaf Disease Detection and Prescription
system, several key assumptions and dependencies are outlined in this Soft-
ware Requirements Specification (SRS). It is assumed that the system will
rely on machine learning techniques, specifically Convolutional Neural Net-
works (CNNs), for accurate and efficient image-based crop disease detection.
This reliance necessitates a high-quality dataset of crop images for training
and validation, ensuring the model’s ability to recognize a diverse set of crop
diseases with accuracy.
It is also assumed that the target users—primarily farmers—may have
limited technical expertise. This assumption drives the design toward a user-
friendly interface with intuitive navigation, making it accessible to users from
non-technical backgrounds. Furthermore, it is expected that users will have
access to reliable image capture devices, such as smartphones or tablets,
which are essential for capturing high-quality images required for accurate
disease detection.
The project depends on external libraries and frameworks for machine
learning and image processing, such as TensorFlow, NumPy, and Pillow, to
support model development and image preprocessing. Internet connectivity
is another key dependency, especially if the system uses cloud-based services
for prediction or model updates, although offline functionality may be con-
sidered. Finally, access to agricultural databases for disease information and
treatment recommendations is assumed, ensuring users receive accurate and
localized solutions based on the diagnosis.
3.2 Functional Requirements
3.2.1 System Requirements
The system will utilize a Convolutional Neural Network (CNN) to detect
crop diseases from uploaded images accurately. Users will be able to upload
images of crops through a web interface, where the CNN model, developed
and trained in Google Colab, will analyze and classify the image, provid-
ing the user with a disease diagnosis. The model will rely on libraries such
as TensorFlow and NumPy to support machine learning operations, while
Python’s Pillow (PIL) library will preprocess images to ensure they are suit-
able for the CNN model.
PICT, Department of Computer Engineering 2024-25
9
Tomato Leaf Disease Detection And Prescription System
To maintain model accuracy, the system is using datasets from Kaggle
for training and validation, ensuring the CNN is capable of recognizing var-
ious crop diseases under different conditions. The entire diagnostic process
will be streamlined to provide users with results in real-time, empowering
them to make quick decisions for disease management.
3.2.2 User Interface and Experience Design Require-
ments
The system’s user interface (UI) will be developed using Streamlit, enabling
an interactive and accessible web application that allows users to upload
crop images for analysis and receive disease detection results and treatment
recommendations. The interface will be designed to be intuitive and easy
to navigate, especially for users with limited technical experience, such as
farmers.
The main page will include options to upload images, view analysis re-
sults, and access treatment recommendations. After processing, the system
will present the results in a straightforward format, with disease identifica-
tion, potential causes, and suggested treatments displayed clearly. Visual
cues, such as color coding for disease severity, will guide users to understand
the information at a glance.
PICT, Department of Computer Engineering 2024-25
10
Tomato Leaf Disease Detection And Prescription System
3.3 External Interface Requirements
3.3.1 Hardware Interfaces
The system requires the following hardware for effective development and
deployment:
• Development:
– Computer with sufficient processing power and RAM for running
Python, TensorFlow, and image processing tasks.
– GPU for accelerated processing of machine learning/CNN models.
– Sufficient storage (HDD/SSD) for dataset, model files, and back-
ups.
• User Side
– Mobile devices (Android, iOS) for image upload and interaction
with the system.
– PC Specifications:
∗ PC with at least 4 GB RAM and a dual-core CPU for smooth
performance of the web-based application.
3.3.2 Software Interfaces
The software iterfaces for both development and deployment are as follows:
1. Development:
• Operating System: Windows 10/11, macOS Monterey, or Linux.
• Google Colab for ease of coding and training models in the cloud.
• Version Control System: Git for source code management and
collaboration.
• Programming Language: Python.
• Google Gemini for Prescription.
• Libraries:
– TensorFlow, Keras for building and training the CNN models.
– Pillow for image preprocessing tasks.
– NumPy for data manipulation and numerical operations.
PICT, Department of Computer Engineering 2024-25
11
Tomato Leaf Disease Detection And Prescription System
– Random for data augmentation during training.
• Cloud Storage: Kaggle for dataset hosting and access.
• Web Deployment: Streamlit for creating an interactive web appli-
cation for AI-ML deployment.
2. Deployment:
• User Interaction: Web-based application via Streamlit accessible
through browsers (Chrome, Firefox, Safari).
• Internet Requirements: Stable internet connection to upload im-
ages and receive feedback.
3.3.3 Other Requirements
• Testing Tools: Kaggle and custom scripts for dataset evaluation and
model validation. Python unit testing for code quality assurance.
• Remote Collaboration Tools: Google Drive for storing datasets and
backups. Zoom or Slack for team meetings and collaboration.
• Backup Solutions: Cloud storage (e.g., Google Drive, Dropbox) for
project backups.
PICT, Department of Computer Engineering 2024-25
12
CHAPTER 4
SYSTEM DESIGN
Tomato Leaf Disease Detection And Prescription System
4.1 Dataset Structure
Dataset (New Plant Disease Dataset) consists of about 87K rgb images of
healthy and diseased crop leaves which is categorized into 38 different classes
in train and valid directories. Among which there are 10 Tomato leaf classes,
9 of which are Infected classes and one Healthy class.
Class Name Images Class Name Images
Apple Apple scab 2016 Apple Black rot 1987
Apple Cedar apple rust 1760 Apple healthy 2008
Blueberry healthy 1816 Cherry Powdery mildew 1683
Cherry healthy 1826 Corn Cercospora leaf spot 1642
Corn Common rust 1907 Corn Northern Leaf Blight 1908
Corn healthy 1859 Grape Black rot 1888
Grape Esca 1920 Grape Leaf blight 1722
Grape healthy 1692 Orange Haunglongbing 2010
Peach Bacterial spot 1838 Peach healthy 1728
Pepper Bacterial spot 1913 Pepper healthy 1988
Potato Early blight 1939 Potato Late blight 1939
Potato healthy 1824 Raspberry healthy 1781
Soybean healthy 2022 Squash Powdery mildew 1736
Strawberry Leaf scorch 1774 Strawberry healthy 1824
Tomato Bacterial spot 1702 Tomato Early blight 1920
Tomato Late blight 1851 Tomato Leaf Mold 1882
Tomato Septoria leaf spot 1745 Tomato Spider mites 1741
Tomato Target Spot 1827 Tomato Yellow Leaf Curl Virus 1961
Tomato mosaic virus 1790 Tomato healthy 1926
Total 69,377
Table 4.1: Training dataset
PICT, Department of Computer Engineering 2024-25
14
Tomato Leaf Disease Detection And Prescription System
Class Name Images Class Name Images
Apple Apple scab 504 Apple Black rot 497
Apple Cedar apple rust 440 Apple healthy 502
Blueberry healthy 454 Cherry Powdery mildew 421
Cherry healthy 456 Corn Cercospora leaf spot 410
Corn Common rust 477 Corn Northern Leaf Blight 477
Corn healthy 465 Grape Black rot 472
Grape Esca 480 Grape Leaf blight 430
Grape healthy 423 Orange Haunglongbing 503
Peach Bacterial spot 459 Peach healthy 432
Pepper Bacterial spot 478 Pepper healthy 497
Potato Early blight 485 Potato Late blight 485
Potato healthy 456 Raspberry healthy 445
Soybean healthy 505 Squash Powdery mildew 434
Strawberry Leaf scorch 444 Strawberry healthy 456
Tomato Bacterial spot 425 Tomato Early blight 480
Tomato Late blight 463 Tomato Leaf Mold 470
Tomato Septoria leaf spot 436 Tomato Spider mites 435
Tomato Target Spot 457 Tomato Yellow Leaf Curl Virus 490
Tomato mosaic virus 448 Tomato healthy 481
Total 17,772
Table 4.2: Validation dataset
PICT, Department of Computer Engineering 2024-25
15
Tomato Leaf Disease Detection And Prescription System
4.2 Project Architecture
Figure 4.1: Model Architecture
Figure 4.2: System Architecture
PICT, Department of Computer Engineering 2024-25
16
Tomato Leaf Disease Detection And Prescription System
4.3 Flow Diagram
The following diagram illustrates the working of the final result.
Figure 4.3: Flow Diagram
PICT, Department of Computer Engineering 2024-25
17
Tomato Leaf Disease Detection And Prescription System
4.4 Usecase Diagram
The following diagram shows the usecase of the final model.
Figure 4.4: Usecase Diagram
PICT, Department of Computer Engineering 2024-25
18
CHAPTER 5
PROJECT PLAN
Tomato Leaf Disease Detection And Prescription System
5.1 Project Estimate
5.1.1 Reconciled Estimates
• Dataset Preparation and Preprocessing: Estimated 2-3 weeks
to collect and preprocess a comprehensive dataset of crop images, in-
cluding both diseased and healthy samples. This phase involves data
gathering, applying preprocessing techniques (e.g., normalization, aug-
mentation), and ensuring dataset consistency for quality training and
testing. The dataset will cover various crops and disease types.
• Model Development and Evaluation: Estimated 3-4 months for
the development and evaluation of a machine learning model, focusing
on CNNs (convolutional neural networks) for image-based disease de-
tection. This phase includes setting up the coding environment (e.g.,
Python, TensorFlow), training multiple model prototypes, and validat-
ing their performance across subsets of data to ensure accurate and
reliable disease detection.
• Application Integration and Testing: Estimated 2 months for inte-
grating the trained model into a user-friendly application. This includes
designing an intuitive interface, allowing farmers to upload images and
receive treatment recommendations. The phase also includes feedback
loops to refine detection accuracy and improve user experience.
• Testing, Validation, and Further Optimization:Estimated 2 months
for comprehensive testing, validation, and further optimization of the
application and model. This includes verifying the system’s accuracy,
ensuring high-quality disease treatment recommendations, and opti-
mizing the user experience under varying conditions, such as different
image qualities and lighting.
• Documentation and Review: Estimated 2-3 weeks for detailed
project documentation, capturing methodologies, challenges, and so-
lutions encountered throughout the project. The final report will sum-
marize all phases, and the findings may be submitted to agricultural
technology conferences or explored for potential partnerships to expand
the project’s reach.
Approximately 8 months, though the actual timeline may vary based
on specific project constraints, resource availability, and emerging needs dur-
ing development.
PICT, Department of Computer Engineering 2024-25
20
Tomato Leaf Disease Detection And Prescription System
5.1.2 Project Resources
1. Machine Learning Engineers (3): Responsible for developing and
optimizing the crop disease detection algorithms. Their main tasks
include designing, training, and fine-tuning machine learning models,
particularly convolutional neural networks (CNNs), to detect crop dis-
eases accurately. They collaborate with the UI/UX designer to inte-
grate model outputs into a user-friendly interface and adjust the system
based on testing feedback.
2. UI/UX Designers (2): Responsible for designing an intuitive and ac-
cessible user interface for the system, focusing on key user screens such
as image upload, disease detection results, and treatment recommen-
dation displays. The UI/UX designer will conduct usability testing,
refining the interface to meet the needs of farmers and other end users.
3. Project Management Tool: We used asana to organize tasks, set
deadlines, and manage project milestones. Asana provides a visual
interface for tracking progress, assigning responsibilities, and ensuring
each phase of development stays on schedule.
4. Collaboration Tools: GitHub for version control and collaborative
coding, Google Colab as a primary environment for coding, model
training, testing, and sharing development progress and code snippets.,
Google Meet for team meetings and discussions, and Discord for real-
time communication and collaboration among team members.
PICT, Department of Computer Engineering 2024-25
21
Tomato Leaf Disease Detection And Prescription System
5.2 Risk Management
5.2.1 Risk Identification
• Technical Risk:
1. Potential challenges in training machine learning models with high
accuracy due to limited or diverse image quality in the dataset.
2. Risks associated with processing large image datasets, which may
require high computational resources.
3. Integration issues between the ML model and the user interface
in Streamlit.
4. Difficulties in ensuring real-time disease detection and prescription
accuracy with diverse crop images.
• Data Risk: Data acquisition may be limited or inconsistent due to
varying crop disease images and conditions, affecting the accuracy of
the model.
• Operational Risk: Unforeseen changes in project requirements or
team availability could impact project timeline and quality.
5.2.2 Risk Analysis
• Technical Risk: Assessed as high impact, given the critical role of
model accuracy and processing speed. This risk has a medium likeli-
hood. To mitigate, iterative model evaluation and optimization pro-
cesses are planned.
• Data Risk: Evaluated as medium impact and medium likelihood due
to potential challenges in accessing diverse, high-quality crop disease
images. To mitigate, additional sources for data and preprocessing
techniques are considered.
• Operational Risk: Considered medium impact with medium likeli-
hood. Effective task scheduling and scope management will address
possible disruptions due to scope or personnel changes.
PICT, Department of Computer Engineering 2024-25
22
Tomato Leaf Disease Detection And Prescription System
5.2.3 Overview of Risk Mitigation, Monitoring, and
Management
• Technical Risk Mitigation: Continuous model training, testing, and
regular validation using real-world images will be conducted to main-
tain model accuracy. Streamlined integration between Google Colab
and Streamlit will be ensured to avoid compatibility issues.
• Data Risk Mitigation: Diverse datasets will be sourced and addi-
tional preprocessing techniques (e.g., data augmentation) applied to
address data limitations and improve model reliability.
• Operational Risk Mitigation: A well-defined project scope and flex-
ible scheduling will help manage any changes in requirements or team
dynamics.
• Risk Monitoring: Weekly project status meetings will assess iden-
tified risks and monitor for new potential risks, enabling timely re-
sponses.
PICT, Department of Computer Engineering 2024-25
23
Tomato Leaf Disease Detection And Prescription System
5.3 Project Schedule
5.3.1 Project Task Set
• Define the problem statement, clarifying the need for a system to detect
crop diseases and provide treatment recommendations.
• Conduct research to outline the scope of the project, including target
crops, disease types, and potential impact on farming practices.
• Establish workflows for disease detection and treatment recommenda-
tions, identifying potential challenges and devising solutions.
• Set up necessary environments and tools, such as Python, Jupyter
Notebook, and deep learning libraries like TensorFlow or PyTorch.
• Configure a version control system for collaborative development and
version tracking.
• Review existing image-based disease detection systems to understand
methodologies and identify challenges.
• Gather a diverse dataset of crop images, covering various diseases and
healthy samples for training and testing purposes.
• Research and apply image preprocessing techniques (e.g., normaliza-
tion, augmentation) to ensure consistent dataset quality.
• Evaluate machine learning algorithms, such as convolutional neural net-
works (CNNs), for image-based disease detection. Build initial model
prototypes and test them on a subset of data to assess feasibility and
initial accuracy.
• Testing and Validation.Integrate the trained model and treatment database
into a user-friendly application, enabling farmers to upload images and
receive guidance.
• Use feedback to refine detection accuracy, recommendation quality, and
user experience, iterating on the design as needed.
• Document the project’s methodologies, challenges, solutions, and out-
comes in a final report.
• Submit the project to agricultural technology conferences and explore
potential partnerships to increase its reach.
PICT, Department of Computer Engineering 2024-25
24
Tomato Leaf Disease Detection And Prescription System
5.3.2 Timeline Chart
Figure 5.1 presents an overview of the project timeline, summarizing the
schedule from project inception through to the expected completion date.
Figure 5.1: Timeline Chart
5.4 Team Organization
5.4.1 Team structure
• Rutvij Deo: M.L., Development, Data collection.
• Harshada Jadhav: Data collection, documentation.
• Aditya Londhe: M.L., Development, Documentation, Data gather-
ing.
• Bhushan Thombare: Development, Data collection, documentation.
• Prof. Pallavi Joshi: Internal mentor and guide.
PICT, Department of Computer Engineering 2024-25
25
CHAPTER 6
PROJECT IMPLEMENTATION
Tomato Leaf Disease Detection And Prescription System
6.1 Overview of Project Modules
• Model Building and Training: A Convolutional Neural Network
(CNN) was constructed on Kaggle New Plant Disease Dataset using
Keras with TensorFlow backend. The model consists of multiple con-
volutional blocks, followed by dense layers. It was trained for 30 epochs
with early stopping and learning rate reduction mechanisms.
• Model Evaluation and Visualization: The model was evaluated
using accuracy, precision, recall, and loss metrics. Training and valida-
tion performance was plotted to visualize the learning trends.
• Prediction and Visualization Module: A separate module was
created to load a saved model, preprocess user-uploaded images, make
predictions, and visually display results along with prediction.
• User Interface and Prescription with Streamlit and Google
Gemini: A web interface was developed using Streamlit to enable
users to interact with the system, upload images, and view disease
predictions along with Prescription generated by Gemini.
PICT, Department of Computer Engineering 2024-25
27
Tomato Leaf Disease Detection And Prescription System
6.2 Implementation of Model
The following diagrams shows the implementation of the model.
Figure 6.1: Home Page
Figure 6.2: Upload Tomato Leaf Image
PICT, Department of Computer Engineering 2024-25
28
Tomato Leaf Disease Detection And Prescription System
Figure 6.3: Re-upload or proceed to classify the disease
Figure 6.4: Get the info and prescription of the disease
PICT, Department of Computer Engineering 2024-25
29
Tomato Leaf Disease Detection And Prescription System
6.3 Tools and Technologies Used
• Programming Language: Python 3.10
• Libraries and Frameworks: TensorFlow, Keras, NumPy, Matplotlib,
Pillow, Streamlit, ImageDataGenerator
• Development Environment: Google Colab for model training; Stream-
lit for deployment
• Dataset Source: Kaggle – New Plant Diseases Dataset (Augmented)
• Model Saving and Loading: HDF5 format (.h5) for saving and
reusing trained models
• Hardware Used: Google Colab GPU runtime (Tesla T4), local sys-
tem with 8 GB RAM (for testing)
• AI Tools: Google Gemini To get Prescriptions based on the plant
disease.
PICT, Department of Computer Engineering 2024-25
30
Tomato Leaf Disease Detection And Prescription System
6.4 Algorithm Details
6.4.1 Algorithm 1: Image Preprocessing Algorithm
Input: Raw image path, Target size (256 × 256)
Output: Preprocessed image array suitable for CNN
• Load the image using Pillow library.
• Resize the image to the target size (256 × 256).
• Convert the image into a NumPy array.
• Add a batch dimension to the image array.
• Normalize the pixel values to the range [0, 1].
• Return the final preprocessed image array.
6.4.2 Algorithm 2: CNN Model Architecture for Dis-
ease Classification
Input: Preprocessed image of shape (256 × 256 × 3) Output: Predicted
disease class (via softmax layer)
• Initialize a Sequential model.
• Convolution Block 1:
– Add a Conv2D layer with 32 filters, 3 × 3 kernel, ReLU activation.
– Add another Conv2D layer with same configuration.
– Apply MaxPooling with pool size 2 × 2.
– Apply Dropout of 0.25.
• Convolution Block 2:
– Add two Conv2D layers with 64 filters each, 3 × 3 kernel, ReLU
activation.
– Apply MaxPooling with pool size 2 × 2.
– Apply Dropout of 0.25.
• Convolution Block 3:
PICT, Department of Computer Engineering 2024-25
31
Tomato Leaf Disease Detection And Prescription System
– Add two Conv2D layers with 128 filters each, 3 × 3 kernel, ReLU
activation.
– Apply MaxPooling with pool size 2 × 2.
– Apply Dropout of 0.25.
• Fully Connected Layers:
– Flatten the output from convolution layers.
– Add a Dense layer with 512 units, ReLU activation, and L2 regu-
larization.
– Apply Dropout of 0.5.
– Add final Dense output layer with softmax activation for classifi-
cation.
6.4.3 Algorithm 3: Disease Prediction from Image
Input: Trained CNN model, image path, and class index dictionary Out-
put: Predicted class name and confidence score
• Load and preprocess the input image using the preprocessing algorithm.
• Pass the preprocessed image to the trained CNN model to get predic-
tion scores.
• Identify the index of the class with the highest prediction score using
argmax.
• Extract the corresponding confidence score from the prediction array.
• Retrieve the class name from the class indices dictionary using the
predicted index.
• Return the predicted class name and the confidence score.
6.4.4 Algorithm 4: Image Data Generators for Train-
ing and Validation
Input: Directories for training and validation images, image size, batch size.
Output: Training and validation data generators.
• Initialize the ImageDataGenerator for training data with:
PICT, Department of Computer Engineering 2024-25
32
Tomato Leaf Disease Detection And Prescription System
– rotation range = 20, allowing random rotations between -20 and
20 degrees.
– zoom range = 0.2, enabling random zoom on images by 20%.
– horizontal flip = True, enabling random horizontal flipping of im-
ages.
– vertical flip = True, enabling random vertical flipping of images.
– shear range = 0.1, applying random shearing transformations to
the image.
– fill mode = ’nearest’, filling missing pixel values with the nearest
pixel value.
– rescale = 1./255, normalizing the image pixel values to a range of
[0, 1].
• Use the flow from directory method on train dir to create the train generator.
• Set target size to the desired image size and batch size for the number
of images in each batch.
• Set class mode = ’categorical’ to indicate multiclass classification.
• Initialize a separate ImageDataGenerator for validation data, applying
only rescale = 1./255.
• Use flow from directory on validation dir to create validation generator
with the same target size and batch size.
PICT, Department of Computer Engineering 2024-25
33
CHAPTER 7
SOFTWARE TESTING
Tomato Leaf Disease Detection And Prescription System
7.1 Type of Testing
• Unit Testing: Individual components such as image preprocessing
functions, model loading functions, and prediction functions were tested
independently to ensure that each component performs its intended
task correctly.
• Integration Testing: This testing phase ensured that various mod-
ules, such as the trained model, class mappings, and the prediction
pipeline, worked seamlessly together after integration.
• Functional Testing: Validated that the system correctly accepts
user-uploaded images, processes them, and outputs the predicted plant
disease with appropriate confidence scores.
• User Acceptance Testing (UAT): The complete system, including
the Streamlit interface, was tested to ensure it met the end-user expec-
tations in terms of usability, accuracy, and the overall user experience.
PICT, Department of Computer Engineering 2024-25
35
Tomato Leaf Disease Detection And Prescription System
7.2 Test Cases & Test Results
• Test Case 1: Uploading and Preprocessing an Image
– Input: An image of a diseased plant leaf.
– Expected Result: Image is resized, normalized, and prepared
for prediction.
– Actual Result: Image processed successfully, resized to target
dimensions, and normalized.
– Status: Pass
Figure 7.1: Upload Image Testing
• Test Case 2: Model Prediction and Prescription
– Input: Tomato Early Blight image from the internet.
– Expected Result: Prediction correctly identifies Tomato Early
Blight disease.
– Actual Result: Model successfully predicted Tomato Early Blight.
– Status: Pass
PICT, Department of Computer Engineering 2024-25
36
Tomato Leaf Disease Detection And Prescription System
Figure 7.2: Prediction and Prescription
• Test Case 3: Streamlit UI Functionality
– Input: User uploads an image via the Streamlit interface.
– Expected Result: The model outputs a disease prediction along
with the confidence score.
– Actual Result: The Streamlit UI displayed the predicted class
and the confidence score successfully.
– Status: Pass
• Performance Metrics
Figure 7.3: Model Performance Score
PICT, Department of Computer Engineering 2024-25
37
CHAPTER 8
CONCLUSIONS
Tomato Leaf Disease Detection And Prescription System
8.1 Conclusion
This project demonstrates an effective system for automated crop disease de-
tection and prescription using image segmentation, deep learning, and gen-
erative AI. Implemented as a Streamlit web application, it allows users to
upload leaf images, automatically detect the leaf region, classify the disease
using a CNN, and receive treatment recommendations generated by a lan-
guage model.
The system addresses the limitations of manual inspection by offering
rapid, consistent, and accessible diagnosis—crucial for timely intervention in
agriculture. Its high performance underscores its practical utility:
• Accuracy: 97.23%
• Precision: 97.60%
• Recall: 97.04%
• Loss: 0.2814
These results validate the model’s robustness and suitability for real-
world deployment. Future work will focus on supporting more crops, enhanc-
ing mobile usability, and enabling offline access, thereby making the tool even
more impactful for farmers and agricultural professionals.
8.2 Future Scope
The system developed in this project can be expanded and enhanced in sev-
eral impactful ways:
• Multi-Crop Support: Extend the system to detect diseases in other
crops such as rice, wheat, and cotton by training on diverse datasets.
• Mobile Application Integration: Deploy the solution as a mobile
app to reach farmers in remote and rural areas with limited access to
computers.
• Real-time Detection: Integrate with drone or IoT-based cameras for
real-time disease monitoring in large agricultural fields.
• Multilingual Support: Include recommendations in regional lan-
guages to ensure accessibility for non-English-speaking farmers.
PICT, Department of Computer Engineering 2024-25
39
Tomato Leaf Disease Detection And Prescription System
8.3 Applications
This system can have wide-ranging practical uses in the agricultural domain:
• Farm-Level Disease Diagnosis: Enable farmers to identify crop
diseases early and accurately using only a smartphone camera.
• Agricultural Extension Services: Assist extension workers in quickly
diagnosing plant issues in the field and prescribing standardized reme-
dies.
• Precision Agriculture: Support more efficient pesticide and nutrient
use by identifying affected regions and applying localized treatment.
• Smart Farming Systems: Integrate into autonomous systems that
monitor plant health and optimize field operations.
PICT, Department of Computer Engineering 2024-25
40
CHAPTER 9
APPENDIX
Tomato Leaf Disease Detection And Prescription System
9.1 Appendix A
9.1.1 Survey Paper Details
Paper Status: Published
Name of Journal: International Journal of Creative Research Thoughts
(IJCRT)
PICT, Department of Computer Engineering 2024-25
42
Tomato Leaf Disease Detection And Prescription System
9.2 Appendix B
9.2.1 Research Paper Details
Paper Status:
Name of Journal:
PICT, Department of Computer Engineering 2024-25
43
Tomato Leaf Disease Detection And Prescription System
9.3 Appendix C
9.3.1 Plagiarism Report
The plagiarism report for the project report has been attached herewith.
Similarity: %
PICT, Department of Computer Engineering 2024-25
44
CHAPTER 10
REFERENCES
Tomato Leaf Disease Detection And Prescription System
[1] Naresh K.Trivedi, Vinay Gautam, Abhineet Ananad, Hani Moaiteq
Aljahdali, Santos Gracia Villar, Divya Anand, Nitin Goyal Seife-
dine Kadry (2021). “Early Detection and Classification of Tomato Leaf
Disease Using High-Performance Deep Neural Network.” Sensors 2021,
21(23), 7987.
[2] Mohit Agarwal, Suneet Kr. Gupta K.K. Biswas (2020). “Development
of Efficient CNN model for Tomato crop disease identification.” Sustain-
able Computing: Informatics and Systems Volume 28, December 2020,
100407.
[3] Alex Krizhevsky, Ilya Sutskever Geoffrey E. Hinton (2012). “ImageNet
Classification with Deep Convolutional Neural Networks.”
[4] Sharada P. Mohanty, David P. Hughes Marcel Salathe (2016). “Using
Deep Learning for Image-Based Plant Disease Detection.” Frontiers in
Plant Science, 7, 1419.
[5] Kim, Sam-Keun Ahn, Jae-Geun (2021). “Tomato Crop Diseases Clas-
sification Models Using Deep CNN-based Architectures.” Journal of
the Korea Academia-Industrial cooperation Society Volume 22 Issue 5
Pages.7-14 / 2021 / 1975-4701(pISSN) / 2288-4688(eISSN).
[6] Chang Xu, Junqi Ding, Yan Qiao Lingxian Zhang (2022). “Tomato
disease and pest diagnosis method based on the Stacking of prescription
data.” Computers and Electronics in Agriculture Volume 197, June 2022,
106997.
[7] M. Agarwal, A. Singh, S. Arjaria, A. Sinha, and S. Gupta, ”ToLeD:
Tomato Leaf Disease Detection using Convolution Neural Network,”
Procedia Computer Science, vol. 167, pp. 293–301, 2020, doi:
10.1016/j.procs.2020.03.225.
[8] Mohammed Brahimi, Kamel Boukhalfa Abdelouahab Moussaoui
(2017). “Deep Learning for Tomato Diseases: Classification and Symp-
toms Visualization.” Applied Artificial Intelligence, 31:4, 299–315. DOI:
10.1080/08839514.2017.1315516.
[9] Zhang, J., Qi, C., Mecha, P. et al. “Pseudo high-frequency boosts the
generalization of a convolutional neural network for cassava disease de-
tection.” Plant Methods 18, 136 (2022). https://doi.org/10.1186/s13007-
022-00969-w
PICT, Department of Computer Engineering 2024-25
46
Tomato Leaf Disease Detection And Prescription System
[10] Siventhirarajah Sangeevan. “Deep learning-based pesticides prescription
system for leaf diseases of home garden crops in Sri Lanka.” 2021 Inter-
national Research Conference on Smart Computing and Systems Engi-
neering (SCSE), 2021, 2612-8662.
[11] Marko Arsenovic, Mirjana Karanovic, Srdjan Sladojevic, Andras An-
derla Darko Stefanovic. “Solving Current Limitations of Deep Learning
Based Approaches for Plant Disease Detection.” Symmetry 2019, 11(7),
939.
PICT, Department of Computer Engineering 2024-25
47