Naveen
Naveen
Bachelor of Technology
in
Computer Science & Engineering
By
May, 2025
BATCH N O :MAI200
IMAGE BASED POTATO LEAF DISEASE DETECTION
Bachelor of Technology
in
Computer Science & Engineering
By
May, 2025
CERTIFICATE
It is certified that the work contained in the project report titled ”IMAGE BASED POTATO LEAF
DISEASE DETECTION” by ”K SIVA KRISHNA SAI (21UECM0113), R SIDDHARTHA VARMA
(21UECM0202), M NAVEEN KUMAR (21UECM0327)” has been carried out under my supervision
and that this work has not been submitted elsewhere for a degree.
Signature of Supervisor
Supervisor name
Designation
Computer Science & Engineering
School of Computing
Vel Tech Rangarajan Dr. Sagunthala R&D
Institute of Science and Technology
May, 2025
i
DECLARATION
We declare that this written submission represents my ideas in our own words and where others’
ideas or words have been included, we have adequately cited and referenced the original sources. We
also declare that we have adhered to all principles of academic honesty and integrity and have not
misrepresented or fabricated or falsified any idea/data/fact/source in our submission. We understand
that any violation of the above will be cause for disciplinary action by the Institute and can also
evoke penal action from the sources which have thus not been properly cited or from whom proper
permission has not been taken when needed.
(Signature)
K SIVA KRISHNA SAI
Date: / /
(Signature)
R SIDDHARTHA VARMA
Date: / /
(Signature)
M NAVEEN KUMAR
Date: / /
ii
APPROVAL SHEET
This project report entitled IMAGE BASED POTATO LEAF DISEASE DETECTION by (K SIVA
KRISHNA SAI (21UECM0113), (R SIDDHARTHA VARMA (21UECM0202), (M NAVEEN KU-
MAR (21UECM0327) is approved for the degree of B.Tech in Computer Science & Engineering.
Examiners Supervisor
Supervisor name,Degree
Designation,.
Date: / /
Place:
iii
ACKNOWLEDGEMENT
We express our deepest gratitude to our Honorable Founder Chancellor and President Col.
Prof. Dr. R. RANGARAJAN B.E. (Electrical), B.E. (Mechanical), M.S (Automobile), D.Sc., and
Foundress President Dr. R. SAGUNTHALA RANGARAJAN M.B.B.S.,Vel Tech Rangarajan
Dr. Sagunthala R&D Institute of Science and Technology, for her blessings.
We express our sincere thanks to our respected Chairperson and Managing Trustee
Mrs. RANGARAJAN MAHALAKSHMI KISHORE,B.E., Vel Tech Rangarajan Dr. Sagun-
thala R&D Institute of Science and Technology, for her blessings.
We are very much grateful to our beloved Vice Chancellor Prof. Dr.RAJAT GUPTA, for provid-
ing us with an environment to complete our project successfully.
We are thankful to our Professor & Head, Department of Computer Science & Engineering,
Dr. N. VIJAYARAJ, M.E., Ph.D., and Associate Professor & Assistant Head, Department of
Computer Science & Engineering, Dr. M. S. MURALI DHAR, M.E., Ph.D.,for providing im-
mense support in all our endeavors.
We also take this opportunity to express a deep sense of gratitude to our Internal
Mrs.E.CHANDRALEKHA M.TECH for his/her cordial support, valuable information and guid-
ance, he/she helped us in completing this project through various stages.
We thank our department faculty, supporting staff and friends for their help and guidance to com-
plete this project.
iv
ABSTRACT
The plant disease causes secondary resulting decrease in crop yield in cultivated
areas around the world. Early and rapid detecting of plant diseases is most critical
for saving time for timely intervention and loss mitigation. In this paper, a potato
leaf disease detection system based on deep learning with multiple architectures,
i.e., EfficientNetB0, VGG16, CNN, InceptionV3, and MobileNetV2 is developed,
and performance evaluations and accuracy optimization are carried out. Since it is
efficiency and accuracy, the EfficientNetB0 model was chosen for the real time ap-
plication. The development of the backend relies on FastAPI alongside with trained
deep learning models for real time predictions. The robustness and efficiency is
tested using Postman for the API endpoints. It consists of the frontend using HTML,
CSS and JavaScript to let the user upload leaf image and immediately get predicted.
It’s an extensive preprocessing, data augmentation, that increase model generalized
and accuracy. It is shown how deep learning can help precision agriculture, early
disease detection and hence make farming sustainable.
v
LIST OF FIGURES
vi
LIST OF TABLES
vii
LIST OF ACRONYMS AND
ABBREVIATIONS
viii
TABLE OF CONTENTS
Page.No
ABSTRACT v
LIST OF FIGURES vi
1 INTRODUCTION 1
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Problem Statement . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 LITERATURE REVIEW 4
2.1 Existing System . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2 Related Work . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Research Gap . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3 PROJECT DESCRIPTION 9
3.1 Existing System . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 Proposed System . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.3 Feasibility Study . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
3.3.1 Economic Feasibility . . . . . . . . . . . . . . . . . . . . . 11
3.3.2 Technical Feasibility . . . . . . . . . . . . . . . . . . . . . 11
3.3.3 Social Feasibility . . . . . . . . . . . . . . . . . . . . . . . 12
3.4 System Specification . . . . . . . . . . . . . . . . . . . . . . . . . 12
3.4.1 Tools and Technologies Used . . . . . . . . . . . . . . . . 13
3.4.2 Standards and Policies . . . . . . . . . . . . . . . . . . . . 13
9 PLAGIARISM REPORT 36
10 SOURCE CODE 37
10.1 Source Code . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
References 39
Chapter 1
INTRODUCTION
1.1 Introduction
Agriculture plays a vital role in global food security, and potato cultivation is
one of the most significant contributors to the agricultural industry. However, dis-
eases affecting potato plants can lead to severe yield loss, impacting both farmers
and the food supply chain. Early detection and classification of potato leaf diseases
can help in timely intervention, reducing the impact on crop production.This project
focuses on developing an potato leaf disease detection system using deep learning
techniques. By leveraging convolutional neural networks (CNNs) and state-of-the-
art pre-trained models such as MobileNetV2, InceptionV3, VGG16, and Efficient-
NetB0, we aim to build a robust and efficient system that accurately classifies differ-
ent potato leaf diseases. The primary objective is to achieve high accuracy in disease
detection while ensuring real-time processing capabilities.
To accomplish this, we have structured our project into four key phases:
1. Research Planning:Gathering datasets, selecting appropriate machine learning
frameworks (TensorFlow/Keras), and defining model architecture.
2. Model Development: Training and evaluating multiple deep learning models to
identify the most efficient approach.
3. Backend Development: Implementing an API using FastAPI, integrating the
trained model, and validating results using Postman.
4. Frontend Deployment: Designing a web interface that allows users to upload
potato leaf images for real-time disease prediction.
Our dataset comprises high-quality images of potato leaves categorized into multi-
ple disease classes. Preprocessing techniques such as image resizing, normalization,
and data augmentation are employed to enhance model performance. Various models
are trained and evaluated based on accuracy, training time, and inference speed, with
EfficientNetB0 achieving the highest accuracy of 99 accuracy.The deployment of
1
the system is carried out using FastAPI, enabling real-time disease detection through
API endpoints. The model is tested and validated using Postman, ensuring seamless
interaction between the backend and the frontend. The final system is deployed on a
local server (port 8000), where users can upload images and receive instant disease
classification results.By implementing this solution, we aim to empower farmers and
agricultural experts with an AI-powered tool that enhances early disease diagnosis,
minimizes losses, and optimizes crop management strategies.
1.2 Background
The background of this project revolves around the critical need for early and ac-
curate detection of potato leaf diseases to improve crop yield and prevent economic
losses. Traditional methods of disease identification rely on manual inspection,
which is time-consuming, labor-intensive, and prone to errors. With advancements in
deep learning and computer vision, automated disease detection systems have gained
prominence. Convolutional Neural Networks (CNNs) and transfer learning models
such as MobileNetV2, InceptionV3, VGG16, and EfficientNetB0 have shown re-
markable performance in image classification tasks. Leveraging these models, this
project aims to develop an efficient and accurate system for detecting various potato
leaf diseases using image data. The integration of FastAPI for backend development
ensures seamless deployment of the trained model, while Postman is used for API
testing. This project contributes to the field of precision agriculture by offering a
real-time, scalable, and reliable solution for plant disease monitoring.
1.3 Objective
The primary objective of this project is to develop an accurate and efficient deep
learning-based system for the detection and classification of potato leaf diseases.
By leveraging Convolutional Neural Networks (CNNs) and transfer learning models
such as MobileNetV2, InceptionV3, VGG16, and EfficientNetB0, the project aims to
achieve high accuracy in disease identification. The system will be integrated with a
FastAPI-based backend to enable real-time predictions, ensuring ease of deployment
and accessibility. Additionally, the objective includes preprocessing and enhancing
the dataset to improve model performance, optimizing the architecture for better
accuracy, and evaluating various models to identify the best-performing one. The
2
project also aims to provide an intuitive user interface for farmers and agricultural
experts to upload leaf images and receive instant predictions, thereby contributing
to early disease detection, reducing crop loss, and improving overall agricultural
productivity.
Potato diseases can significantly reduce crop yield and quality, leading to financial
losses for farmers. Traditional disease detection methods rely on manual inspection,
which is time-consuming and prone to errors. There is a need for an automated sys-
tem that can quickly and accurately identify potato leaf diseases using image recog-
nition. This project aims to develop a deep learning-based model to classify potato
leaves as healthy or diseased. By comparing different deep learning architectures,
we seek to find the most effective approach for real-time disease detection.
3
Chapter 2
LITERATURE REVIEW
[1] Tiwari et al. proposed a deep learning model for potato leaf disease detection
using convolutional neural networks (CNNs). Their study demonstrated the effec-
tiveness of CNNs in classifying diseases with high accuracy, proving deep learning
as a viable approach for automated plant disease detection. The study emphasized
the importance of large and diverse datasets to improve model generalization(2020).
[2] Arshaghi et al. compared various deep learning models, including CNNs,
ResNet, and Inception networks, to determine the most effective approach for potato
disease detection. Their study found that deep neural networks outperformed tradi-
tional image-processing techniques and highlighted the role of data augmentation in
enhancing model robustness(2023).
[4] Tarik et al. explored the use of deep learning and traditional machine learn-
ing methods for potato disease detection. Their comparative study showed that
CNN-based models outperformed traditional classifiers such as k-Nearest Neighbors
(k-NN) and Decision Trees, demonstrating the strength of hierarchical feature
extraction in deep learning models(2021).
[5] Iqbal and Talukder used image segmentation techniques combined with
machine learning models for potato disease identification. Their findings empha-
sized the importance of preprocessing techniques, such as feature extraction using
Histogram of Oriented Gradients (HOG), in improving model accuracy. They
demonstrated that combining segmentation with feature selection led to better
classification results(2020).
4
[6] Kothari et al. employed deep learning techniques and found that CNN-
based models could achieve high accuracy in distinguishing between diseased
and healthy leaves. They also experimented with different architectures such as
MobileNetV2 and VGG16, finding that transfer learning significantly improved
performance(2022).
[7] Kadam et al. proposed an automatic potato disease detection system using ma-
chine learning algorithms, including Random Forest and Support Vector Machines
(SVMs). Their study highlighted the potential of supervised learning techniques in
plant pathology applications and demonstrated the benefits of ensemble learning for
improving classification accuracy(2022).
[8] Singh and Kaur investigated various machine learning methodologies for
potato leaf disease detection and concluded that Support Vector Machines (SVMs)
and Decision Trees showed competitive performance. They also discussed the
impact of feature engineering and dimensionality reduction techniques, such as
Principal Component Analysis (PCA), on model performance(2021).
[10] Varshney et al. conducted a broader study on plant disease detection using
machine learning, reinforcing the relevance of ML techniques in agriculture. They
experimented with different machine learning classifiers and concluded that hybrid
approaches combining deep learning with traditional ML methods achieved better
results(2022).
[11] Pandian et al. presented a deep convolutional neural network (CNN) model
for plant disease detection, highlighting its applicability across multiple plant
species. Their study explored the advantages of using multi-layer perceptrons
(MLPs) in conjunction with CNNs for better feature extraction and classifica-
5
tion(2022).
[12] Bansal et al. implemented a CNN-based model for apple leaf disease
detection, demonstrating its effectiveness in classifying different disease categories.
They utilized techniques such as data augmentation, dropout, and fine-tuning of
hyperparameters to enhance model performance(2021).
[13] Baranwal et al. used a deep learning-based CNN model for apple leaf disease
detection, confirming CNNs as a powerful tool in plant pathology. Their study
introduced an attention-based mechanism to focus on critical regions of diseased
leaves, improving the interpretability of deep learning models(2019).
[15] Hassan and Maji developed a novel CNN model for plant disease identifi-
cation, further solidifying CNNs as a primary technique for disease classification
in agriculture. Their work explored the integration of attention mechanisms and
generative adversarial networks (GANs) to improve model robustness(2022).
6
to leverage deep learning advancements, which can significantly improve accuracy.
Therefore, there is a need for an automated, intelligent, and robust deep learning-
based approach that can accurately detect and classify potato leaf diseases in real
time, aiding farmers in timely decision-making.
Several research studies have explored the application of deep learning and
computer vision for plant disease detection. Convolutional Neural Networks
(CNNs) have been widely adopted due to their ability to automatically extract
features from leaf images without manual intervention. Pretrained models such as
VGG16, InceptionV3, MobileNetV2, and EfficientNetB0 have been employed in
various studies to enhance classification accuracy. Many researchers have utilized
large-scale plant disease datasets, such as the PlantVillage dataset, to train deep
learning models for effective disease identification.
In recent works, transfer learning has been proven to be highly effective in im-
proving the accuracy and efficiency of plant disease detection models. Studies have
demonstrated that models like InceptionV3 and EfficientNetB0 outperform tradi-
tional machine learning approaches due to their deep hierarchical structures and fea-
ture extraction capabilities. Moreover, some implementations integrate deep learning
models with web or mobile applications for real-time disease diagnosis, providing an
accessible solution for farmers. However, challenges such as model overfitting, data
imbalance, and the need for high computational power remain significant concerns
in existing research.
Despite the advancements in deep learning and machine learning for potato leaf
disease detection, several challenges persist. One major limitation is the availability
of diverse datasets, as most studies rely on publicly available datasets that may not
capture real-world variations in lighting, occlusions, and background noise. This re-
sults in poor model generalization when deployed in real-world agricultural settings.
Additionally, high computational costs associated with deep learning models such as
ResNet and Inception make real-time and edge-based implementations challenging.
7
Another key concern is the lack of interpretability in deep learning models, making it
difficult for farmers and agricultural experts to trust automated disease classification
results. Furthermore, few studies explore the integration of deep learning models
with IoT-based agricultural monitoring systems or mobile applications, which could
significantly enhance accessibility and practical implementation.
8
Chapter 3
PROJECT DESCRIPTION
The existing systems for potato leaf disease detection primarily rely on deep
learning-based convolutional neural networks (CNNs) and traditional machine
learning approaches. CNN-based models, such as ResNet, InceptionV3, MobileNet,
and EfficientNet, have shown high accuracy in classifying plant diseases. These
models leverage large datasets, transfer learning techniques, and data augmentation
to improve robustness. Traditional machine learning methods, including Support
Vector Machines (SVMs), Random Forest, and k-Nearest Neighbors (k-NN), have
also been used with feature extraction techniques like Histogram of Oriented
Gradients (HOG) and Principal Component Analysis (PCA). These systems have
demonstrated the potential for automating disease detection and reducing manual
labor in agriculture. However, most of these models are developed and tested in con-
trolled environments, limiting their effectiveness in real-world farming conditions.
Despite their effectiveness, existing systems face several disadvantages that hinder
practical deployment. High computational requirements make deep learning models
unsuitable for real-time and edge-based applications in resource-constrained envi-
ronments. Many models lack generalization, struggling to adapt to different envi-
ronmental conditions, lighting variations, and leaf occlusions in real-world scenar-
ios. Additionally, most models function as black boxes, providing limited inter-
pretability, which reduces trust among farmers and agricultural experts. Another
critical limitation is the dependency on large labeled datasets, which are often un-
available or require extensive manual annotation. Furthermore, few models focus
on disease severity estimation, limiting their usefulness for early intervention strate-
gies. Lastly, integration with IoT and mobile applications remains underexplored,
preventing widespread adoption of automated disease detection systems in precision
agriculture.
9
3.2 Proposed System
The feasibility study of this potato leaf disease detection system evaluates its
viability from technical, economic, and operational perspectives. Technically, the
project is feasible as it utilizes deep learning architectures like CNN, MobileNetV2,
InceptionV3, VGG16, and EfficientNetB0, which are well-established for image
classification tasks. The integration of FastAPI for real-time predictions ensures
smooth deployment and accessibility. The use of pre-trained models reduces the need
for extensive dataset collection and computational resources. Economically, the sys-
tem is cost-effective as it eliminates the need for expensive manual inspections and
10
frequent expert consultations. With minimal infrastructure—such as a smartphone
camera for capturing images and a cloud or local server for processing—the solu-
tion remains affordable. Operationally, farmers and agricultural officers can easily
use the system through a web interface or mobile application, requiring no advanced
technical knowledge. The project ensures a user-friendly experience while deliver-
ing accurate disease diagnosis, making it a practical and efficient solution for the
agricultural sector.
The economic feasibility of the potato leaf disease detection system is analyzed
based on cost-effectiveness, return on investment, and long-term sustainability. The
implementation of deep learning models such as CNN, MobileNetV2, InceptionV3,
VGG16, and EfficientNetB0 significantly reduces the need for manual disease detec-
tion, which traditionally requires expert consultation and laboratory testing. This au-
tomation helps minimize operational costs for farmers and agricultural agencies. The
system is designed to work with easily accessible hardware, such as smartphones or
low-cost cameras, eliminating the need for expensive equipment. Furthermore, since
the model is deployed using FastAPI on a local or cloud-based server, the infras-
tructure cost remains manageable. The use of pre-trained models through transfer
learning minimizes training expenses and computational requirements, making it a
budget-friendly solution. Over time, this system can lead to increased crop yield and
reduced losses due to early disease detection, ensuring a high return on investment
for farmers and agricultural stakeholders.
The technical feasibility of the potato leaf disease detection system is assessed
based on the availability of suitable technologies, infrastructure, and implementa-
tion capabilities. The project leverages deep learning models such as CNN, Mo-
bileNetV2, InceptionV3, VGG16, and EfficientNetB0, which are well-established
for image classification tasks. These models are integrated into the system using Ten-
sorFlow/Keras, ensuring compatibility with various hardware configurations, includ-
ing high-performance GPUs and cloud-based computing environments. The backend
is developed using FastAPI, which offers a lightweight yet robust framework for han-
dling API requests efficiently. Postman is used for testing and validating API end-
11
points, ensuring seamless communication between the frontend and backend. The
system also incorporates data preprocessing techniques such as normalization and
augmentation to improve model accuracy and generalization. Additionally, the web
interface is designed with HTML, CSS, and JavaScript to provide an intuitive user
experience. Overall, the technical stack ensures that the project is scalable, reliable,
and capable of handling real-time predictions effectively.
The social feasibility of the potato leaf disease detection system focuses on its ac-
ceptance, usability, and impact on farmers and agricultural communities. This sys-
tem is designed to empower farmers by providing a reliable and easy-to-use tool for
detecting potato leaf diseases at an early stage. By integrating deep learning technol-
ogy with an intuitive web-based interface, even individuals with minimal technical
knowledge can upload leaf images and receive instant diagnostic results. This re-
duces the dependency on agricultural experts and minimizes the time required for
disease identification. Furthermore, early detection helps in reducing crop losses,
leading to improved food security and economic stability for farmers. The system
also promotes awareness about plant health, encouraging farmers to adopt modern
technological solutions in agriculture. As smartphones and internet connectivity are
becoming more accessible in rural areas, the adoption of this system is expected to
be seamless. Overall, this project enhances agricultural productivity while ensuring
a positive social impact on farming communities.
12
• Software: Python 3.x, FastAPI, TensorFlow/Keras, Postman, VS Code, Web
browser (Chrome/Firefox).
Anaconda Prompt
Anaconda Prompt is a command-line interface primarily used for managing machine
learning and data science environments. It simplifies the installation and execution of
ML frameworks like TensorFlow and Keras. Anaconda Navigator provides access
to various IDEs such as Jupyter Notebook, Spyder, and VS Code, making model
development and deployment more convenient.
Standard Used: ISO/IEC 27001
Jupyter
Jupyter Notebook is an open-source web-based application that facilitates interactive
computing. It allows users to create and share documents that contain live code,
mathematical equations, visualizations, and explanatory text. Jupyter is widely used
for data preprocessing, model training, and result visualization in machine learning
projects.
Standard Used: ISO/IEC 27001
13
Chapter 4
The architecture of the potato leaf disease detection system follows a structured
pipeline to classify potato leaves into Early Blight, Late Blight, and Healthy cat-
egories using the EfficientNetB0 model. It begins with a leaf image dataset that
contains various samples of diseased and healthy leaves. These images undergo
preprocessing, including resizing, normalization, and augmentation, to improve the
model’s learning capability. The dataset is then split into training and validation
sets to ensure the model generalizes well to new data.Next, feature extraction is per-
formed to capture essential image characteristics such as texture, color, and shape.
The extracted features are then used to train the EfficientNetB0 model, which learns
to differentiate between the disease categories. After training, the model undergoes
a testing phase, where it is evaluated with new images to measure its accuracy and
performance. Finally, the system predicts whether a given leaf is affected by Early
Blight, Late Blight, or is Healthy. This architecture ensures an efficient and accurate
deep learning-based disease detection system.
14
4.2 Design Phase
The Data Flow Diagram (DFD) for the Potato Leaf Disease Detection System
illustrates the flow of information from the user to the system and back. The pro-
cess starts with the user uploading a leaf image to the system via a web interface.
The system then preprocesses the image by resizing, normalizing, and augmenting
it to improve model accuracy. After preprocessing, the image is passed to the deep
learning model (EfficientNetB0) for feature extraction and classification. The model
processes the image and generates a prediction, identifying whether the leaf is af-
fected by Early Blight, Late Blight, or is Healthy. The prediction results are then
displayed on the web interface for the user. Additionally, the system stores the re-
sults and user feedback for further analysis and model improvement. This structured
flow ensures a smooth and efficient pipeline for automated plant disease detection,
aiding farmers in taking timely action to protect crops.
15
4.2.2 Use Case Diagram
The Use Case Diagram for the Potato Leaf Disease Detection System illus-
trates the interaction between users and the system. The primary actor, the User
(Farmer/Researcher), uploads an image of a potato leaf, which undergoes prepro-
cessing before being analyzed by a deep learning model for disease classification.
The system then predicts whether the leaf is Healthy, Infected with Early Blight,
or Late Blight and displays the results. Additionally, users can provide feedback
to improve accuracy. The Admin oversees system maintenance, updates the model,
and manages the dataset to enhance performance. This diagram visually represents
the core functionalities and user interactions, ensuring an efficient and user-friendly
workflow for disease detection and decision-making in agriculture.
16
4.2.3 Class Diagram
The Class Diagram for the Potato Leaf Disease Detection System illustrates the
structural relationships between different components involved in the system. It con-
sists of key classes such as User, Frontend, FastAPI Backend, and Trained Model,
each playing a crucial role in the disease detection workflow. The User class inter-
acts with the Frontend to upload leaf images for analysis. The **Frontend** com-
municates with the FastAPI Backend, which processes the image and sends it to the
Trained Model for disease prediction. The Trained Model class utilizes deep learning
techniques to classify the input as Early Blight, Late Blight, or Healthy. The FastAPI
Backend retrieves the prediction result and sends it back to the Frontend, where it is
displayed to the User. The diagram represents associations such as one-to-one and
one-to-many relationships between classes, ensuring efficient communication and
data flow within the system.
17
4.2.4 Sequence Diagram
The given diagram represents a Sequence Diagram for the Potato Leaf Disease
Detection system, illustrating the interaction between different components. The
process begins with the User uploading a leaf image via the Frontend. The Frontend
then sends this image to the FastAPI backend, which serves as the intermediary be-
tween the user and the trained deep learning model. The FastAPI backend forwards
the image to the Trained Model, which processes it and predicts whether the leaf is
healthy or affected by diseases such as Early Blight or Late Blight. The predicted
result is then sent back to the FastAPI backend, which transmits it to the Frontend,
displaying the disease prediction to the user. This diagram effectively captures the
structured data flow and interaction between the user, web interface, backend API,
and the trained deep learning model.
18
4.2.5 Collaboration diagram
The collaboration diagram for the **potato leaf disease detection system** il-
lustrates the interaction between different components, including the **user, web
interface, backend server, deep learning model, and database**. The user uploads an
image of a potato leaf through the web interface, which forwards the request to the
backend server. The backend processes the image and sends it to the deep learning
model for classification. The model analyzes the image and predicts whether the
leaf is healthy or diseased, sending the result back to the backend server. The back-
end then stores the results in the database and sends the final prediction to the web
interface for display. This diagram highlights the communication flow between var-
ious components, ensuring efficient data exchange and real-time disease detection.
It plays a crucial role in understanding the system’s interactions and improving its
scalability, usability, and performance.
19
4.2.6 Activity Diagram
The activity diagram represents the workflow of the potato leaf disease detection
system from user input to result generation. It begins with the user uploading an
image of a potato leaf through the web interface. The image is then preprocessed
to enhance quality and normalize it for model input. The deep learning model (Ef-
ficientNetB0 or others) processes the image and predicts whether the leaf is healthy
or infected with Early Blight or Late Blight. The decision node determines the dis-
ease type, and the result is displayed to the user. This flow ensures efficient disease
classification and provides actionable insights for farmers or researchers.
20
4.3 Algorithm & Pseudo Code
4.3.1 Algorithm
• Preprocessing Step:
1. Define an image preprocessing function (resize and rescale).
2. Resize the input images to match input shape.
3. Normalize pixel values (e.g., scale between 0 and 1).
• Model Initialization:
1. Create a Sequential model.
2. Feature Extraction using EfficientNetB0
3. Load EfficientNetB0 as the base model with pre-trained ImageNet weights.
4. Set include top=False to remove the default classification layer.
5. Define the input shape as input shape.
• Global Feature Aggregation:
1. Apply Global Average Pooling (GAP) to reduce dimensions and extract es-
sential features.
• Fully Connected Layers:
1. The model should contain a dense layer with 256 ReLU-activated neurons
as an essential element of feature learning.
2. Apply Dropout (40%) to reduce overfitting.
3. Add another Dense layer with 128 neurons and ReLU activation for deeper
feature representation.
4. Apply Batch Normalization to stabilize training.
5. Apply Dropout (30%) for regularization.
• Output Layer:
1. For classification, we add a final Dense layer with n classes neurons and
softmax activation.
2. Compile the Model
3. Choose an appropriate optimizer (e.g., Adam).
21
4. Use categorical cross-entropy as the loss function (for multi-class classifica-
tion).
5. Track accuracy as a metric.
• Train the Model:
1. Feed the training dataset into the model.
2. Define batch size and epochs.
3. Use validation data for evaluation.
4. Evaluate and Predict
5. Test the model on unseen images.
6. Return predicted class labels with confidence scores.
The Data Preprocessing Module is responsible for preparing raw potato leaf im-
ages for model training and testing. It includes essential steps such as image resizing,
normalization, and augmentation techniques like rotation, flipping, and brightness
adjustments to enhance model robustness. The dataset is then divided into training,
validation, and testing sets to ensure proper generalization and prevent overfitting.
The preprocessed data is stored and used in subsequent phases of model develop-
ment.
The Model Training and Evaluation Module focuses on training deep learning
models, including EfficientNetB0, VGG16, MobileNetV2, InceptionV3, and CNN,
on the preprocessed dataset. The training process involves defining the model archi-
tecture, choosing an optimizer, selecting a loss function, and evaluating performance
using metrics like accuracy, precision, recall, and F1-score. After multiple itera-
tions, the best-performing model is saved and optimized for real-time testing. The
Real-time Prediction and Web Interface Module integrates the trained model with
a FastAPI backend and a web-based frontend, allowing users to upload images of
potato leaves for disease classification. The system processes the image, runs the
model, and predicts the type of disease with confidence scores. The results are dis-
played on a user-friendly web interface, making it accessible to farmers and agricul-
tural experts for quick and accurate disease identification.
22
4.4 Module Description
The Data Preprocessing Module is responsible for handling raw image data to
ensure it is in an optimal format for training deep learning models. This includes
image resizing to a fixed dimension, normalization to scale pixel values, and data
augmentation techniques such as flipping, rotation, and contrast adjustment to im-
prove model generalization. The dataset is then split into training, validation, and
testing sets to evaluate model performance effectively.
The Model Training and Evaluation Module involves training multiple deep learn-
ing architectures such as CNN, VGG16, MobileNetV2, InceptionV3, and Efficient-
NetB0. The models are trained using labeled datasets with an appropriate loss func-
tion and optimizer. During training, performance metrics like accuracy, precision, re-
call, and F1-score are calculated to assess model effectiveness. The best-performing
model is selected and fine-tuned for optimal predictions.
The Real-time Prediction and Web Interface Module integrates the trained deep
learning model with a FastAPI backend and a user-friendly frontend. Users can up-
load potato leaf images through the web interface, which processes the image and
runs the model to classify diseases. The results, including the disease name and
confidence score, are displayed in real time. This module ensures easy accessibil-
ity for farmers and agricultural experts to identify and manage potato leaf diseases
efficiently.
• Install Python and required libraries (TensorFlow, Keras, OpenCV, NumPy, Pan-
das, Matplotlib, etc.).
23
• Install FastAPI for backend development and React.js (or an equivalent frame-
work) for the frontend.
• Set up a virtual environment using Anaconda to manage dependencies.
• Download the potato leaf disease dataset from a reliable source.
• Preprocess the dataset by resizing, normalizing, and augmenting images.
• Load the dataset and split it into training, validation, and testing sets.
• Implement deep learning models like CNN, VGG16, MobileNetV2, Incep-
tionV3, and EfficientNetB0.
• Train the models using suitable loss functions and optimizers (e.g., Adam, cate-
gorical cross-entropy).
• Evaluate the models based on accuracy, precision, recall, and F1-score.
• Select the best-performing model and save it for deployment.
• Develop a FastAPI backend to load the trained model and process user-uploaded
images.
• Create a frontend using React.js to allow users to upload images for disease
classification.
• Connect the frontend with the backend using API endpoints.
• Test the complete system to ensure correct image processing and accurate dis-
ease predictions.
• Deploy the application on a cloud server or local machine for real-world use.
24
Chapter 5
25
5.2 Testing
To ensure the accuracy, reliability, and efficiency of the potato leaf disease detec-
tion system, various testing strategies are employed. Unit testing verifies individual
components like data preprocessing, model inference, and API responses. Integra-
tion testing ensures smooth interactions between the frontend, FastAPI backend, and
trained model. Functional testing validates the correctness of outputs by testing dif-
ferent image formats and model predictions. Performance testing measures response
time, resource utilization, and model accuracy, while load testing assesses system
stability under concurrent user requests. Usability testing focuses on the user ex-
perience, ensuring a smooth interface for image uploads and predictions. Security
testing safeguards the system against unauthorized access and malicious attacks by
validating input sanitization and API protection. Finally, regression testing ensures
that updates do not break existing functionalities, maintaining consistency in results.
Together, these strategies ensure the system performs optimally and provides accu-
rate disease predictions.
26
Chapter 6
The proposed system is designed for potato leaf disease detection using deep
learning, ensuring high accuracy and efficiency. Unlike traditional machine
learning methods like Decision Trees or Random Forest, this system leverages
convolutional neural networks (CNNs) and transfer learning models such as Effi-
cientNetB0, VGG16, and MobileNetV2. These models extract deep features from
images, improving classification accuracy. The system processes images through
a well-structured pipeline, including data preprocessing, feature extraction, and
classification. The FastAPI-based backend ensures seamless interaction between the
model and the user interface, reducing latency and enhancing real-time prediction
capabilities. Model evaluation metrics such as accuracy, precision, recall, and
F1-score confirm its reliability, with the best-performing model achieving over 99
accuracy, outperforming conventional machine learning techniques.
27
6.2 Comparison of Existing and Proposed System
28
6.4 Comparative Analysis-Graphical Representation and Discussion
29
Chapter 7
7.1 Summary
The Potato Leaf Disease Detection System illustrates the interaction between
various components involved in detecting plant diseases using deep learning. The
key participants in this system include the User, Web UI (Frontend), FastAPI
Backend, Deep Learning Model, and an optional Database for storing past results.
The process begins when the user uploads an image of a potato leaf through the
web interface. The Web UI then forwards this image to the FastAPI backend, which
preprocesses it before passing it to the deep learning model (such as EfficientNetB0,
VGG16, or MobileNetV2). The model analyzes the image and classifies it as healthy
or diseased, providing a diagnostic result. This result is sent back to the FastAPI
backend, which in turn sends it to the Web UI for display to the user. If necessary,
the data can be stored in a database for further reference, enabling historical tracking
of plant health conditions.
30
7.2 Limitations
While the Potato Leaf Disease Detection System offers significant advantages in
identifying plant diseases using deep learning, it also has several limitations. One
major challenge is the dependency on high-quality images for accurate predictions.
Poor lighting conditions, blurred images, or partial leaf visibility can negatively
impact the performance of the model. Additionally, variations in plant growth stages
and environmental conditions may introduce inconsistencies in the dataset, leading
to misclassifications. The system also struggles with **differentiating between
similar disease symptoms** that may appear on potato leaves due to multiple causes
such as nutrient deficiencies, pests, or fungal infections. This limitation can result
in incorrect diagnoses, making it essential to supplement AI-based detection with
expert validation.
To improve the Potato Leaf Disease Detection System, future enhancements can
focus on increasing accuracy, efficiency, and usability. One key improvement would
be enhancing the deep learning model with more diverse and high-quality training
datasets. By incorporating images from different climates, lighting conditions, and
plant growth stages, the model can generalize better and reduce misclassifications.
Additionally, implementing ensemble learning where multiple models such as Effi-
31
cientNetB0, MobileNetV2, and InceptionV3 work together can improve prediction
reliability. Another promising enhancement is real-time image preprocessing, which
can automatically adjust brightness, contrast, and sharpness before sending images
for analysis. This would help in handling poor-quality images uploaded by users.
32
Chapter 8
The Potato Leaf Disease Detection System aligns with several United Nations
Sustainable Development Goals (SDGs)** by leveraging artificial intelligence (AI)
and deep learning to improve agricultural productivity and sustainability. One of
the most relevant SDGs is SDG 2: Zero Hunger, as this project directly contributes
to food security and sustainable agriculture. By enabling early detection of potato
leaf diseases, farmers can take timely action to prevent crop losses, ensuring higher
yields and reducing the risk of food shortages. This technology helps optimize
agricultural practices, making farming more efficient and resilient against plant
diseases.
33
tices. Lastly, the project contributes to SDG 13: Climate Action by promoting smart
agricultural techniques that help mitigate the impact of plant diseases exacerbated by
climate change. By improving disease management, this system supports sustainable
food production and enhances resilience in agricultural communities worldwide.
The Potato Leaf Disease Detection System offers significant social benefits,
particularly for small-scale and underserved farming communities. By providing an
accessible and affordable AI-based diagnostic tool, this project helps farmers detect
diseases early, reducing crop losses and improving food security. In many rural ar-
eas, farmers lack access to agricultural experts or laboratories for disease diagnosis.
This system bridges the gap by offering an easy-to-use digital solution that works
with just a smartphone and an internet connection. Additionally, it promotes digital
inclusion by introducing AI-driven precision farming to communities that may not
have prior exposure to advanced agricultural technologies. The platform can also
serve as an educational tool, enabling farmers to learn about different potato diseases
and best practices for managing them, further empowering them with knowledge.
34
agricultural sensors, the system can operate efficiently without excessive energy con-
sumption. This aligns with global efforts to reduce the carbon footprint of farming
activities, supporting sustainable agriculture and climate resilience.
The Potato Leaf Disease Detection System directly contributes to SDG 2: Zero
Hunger by enhancing food security and agricultural productivity through early dis-
ease detection, preventing crop losses, and supporting small-scale farmers with AI-
driven precision farming. By enabling timely intervention, it helps improve yields,
farmer incomes, and overall food availability. Additionally, the project aligns with
SDG 12: Responsible Consumption and Production by reducing excessive pesticide
use, which lowers soil contamination and water pollution. With accurate disease
classification, farmers apply treatments only when necessary, promoting sustainable
farming practices. The system also supports resource optimization, ensuring effi-
cient use of water, fertilizers, and land. Furthermore, by deploying the model on
low-power edge devices, it minimizes energy consumption, making AI adoption in
agriculture more environmentally friendly. These contributions help create a more
resilient and sustainable agricultural ecosystem, benefiting both food security and
environmental conservation.
35
Chapter 9
PLAGIARISM REPORT
36
Chapter 10
SOURCE CODE
7 # Load d a t a s e t
8 t r a i n d a t a g e n = ImageDataGenerator ( r e s c a l e =1./255 , v a l i d a t i o n s p l i t =0.2)
9 train generator = train datagen . flow from directory (
10 ’ dataset / ’ ,
11 t a r g e t s i z e =(224 , 224) ,
12 b a t c h s i z e =32 ,
13 class mode= ’ c a t e g o r i c a l ’ ,
14 subset=’ training ’ )
15
23 # B u i l d Model ( E f f i c i e n t N e t B 0 )
24 base model = t f . keras . a p p l i c a t i o n s . EfficientNetB0 ( weights= ’ imagenet ’ , i n c l u d e t o p =False , input shape
=(224 , 224 , 3) )
25 base model . t r a i n a b l e = False
26
27 model = t f . k e r a s . S e q u e n t i a l ( [
28 base model ,
29 t f . keras . l a y e r s . GlobalAveragePooling2D ( ) ,
30 t f . k e r a s . l a y e r s . Dense ( 1 2 8 , a c t i v a t i o n = ’ r e l u ’ ) ,
31 t f . k e r a s . l a y e r s . Dropout ( 0 . 3 ) ,
32 t f . k e r a s . l a y e r s . Dense ( t r a i n g e n e r a t o r . n u m c l a s s e s , a c t i v a t i o n = ’ s o f t m a x ’ )
33 ])
34
35 model . c o m p i l e ( o p t i m i z e r = ’ adam ’ , l o s s = ’ c a t e g o r i c a l c r o s s e n t r o p y ’ , m e t r i c s = [ ’ a c c u r a c y ’ ] )
36
37 # T r a i n Model
37
38 model . f i t ( t r a i n g e n e r a t o r , v a l i d a t i o n d a t a = v a l g e n e r a t o r , e p o c h s = 1 0 )
39
40 # Save Model
41 model . s a v e ( ” p o t a t o d i s e a s e m o d e l . h5 ” )
42
43 # ## 2 . F a s t A P I Backend ( API f o r P r e d i c t i o n s )
44 from f a s t a p i i m p o r t F a s t A P I , F i l e , U p l o a d F i l e
45 from t e n s o r f l o w . k e r a s . m o d e l s i m p o r t l o a d m o d e l
46 from t e n s o r f l o w . k e r a s . p r e p r o c e s s i n g i m p o r t image
47 i m p o r t numpy a s np
48 import uvicorn
49 import io
50 from PIL i m p o r t Image
51
52 app = F a s t A P I ( )
53 model = l o a d m o d e l ( ” p o t a t o d i s e a s e m o d e l . h5 ” )
54 class names = [ ’ Healthy ’ , ’ Early Blight ’ , ’ Late Blight ’ ]
55
56 @app . p o s t ( ” / p r e d i c t ” )
57 async def p r e d i c t ( f i l e : UploadFile = F i l e ( . . . ) ) :
58 contents = await f i l e . read ( )
59 img = Image . open ( i o . B y t e s I O ( c o n t e n t s ) ) . r e s i z e ( ( 2 2 4 , 2 2 4 ) )
60 i m g a r r a y = np . a r r a y ( img ) / 2 5 5 . 0
61 i m g a r r a y = np . e x p a n d d i m s ( i m g a r r a y , a x i s = 0 )
62 p r e d i c t i o n = model . p r e d i c t ( i m g a r r a y )
63 p r e d i c t e d c l a s s = c l a s s n a m e s [ np . argmax ( p r e d i c t i o n ) ]
64 c o n f i d e n c e = np . max ( p r e d i c t i o n )
65 r e t u r n {” d i s e a s e ” : p r e d i c t e d c l a s s , ” co n fi d en ce ” : f l o a t ( co n fi d en c e ) }
66
67 if name == ” main ”:
68 u v i c o r n . r u n ( app , h o s t =” 0 . 0 . 0 . 0 ” , p o r t = 8 0 0 0 )
69
70 # ## 3 . F r o n t e n d ( S i m p l e HTML Form f o r U p l o a d i n g I m a g e s )
71 <!DOCTYPE html>
72 <html>
73 <head>
74 < t i t l e >P o t a t o D i s e a s e D e t e c t i o n </ t i t l e >
75 </ head>
76 <body>
77 <h2>Upload a P o t a t o L e a f Image f o r D i s e a s e D e t e c t i o n </h2>
78 <i n p u t t y p e =” f i l e ” i d =” f i l e I n p u t ”>
79 <b u t t o n o n c l i c k =” u p l o a d I m a g e ( ) ”>P r e d i c t </ b u t t o n >
80 <p i d =” r e s u l t ”></p>
81 <s c r i p t >
82 async f u n c t i o n uploadImage ( ) {
83 let f i l e = document . g e t E l e m e n t B y I d ( ” f i l e I n p u t ” ) . f i l e s [ 0 ] ;
84 l e t f o r m D a t a = new FormData ( ) ;
85 formData . append ( ” f i l e ” , f i l e ) ;
86
38
88 method : ”POST” ,
89 body : f o r m D a t a
90 }) ;
91 l e t r e s u l t = await response . json () ;
92 document . g e t E l e m e n t B y I d ( ” r e s u l t ” ) . i n n e r T e x t = ‘ D i s e a s e : ${ r e s u l t . d i s e a s e } , C o n f i d e n c e : $
{ r e s u l t . confidence } ‘;
93 }
94 </ s c r i p t >
95 </body>
96 </ html>
39
References
[1] [D. Tiwari, et al., ”Potato leaf diseases detection using deep learning,” 2020 4th
International Conference on Intelligent Computing and Control Systems (ICI-
CCS), IEEE, 2020.
[2] A. Arshaghi, M. Ashourian, and L. Ghabeli, ”Potato diseases detection and clas-
sification using deep learning methods,” Multimedia Tools and Applications, vol.
82, no. 4, pp. 5725-5742, 2023.
[3] R. Mahum, et al., ”A novel framework for potato leaf disease detection using
an efficient deep learning model,” Human and Ecological Risk Assessment: An
International Journal, vol. 29, no. 2, pp. 303-326, 2023.
[5] M. A. Iqbal and K. H. Talukder, ”Detection of potato disease using image seg-
mentation and machine learning,” in 2020 International Conference on Wireless
Communications Signal Processing and Networking (WiSPNET), IEEE, pp. 43-
47, Aug. 2020.
40
20, no. 16, pp. 2102-2106, 2022.
[8] A. Singh and H. Kaur, ”Potato plant leaves disease detection and classification
using machine learning methodologies,” in IOP Conference Series: Materials
Science and Engineering, vol. 1022, no. 1, p. 012121, IOP Publishing, 2021.
[9] J. Rashid, et al., ”Multi-level deep learning model for potato leaf disease recog-
nition,” Electronics, vol. 10, no. 17, p. 2064, 2021.
[11] J. A. Pandian, et al., ”Plant disease detection using deep convolutional neural
network,” Applied Sciences, vol. 12, no. 14, p. 6982, 2022.
[12] P. Bansal, R. Kumar, and S. Kumar, ”Disease detection in apple leaves using
deep convolutional neural network,” Agriculture, vol. 11, no. 7, p. 617, 2021.
[14] J. A. Pandian, et al., ”A five convolutional layer deep convolutional neural net-
work for plant leaf disease detection,” Electronics, vol. 11, no. 8, p. 1266, 2022.
[15] S. M. Hassan and A. K. Maji, ”Plant disease identification using a novel convo-
lutional neural network,” IEEE Access, vol. 10, pp. 5390-5401, 2022.
41