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

Mca project

The document discusses the development of an AI-driven Leaf Disease Prediction and Management System aimed at improving agricultural practices by enabling early detection of plant diseases through advanced machine learning techniques. It highlights the significant impact of plant diseases on crop yield and economic stability, emphasizing the need for reliable and efficient detection methods. The system utilizes convolutional neural networks (CNNs) to analyze leaf images, categorize diseases, and provide actionable insights to promote sustainable farming practices.

Uploaded by

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

Mca project

The document discusses the development of an AI-driven Leaf Disease Prediction and Management System aimed at improving agricultural practices by enabling early detection of plant diseases through advanced machine learning techniques. It highlights the significant impact of plant diseases on crop yield and economic stability, emphasizing the need for reliable and efficient detection methods. The system utilizes convolutional neural networks (CNNs) to analyze leaf images, categorize diseases, and provide actionable insights to promote sustainable farming practices.

Uploaded by

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

Ai-Driven Leaf Disease Prediction and Management

System

CHAPTER-1
INTRODUCTION
Millions of people's lives around the world depend on agriculture, which is essential to both
economic stability and global food security. However, plant diseases brought on by bacteria,
viruses, fungus, and other environmental factors continue to pose a threat to the agricultural sector.
If these illnesses are not treated quickly, they can have a major negative effect on crop quality and
production, resulting in financial losses and a shortage of food. According to estimates from the
Food and Agriculture Organisation (FAO), pests and diseases that affect plants cause 10–16% of
crop losses worldwide each year, resulting in losses worth approximately $220 billion.

Traditional disease detection methods often depend on farmers' or specialists' visual inspections,
which are labour intensive, prone to human error, and ineffective for extensive surveillance. The
growth of artificial intelligence (AI) offers an innovative technique to these problems. AI-driven
solutions offer an automated, scalable, and precise solution for early disease identification and
management by combining deep learning, image processing, and machine learning approaches.
This is especially important for leaf diseases, where prompt action can lessen the impact on crop
output and stop infections from spreading quickly.

AI systems can analyse leaf images, spot infection patterns, and accurately categorise diseases by
utilizing convolutional neural networks (CNNs) and other deep learning models. The goal of this
research is to create an AI-powered Leaf Disease Prediction and Management System that gives
farmers a practical, real-time tool for predicting and controlling plant diseases. The suggested
technique seeks to identify a range of leaf diseases in several crops by using intelligently chosen
datasets of photos of healthy and sick leaves.

In addition to diagnosing illnesses, the system offers useful information for focused interventions,
lowering the need for chemical treatments and encouraging sustainable farming methods. With
this effort, we hope to address the urgent demand for cutting-edge technologies to improve crop
management and food security while also adding to the expanding body of knowledge on AI
applications in agriculture. This introduction sets the stage for a thorough examination of methods,
test results, and AI's revolutionary potential to improve the accuracy of plant monitoring.
1 of 57
Ai-Driven Leaf Disease Prediction and Management
System

1.0 Project Objective:

The primary objective of plant disease detection is to identify and diagnose plant diseases
accurately and quickly. This is important to prevent the spread of the disease and to minimize
crop loss. Early detection of plant diseases is crucial to prevent the spread of the disease and
to minimize crop damage. Disease detection using Machine Learning Algorithms should be
reliable and produce consistent results.

1.1 Plant Leaf Disease:

Fig.1.1 Different types of leaves

A disturbance in the stock situation of herb that destroys or alters crucial. All types of herbs, both
unbroken and educated, are susceptible to illness. Each family is prone to specific diseases, but
each of these is relatively rare. The incidence and prevalence of plant illness vary from prime to

2 of 57
Ai-Driven Leaf Disease Prediction and Management
System

prime, pivoting on the company of pathogens, territory conditions, and the supply and cultivars
grown. Some plant varieties are particularly susceptible to disease epidemics, while others are
more resilient. See also list of herb illness.

1.2 Definitions of plant disease:

Generally, when plants are consistently disturbed, they might catch illness. pathogens that
result in abnormal physiological processes that disrupt the normal structure, growth,
function, or other activities of the plant. The essential physiological or biochemical
processes of the plant are disrupted, which results in the typical diseased states or symptoms.

Depending on whether the primary cause of the disease is infectious or non- infectious,
plant diseases may be broadly categorised. Infectious plant diseases are caused by pathogens
such as fungi, bacteria, mycoplasma, viruses, viroids, nematodes, or parasitic flowering
plants. Within or on a host, infectious organisms can grow and spread from one vulnerable
host to another. Unfavorable growth circumstances, including as excessive temperatures,
unfavorable moisture-oxygen ratios, soil and air pollutants, and an abundance or shortage of
vital minerals, are the root causes of non-infectious plant illnesses.

1.3 Temperature:
All pathogens have an optimum growth temperature. In addition, the optimal temperature may
differ slightly due to different stages of fungal growth, such as the production spores (reproductive
units), their germination, and the growth of the mycelium (the filamentous body of the fungus).
Warehouse conditions for certain berry, greens, and nest produce are manipulated to control fungi
and bacteria that cause storage spoilage, so long as the febricity does not alter the quality of the
produce.

Aside from limited dip protection, there is little you can do to control the temperature in
your field, but you can adjust the temperature in your greenhouse to reduce disease outbreaks.
Combined with high humidity conditions, it allows the development of diseases such as vine
downy mildew (Pseudo peronospora cubensis), lima bean (Phytophthora phaseoli) and late
blight on potatoes. These include precision tomato (Phytophthora infestans), sugar beet leaf

3 of 57
Ai-Driven Leaf Disease Prediction and Management
System

spot.However, temperature effects can mask the symptoms of certain aggressive and
mycoplasmal diseases, making them more onerus to detect.

1.4 Relative humidity:


Relative moisture is exact important for the germination of fungal spores and the evolution of
warehouse rot. Rhizopus stolonifer of sweet potatoes is an example of a storage illness that does
not evolution when the relative moisture of the black skin of potatoes is maintained between 85-
90%, even though the storage temperature is optimal for the growth of the pathogen. Under these
conditions, sweet potato roots produce a slippery (corky) tissue that protects the Rhizopus fungus.
You are more likely to get sick. Humidity is generally required for spore germination, bacterial
growth and invasion, and allusion of infection. Mustiness germinate best at 90-95% relative
humidity. Disease of Greenhouse crops such as Botrytis species rotting herbs, leaves, stems and
seedlings of herbs plants are controlled by reducing humidity levels or not spraying the plants with
water.

1.5 Soil pH:

As a gauge of bite, soil pH has a significant impact on conditions like: B. Cruciferous plant
gall root and potato scab (Plasmodiophora cruciferous).5.2pH or lower inhibits the growth
of potato scab (pH 7 is neutral; values below 7 indicate acidity, values over 7 indicate
alkalinity). If the pH of the natural soil is about 5.2, scabs are typically okay. To keep the
pH of their potato soil at 5.0, some growers use sulphur. On the other hand, by thoroughly
incorporating lime into the soil until the pH is 7.2 or higher, it is typically possible to control
the root knot of cruciferous vegetables.

4 of 57
Ai-Driven Leaf Disease Prediction and Management
System

Fig.1.2 Infectious leaves

5 of 57
Ai-Driven Leaf Disease Prediction and Management
System

1.6 Requirements for disease development:


If any one of the following three fundamental requirements is absent, infectious illness cannot
occur:(1) the right conditions, with the most crucial conditions being the quantity and frequency
of rain or heavy dews, the relative humidity, and the temperatures of the air and soil, (2) the
presence of a virulent pathogen, and (3) a vulnerable host.

Breaking this triangle between environment, pathogen, and host is the goal of efficient
disease prevention strategies. For instance, if the host can be made more resistant or immune

6 of 57
Ai-Driven Leaf Disease Prediction and Management
System

by methods like plant breeding or genetic engineering, the loss brought on by the disease is
lessened. In addition, the environment might be changed to promote the growth of the host
plant more than the invasion of the pathogen. Finally, the infection can be eliminated or
stopped from spreading.

1.7 Classification of plant diseases by causal agent:

The physiological effects or symptoms of plant diseases are frequently used to categorise
them. However, many diseases have essentially same symptoms and signs but are brought
on by totally different bacteria or substances, necessitating the employment of entirely
different control strategies. The classification of diseases based on their symptoms is also
insufficient because a causal agent may generate a variety of symptoms, even on the same
plant organ, several of which frequently coexist.

The classification may take the afflicted plant species into account. Host indexes, or listings
of diseases known to affect particular hosts in particular areas, nations, or continents, are
useful in the diagnosing process. When an apparently novel disease is discovered on a well-
known host, looking up the host's entry in the index frequently identifies the responsible
agent. Diseases can also be categorized.

1.8 Non-infectious disease-causing agents:

Unfavorable soil moisture-oxygen relations, extremes in soil acidity or alkalinity, high or low
temperatures, pesticide injury, other poisonous chemicals in the air or soil, changes in soil grade,
girdling of roots, mechanical and electrical agents, and soil compaction are all factors that
contribute to the development of non-infectious diseases, which can sometimes occur very
suddenly.
Losses are frequently caused by unsuitable pre-harvest and storage conditions for fruits,
vegetables, and nursery stock. Numerous plant species that are present in a certain area or
environment might be affected by non-infectious diseases. Non infectious diseases and
injuries frequently result in severe losses yet are challenging to prevent or treat because they
frequently reflect ecological conditions that are out of human control.

7 of 57
Ai-Driven Leaf Disease Prediction and Management
System

Several weeks or months after an environmental disturbance, symptoms may start to


manifest. Accidental, poisonous, or severe environmental injuries frequently leave a plant
with weak tissues that allow bacteria, fungus, or viruses to penetrate and cause even more
harm. A clear reason, like hail or lightning, may be present, although this is not always the
case. It is frequently difficult to determine the causal component solely from symptoms. A
detailed analysis of current weather patterns, the health of nearby plants, and cultural.

1.9 Infectious disease-causing agents:

Thousands of species from incredibly varied families of creatures can infect plants. Few are
macroscopic, while the majority are tiny. The infectious agents, also known as pathogens, include
bacteria, fungi, nematodes, generally known as mycoplasma-like organisms (MLOs), and parasitic
seed herbs.

1.10 Diseases caused by viruses and viroids:


1.7.3.1 General characteristics

Of all the infectious agents, viruses and viroids are the tiniest. A virion is an infectious
particle that has reached structural maturity. The sizes and forms of virions range from about
20 nanometers (0.0000008 inch) to 250-400 nanometers. In contrast to viruses, viroids lack
structural proteins, such as those that make up the protein coat (capsid) of viruses. Both
viruses and viroids are obligatory parasites, meaning they can only replicate or multiply
inside a specific host's live cell. A single plant species could be vulnerable to a variety of
viruses or viroids. Viral infection causes serious disease in essential .

1.11 Diseases caused by fungi:

An estimated two thirds of infectious plant illnesses are caused by fungi. All commercially
significant plants appear to be under the attack of one or more fungi, and in many cases,
many fungi from different species can affect a single plant species.

8 of 57
Ai-Driven Leaf Disease Prediction and Management
System

1.11.1 General characteristics

The fungus are a very varied and expansive class of eukaryotic microorganisms. The cells
lack chlorophyll and have hard cell walls. They also have a membrane-bound nucleus. Many
fungi have a vegetative body that resembles a plant made of microscopic branching
filaments of different lengths, known as hyphae (plural hypha), some of which extend into
the air and others of which pierce the substrate on which they develop.

The network of hyphae is known as the mycelium. The "cottony" or "fuzzy" appearance of
fungal growth is caused by the mycelium's bulk. Fungi can reproduce in a number of ways,
including asexual and sexual ones. They generate enormous amounts of spores of various
types. For instance, a piece of mouldy bread gets its colour from.

1.12 Diseases caused by nematodes:

Roundworms with no segments that are active and parasitic on plants are called nematodes. (also
called nemas or eelworms). Due to their size and transparency, the vast majority cannot be seen
with the unassisted eye. Practically all adult forms have a length between 0.25 and 2 mm. Plant
disease is caused by about 1,200 species.
At least one species of nematode feeds on practically every type of plant life. Although they
mostly dwell dirt and prey on tiny roots, several species also live in and feed on bulbs, buds,
stems, leaves, and flowers. Nematodes that live on plants as parasites feed by suckling their
juices.

A hollow, needle-like mouthpart known as a spear or stylet is used for feeding. When the
stylet is pushed into plant cells, the nematode injects a liquid containing enzymes that break
down the contents of the cells. The stylet is then used to draw the liquid contents back into
the nematode's digestive system.

Nematode feeding decreases natural resistance, weakens plant vigour and yield, and
provides a simple entry point for nematodes that cause root rot or wilt. Plants with nematode
infestations are fragile and frequently exhibit symptoms of disease, excessive soil moisture,
sunburn, frost, a mineral shortage or imbalance, and insect damage to the roots or stems.
Stunting and a loss of green colour are typical signs of nematode injury.
9 of 57
Ai-Driven Leaf Disease Prediction and Management
System

When tissues react, cells frequently either grow or degenerate; occasionally both. Numerous
native nematodes prey on cultivated plants when their natural hosts are eliminated. Others
have been spread by seedling plants, bulbs, tubers, and in particular in the soil that has
gathered around the roots of infected nursery stock.

Nematodes may spend some of their time unencumbered in the soil near roots or in fields
and fallow gardens. They can enter a plant by wounds, natural holes, or by entering roots.
They can also tunnel inside plant tissues (endoparasites) or feed externally from the surface
(ectoparasites). For reproduction, all nematodes that parasitize plants need living plant
tissues. Nematodes are drawn to host roots by the perception of either the heat that roots
emit or the substances that roots release.

Most species go through four stages of development, from egg to adult and back to egg, in
a generation that takes 20 to 60 days to complete. Even while some nematodes only have
one generation each year, they still generate several hundred young.

The duration the growing season, temperature, the amount of water and nutrients available,
as well as the type, texture, and structure of the soil, all have an impact on soil populations
and nematode development rates. Populations of viruses, protozoans, mites, flatworms, or
other pests, as well as other nematodes and nematode-parasitic bacteria are also significant.
Crop rotations and previous cropping practices, toxic substances applied to the soil or
released by plant roots, species, variety, age, and nutrition.

1.13 Importance of Leaf Disease Detection:

It is Important for Correct Plant Disease Identification? Disease control initiatives may result in a
waste of time and resources without accurate identification. Additional plant losses could result
from the application of disease control strategies that are inadequate to handle the disease-causing
agent. Infectious parasites including nematodes, fungi, Oomycetes, viruses, and bacteria are the
root cause of plant illnesses. Because a large range of organisms can cause a variety of symptoms
(Figure 1), accurate pathogen identification is essential to creating a management plan. Injury vs.
Illness It's critical to comprehend the distinctions between a plant injury and a disease. A sudden
injury results from an outside force over a brief period of time.

10 of 57
Ai-Driven Leaf Disease Prediction and Management
System

1.13 Techniques Used For Leaf Disease Detection:

1.10.1 Machine Learning Methods

1. Introduction to CNN

Convolutional Neural Networks (CNNs) are a type of deep learning algorithm specifically
designed for image recognition and classification tasks. In this project, CNN is employed to
analyze images of plant leaves and detect diseases accurately. The algorithm processes image data
to identify patterns, textures, and features associated with different diseases.

2. Why CNN for Leaf Disease Detection?


Feature Extraction: Automatically detects intricate features in leaf images, such as spots,
discoloration, and shapes.
High Accuracy: Outperforms traditional machine learning algorithms in image-based tasks.
Scalability: Adapts well to large datasets and various disease types.

11 of 57
Ai-Driven Leaf Disease Prediction and Management
System

3. CNN Architecture for Leaf Disease Detection


The architecture typically includes the following layers:
1. Input Layer
Accepts leaf images as input.
Images are resized (e.g., 128x128 or 224x224 pixels) for uniform processing.

2. Convolutional Layer
Applies filters (kernels) to extract features like edges, textures, and patterns.
Example: A 3x3 filter slides over the image, producing feature maps.
3. Activation Layer (ReLU)

Introduces non-linearity to ensure the model learns complex patterns.


ReLU replaces negative pixel values with zero.

4. Pooling Layer
Reduces the spatial dimensions of feature maps (e.g., Max Pooling).
Example: A 2x2 pooling layer takes the maximum value in each 2x2 region.

5. Fully Connected Layer


Combines features learned from previous layers to classify the image into disease categories.

6. Output Layer
Provides the final prediction using a softmax activation function.
Outputs the probability of each disease class.

4. Steps in CNN Implementation


1. Data Collection
Collect a dataset of diseased and healthy leaf images.
Use data augmentation (e.g., rotation, flipping, scaling) to increase dataset size.

12 of 57
Ai-Driven Leaf Disease Prediction and Management
System

2. Pre-processing
Normalize image pixel values (e.g., scale between 0 and 1).
Convert images to grayscale or keep them as RGB, depending on requirements.

3. Model Training
Split the dataset into training, validation, and testing sets.
Train the CNN model on the training set while monitoring performance on the validation set.
4. Evaluation
Test the model using unseen data to evaluate accuracy, precision, recall, and F1 score.
5. Deployment
Save the trained model and integrate it into the system for real-time predictions.

5. Advantages of CNN in This Project


Automated Feature Extraction: Eliminates the need for manual feature engineering.
Robustness: Handles variations in lighting, angle, and background effectively.
Versatility: Can be fine-tuned for different crops and diseases.

6. Challenges and Solutions


1. Challenge: Insufficient Data
Solution: Use data augmentation and transfer learning with pre-trained models like VGG16
2. Challenge: Overfitting
Solution: Employ dropout layers and regularization techniques.
3. Challenge: Computational Intensity
Solution: Use GPUs for faster training and inference.
8. Conclusion
Using CNN in the Leaf Disease Prediction and Management System significantly enhances the
accuracy and efficiency of disease detection. Its ability to learn complex patterns and adapt to
diverse datasets makes it an ideal choice for the project, ensuring timely and effective disease
management.

13 of 57
Ai-Driven Leaf Disease Prediction and Management
System

CHAPTER -2

LITERATURE SURVEY
Artificial intelligence (AI) in agriculture has created new possibilities for resolving longstanding
issues like Prediction and detection of leaf diseases. A thorough review of previous research
reveals important advancements in using AI to forecast diseases while also pointing out areas in
need of more investigation and creativity.

2.1 Traditional Methods and Challenges

In the past, farmers or agricultural specialists have had to visually inspect plants to detect diseases.
These techniques are time-consuming, labour-intensive, and prone to human error, even though
they work well in localised contexts. According to studies, a delayed or incorrect diagnosis causes
significant yield losses and the quick spread of diseases. Large-scale farming operations find
manual observation especially impracticable, which emphasises the need for automated and
scalable possibilities.

2.2 AI and Machine Learning in Disease Detection

The development of artificial intelligence (AI) has completely changed disease prediction
methods by making it possible to employ machine learning (ML) and deep learning (DL)
algorithms for increased precision and effectiveness. To identify diseases from leaf photos,
researchers have investigated a variety of AI models, including Convolutional Neural Networks
(CNNs), which are particularly good at image identification tasks. For example, Mohanty et al.
(2016) used publicly available datasets to show how CNNs could identify 26 plant diseases with
an accuracy of over 99%. Another study by Ferentinos (2018) demonstrated how AI models may
be tailored to a variety of datasets by using deep learning to accurately diagnose plant diseases
across 58 classifications. These strategies demonstrate how AI-driven systems can overcome the
drawbacks of conventional techniques, like subjective interpretation and delayed diagnosis.

14 of 57
Ai-Driven Leaf Disease Prediction and Management
System

2.3 Hybrid Techniques and Multimodal

Approaches In order to improve disease detection, recent research has focused on integrating AI
with other technologies. For instance, deep learning algorithms combined with drone-based image
systems allow for real-time agriculture surveillance. Research has demonstrated that by capturing
information outside of the visible spectrum, hybrid techniques that combine spectral imaging with
AI models increase the precision of disease detection.

2.4 Data Challenges and Model Optimization

The quality and availability of datasets with annotations are two major obstacles to the widespread
use of AI in agriculture. Despite their size, public databases like PlantVillage may not accurately
reflect heterogeneity in the actual world, which is why numerous scholars rely on them. In order
to improve the resilience and generalisation of the model, methods including data augmentation,
transfer learning, and domain adaptation are used. Additionally, researchers that want to attain
better performance have focused on optimising hyperparameters in AI models. To balance model
complexity and inference speed, for example, research has looked into different CNN model
including ResNet and YOLO. Lightweight models are frequently given priority in real-time
applications to guarantee field viability.

2.5 Evaluation Metrics and Model Effectiveness

A key aspect of AI-driven systems is performance evaluation. Model performance is often


evaluated using metrics like accuracy, precision, recall, and F1-score. However, research indicates
that with unbalanced datasets, concentrating only on accuracy may be deceptive. In order to better
analyse model efficacy, researchers stress the use of metrics like as confusion matrices and area
under the receiver operating characteristic curve (AUC-ROC).

2.6 Applications and Impact

Beyond disease diagnosis, AI is being used practically in agriculture for precision irrigation, yield
prediction, and pest control. AI has the ability to empower farmers with useful insights that will
enhance their decision-making and resource management, according to research by platforms such
as Plantix and Farm Beats. These developments highlight how artificial intelligence is
revolutionizing sustainable farming methods.
15 of 57
Ai-Driven Leaf Disease Prediction and Management
System

2.7 Gaps and Future Directions

Even though there have been notable advancements, difficulties still exist. Model performance is
impacted by the fluctuation of environmental factors like lighting and plant orientation. Moreover,
the generalise ability of AI systems is restricted by the absence of varied, annotated datasets. In
order to improve accuracy and usability, future research should concentrate on building extensive
datasets, enhancing model interpretability, and combining multimodal data sources. The literature
concludes by emphasising the revolutionary potential of AI-powered leaf disease prediction
systems. These technologies have the potential to transform crop health monitoring and open the
door to a more resilient and sustainable agricultural industry by tackling present issues and
expanding on recent advancements.

16 of 57
Ai-Driven Leaf Disease Prediction and Management
System

CHAPTER -3

REQUIREMENT ANALYSIS
1. Introduction

The Leaf Disease Prediction and Management System aims to help farmers and agricultural
professionals identify plant diseases using AI/ML techniques. It provides actionable solutions to
manage and mitigate the impact of the diseases.

2. Purpose

Detect plant leaf diseases early to minimize crop loss.

Provide real-time actionable management solutions.

Offer an easy-to-use platform for farmers, researchers, and agronomists.

3. Stakeholders

Primary Stakeholders: Farmers, agricultural researchers, plant pathologists.

Secondary Stakeholders: Agricultural organizations, policymakers, and software developers.

4. Functional Requirements

1. Data Input

Capture images of leaves via camera or upload pre-captured images.

Support multiple formats like JPEG, PNG, etc.

2. Disease Detection

Use machine learning algorithms to identify diseases from images.

Provide disease names, severity levels, and affected crops.

3. Database Management

Maintain a database of common plant diseases, symptoms, and control measures.

Store user-uploaded data for analysis and feedback.

17 of 57
Ai-Driven Leaf Disease Prediction and Management
System

4. Recommendation System

Provide actionable solutions for identified diseases (e.g., pesticides, organic methods).

Suggest preventive measures for future occurrences.

5. User Management

Enable users to register and log in.

Save user activity and preferences for personalized recommendations.

6. Multilingual Support

Provide support for multiple languages to cater to diverse user groups.

7. Reporting and Analytics

Generate detailed reports of detected diseases and management activities.

Visualize disease trends over time for a specific area.

18 of 57
Ai-Driven Leaf Disease Prediction and Management
System

5. Non-Functional Requirements

1. Performance

Ensure real-time disease detection with minimal latency.

2. Scalability

Handle a large number of users and image uploads simultaneously.

3. Reliability

Provide accurate disease predictions with minimal false positives/negatives.

4. Usability

Ensure the system is easy to use, even for non-technical users.

5. Security

Protect user data with encryption.

Ensure secure authentication and authorization mechanisms.

6. Availability

Offer 24/7 availability with minimal downtime.

19 of 57
Ai-Driven Leaf Disease Prediction and Management
System

CHAPTER - 4

EXISTING SYSTEM

In traditional agricultural practices, identifying and managing leaf diseases rely on manual
observation by farmers or agricultural experts. These systems have been used for decades, but
they exhibit several limitations in terms of efficiency and accuracy.

Existing Methods
1. Manual Inspection

Farmers or agronomists visually inspect crops to identify signs of diseases such as spots,
discoloration, or deformation.

Decisions are based on experience and knowledge.

2. Use of Expert Consultation

Farmers consult plant pathologists or agricultural experts for diagnosis and advice.

This process is time-consuming and often limited to accessible regions.

3. Existing Applications

Some mobile applications and tools exist for detecting plant diseases using image analysis.

However, these applications have limited databases, lower accuracy, or lack localized
recommendations.

Limitations of the Existing System


Inaccuracy

Manual inspection is prone to human error, especially for rare or complex diseases.

Time-Consuming
20 of 57
Ai-Driven Leaf Disease Prediction and Management
System

Consulting experts or researching symptoms can delay disease detection and treatment.

Resource-Intensive

Requires extensive knowledge and experience, which may not always be available in remote
areas.

Lack of Preventive Measures

The focus is primarily on treatment after disease onset, rather than proactive prevention.

21 of 57
Ai-Driven Leaf Disease Prediction and Management
System

CHAPTER - 5

PROPOSED METHOD
The proposed Leaf Disease Prediction and Management System is an AI-driven solution
designed to overcome the limitations of the existing system. It leverages advanced image
processing and machine learning techniques to identify plant leaf diseases accurately and
provides actionable recommendations for disease management and prevention.

Features of the Proposed System


1. Automated Disease Detection

Use of AI/ML algorithms to analyse leaf images and identify diseases with high accuracy.

Real-time predictions to aid timely decision-making.

2. Comprehensive Disease Database

A well-maintained database of common plant diseases, symptoms, and affected crops.

Regular updates to include new diseases and management strategies.

22 of 57
Ai-Driven Leaf Disease Prediction and Management
System

3. Actionable Recommendations

Suggestions for effective disease control measures, including chemical, organic, and cultural
practices.

Preventive measures to reduce the risk of recurrence.

4. User-Friendly Interface

Easy-to-use mobile or web application for farmers, researchers, and agricultural experts.

Multilingual support to cater to a diverse user base.

5. Reporting and Analytics

Generate detailed reports and visualize disease trends over time.

Provide insights to help farmers optimize their practices.

6. Offline Functionality

Basic disease detection available without internet connectivity to support remote areas.

Synchronization with cloud storage when connectivity is restored.

Advantages of the Proposed System

1. High Accuracy

Machine learning models trained on extensive datasets ensure reliable disease detection.

2. Time-Efficient

Instantaneous analysis and recommendations save time compared to manual methods.

3. Scalable and Adaptable

Suitable for small-scale farmers as well as large agricultural enterprises.

Adaptable to various crops and regions.

4. Cost-Effective

Reduces dependency on experts and mitigates crop loss, saving costs for farmers.

23 of 57
Ai-Driven Leaf Disease Prediction and Management
System

Plant Disease Prediction

Importing Dataset

Dataset Link: https://www.kaggle.com/datasets/vipoooool/new-plant-diseases-dataset

Importing libraries

import tensorflow as tfimport matplotlib.pyplot as pltimport pandas as pdimport seaborn as sns

Data Preprocessing

Training Image preprocessing

training_set = tf.keras.utils.image_dataset_from_directory( 'train', labels="inferred",


label_mode="categorical", class_names=None, color_mode="rgb", batch_size=32,
image_size=(128, 128), shuffle=True, seed=None, validation_split=None, subset=None,
interpolation="bilinear", follow_links=False, crop_to_aspect_ratio=False)

Found 70295 files belonging to 38 classes.

Validation Image Preprocessing

validation_set = tf.keras.utils.image_dataset_from_directory( 'valid', labels="inferred",


label_mode="categorical", class_names=None, color_mode="rgb", batch_size=32,
image_size=(128, 128), shuffle=True, seed=None, validation_split=None, subset=None,
interpolation="bilinear", follow_links=False, crop_to_aspect_ratio=False)

Found 17572 files belonging to 38 classes.

To avoid Overshooting Loss function

1. Choose small learning rate default 0.001 here we have taken 0.0001
2. There may be chance of underfitting so increase number of neuron
3. Add more Convolutional Layer to extract more feature from images there may be possibilty
that model unable to capture relevant feature or model is confusing due to lack of feature so
feed with more feature

24 of 57
Ai-Driven Leaf Disease Prediction and Management
System

Building Model

cnn = tf.keras.models.Sequential()

Building Convolution Layer

cnn.add(tf.keras.layers.Conv2D(filters=32,kernel_size=3,padding='same',activation='relu',input_shape=[1
28,128,3]))cnn.add(tf.keras.layers.Conv2D(filters=32,kernel_size=3,activation='relu'))cnn.add(tf.keras.la
yers.MaxPool2D(pool_size=2,strides=2))

cnn.add(tf.keras.layers.Conv2D(filters=64,kernel_size=3,padding='same',activation='relu'))cnn.add(tf.ker
as.layers.Conv2D(filters=64,kernel_size=3,activation='relu'))cnn.add(tf.keras.layers.MaxPool2D(pool_siz
e=2,strides=2))

cnn.add(tf.keras.layers.Conv2D(filters=128,kernel_size=3,padding='same',activation='relu'))cnn.add(tf.ke
ras.layers.Conv2D(filters=128,kernel_size=3,activation='relu'))cnn.add(tf.keras.layers.MaxPool2D(pool_
size=2,strides=2))

cnn.add(tf.keras.layers.Conv2D(filters=256,kernel_size=3,padding='same',activation='relu'))cnn.add(tf.ke
ras.layers.Conv2D(filters=256,kernel_size=3,activation='relu'))cnn.add(tf.keras.layers.MaxPool2D(pool_
size=2,strides=2))

cnn.add(tf.keras.layers.Conv2D(filters=512,kernel_size=3,padding='same',activation='relu'))cnn.add(tf.ke
ras.layers.Conv2D(filters=512,kernel_size=3,activation='relu'))cnn.add(tf.keras.layers.MaxPool2D(pool_
size=2,strides=2))

cnn.add(tf.keras.layers.Dropout(0.25))

cnn.add(tf.keras.layers.Flatten())

cnn.add(tf.keras.layers.Dense(units=1500,activation='relu'))

cnn.add(tf.keras.layers.Dropout(0.4)) #To avoid overfitting

Compiling and Training Phase

cnn.compile(optimizer=tf.keras.optimizers.legacy.Adam( learning_rate=0.0001),loss='categorical_cross
entropy',metrics=['accuracy'])

cnn.summary()

25 of 57
Ai-Driven Leaf Disease Prediction and Management
System

Model: "sequential_18"_________________________________________________________________
Layer (type) Output Shape Param #
================================================================= conv2d_124
(Conv2D) (None, 128, 128, 32) 896 conv2d_125
(Conv2D) (None, 126, 126, 32) 9248
max_pooling2d_62 (MaxPooli (None, 63, 63, 32) 0 ng2D)
conv2d_126 (Conv2D) (None, 63, 63, 64) 18496
conv2d_127 (Conv2D) (None, 61, 61, 64) 36928
max_pooling2d_63 (MaxPooli (None, 30, 30, 64) 0 ng2D)
conv2d_128 (Conv2D) (None, 30, 30, 128) 73856
conv2d_129 (Conv2D) (None, 28, 28, 128) 147584
max_pooling2d_64 (MaxPooli (None, 14, 14, 128) 0 ng2D)
conv2d_130 (Conv2D) (None, 14, 14, 256) 295168
conv2d_131 (Conv2D) (None, 12, 12, 256) 590080
max_pooling2d_65 (MaxPooli (None, 6, 6, 256) 0 ng2D)
conv2d_132 (Conv2D) (None, 6, 6, 512) 1180160
conv2d_133 (Conv2D) (None, 4, 4, 512) 2359808
max_pooling2d_66 (MaxPooli (None, 2, 2, 512) 0 ng2D)
dropout_45 (Dropout) (None, 2, 2, 512) 0
flatten_16 (Flatten) (None, 2048) 0 dense_34
(Dense) (None, 1500) 3073500 dropout_46
(Dropout) (None, 1500) 0 dense_35 (Dense)
(None, 38) 57038
=================================================================Total params:
7842762 (29.92 MB)Trainable params: 7842762 (29.92 MB)Non-trainable params: 0 (0.00
Byte)_________________________________________________________________

training_history = cnn.fit(x=training_set,validation_data=validation_set,epochs=10)

Epoch 1/102197/2197 [==============================] - 274s 124ms/step - loss: 1.3926 -


accuracy: 0.5918 - val_loss: 0.4671 - val_accuracy: 0.8499Epoch 2/102197/2197
[==============================] - 268s 122ms/step - loss: 0.5093 - accuracy: 0.8419 -
val_loss: 0.3337 - val_accuracy: 0.8961Epoch 3/102197/2197
[==============================] - 269s 122ms/step - loss: 0.3325 - accuracy: 0.8951 -

26 of 57
Ai-Driven Leaf Disease Prediction and Management
System

val_loss: 0.2296 - val_accuracy: 0.9272Epoch 4/102197/2197


[==============================] - 278s 127ms/step - loss: 0.2506 - accuracy: 0.9226 -
val_loss: 0.2608 - val_accuracy: 0.9266Epoch 5/102197/2197
[==============================] - 274s 125ms/step - loss: 0.1962 - accuracy: 0.9405 -
val_loss: 0.2714 - val_accuracy: 0.9191Epoch 6/102197/2197
[==============================] - 268s 122ms/step - loss: 0.1619 - accuracy: 0.9506 -
val_loss: 0.2136 - val_accuracy: 0.9352Epoch 7/102197/2197
[==============================] - 272s 124ms/step - loss: 0.1459 - accuracy: 0.9560 -
val_loss: 0.2002 - val_accuracy: 0.9422Epoch 8/102197/2197
[==============================] - 279s 127ms/step - loss: 0.1262 - accuracy: 0.9633 -
val_loss: 0.1890 - val_accuracy: 0.9467Epoch 9/102197/2197
[==============================] - 273s 124ms/step - loss: 0.1100 - accuracy: 0.9679 -
val_loss: 0.3728 - val_accuracy: 0.9220Epoch 10/102197/2197
[==============================] - 260s 118ms/step - loss: 0.1059 - accuracy: 0.9702 -
val_loss: 0.2495 - val_accuracy: 0.9459

Evaluating Model

#Training set Accuracytrain_loss, train_acc = cnn.evaluate(training_set)print('Training accuracy:',


train_acc)

2197/2197 [==============================] - 56s 26ms/step - loss: 0.0783 - accuracy:


0.9782Training accuracy: 0.9781919121742249

#Validation set Accuracyval_loss, val_acc = cnn.evaluate(validation_set)print('Validation accuracy:',


val_acc)

550/550 [==============================] - 14s 25ms/step - loss: 0.2495 - accuracy:


0.9459Validation accuracy: 0.9458798170089722

Saving Model

cnn.save('trained_plant_disease_model.keras')

training_history.history #Return Dictionary of history

27 of 57
Ai-Driven Leaf Disease Prediction and Management
System

{'loss': [1.3926340341567993, 0.5093422532081604, 0.332528293132782, 0.25064608454704285,


0.1961534023284912, 0.16193240880966187, 0.14591246843338013, 0.12622447311878204,
0.10997208952903748, 0.10591727495193481], 'accuracy': [0.5917917490005493,
0.8418664336204529, 0.8951276540756226, 0.9225834012031555, 0.9405078887939453,
0.9505512714385986, 0.9559854865074158, 0.9632833003997803, 0.9678924679756165,
0.9702112674713135], 'val_loss': [0.4670976996421814, 0.33370524644851685,
0.22960424423217773, 0.2608007490634918, 0.2714437246322632, 0.21357299387454987,
0.20022274553775787, 0.18895581364631653, 0.3728276193141937, 0.24945156276226044],
'val_accuracy': [0.8498747944831848, 0.8961415886878967, 0.9271568655967712,
0.9266446828842163, 0.9191327095031738, 0.9352378845214844, 0.9422376751899719,
0.9466765522956848, 0.9220350384712219, 0.9458798170089722]}

#Recording History in jsonimport jsonwith open('training_hist.json','w') as f:


json.dump(training_history.history,f)

print(training_history.history.keys())

dict_keys(['loss', 'accuracy', 'val_loss', 'val_accuracy'])

Accuracy Visualization
epochs = [i for i in
range(1,11)]plt.plot(epochs,training_history.history['accuracy'],color='red',label='Training
Accuracy')plt.plot(epochs,training_history.history['val_accuracy'],color='blue',label='Validation
Accuracy')plt.xlabel('No. of Epochs')plt.title('Visualization of Accuracy Result')plt.legend()plt.show()

28 of 57
Ai-Driven Leaf Disease Prediction and Management
System

Some other metrics for model evaluation


class_name = validation_set.class_names

test_set = tf.keras.utils.image_dataset_from_directory( 'valid', labels="inferred",


label_mode="categorical", class_names=None, color_mode="rgb", batch_size=1,
image_size=(128, 128), shuffle=False, seed=None, validation_split=None, subset=None,
interpolation="bilinear", follow_links=False, crop_to_aspect_ratio=False)

Found 17572 files belonging to 38 classes.

y_pred = cnn.predict(test_set)predicted_categories = tf.argmax(y_pred, axis=1)

17572/17572 [==============================] - 115s 7ms/step

29 of 57
Ai-Driven Leaf Disease Prediction and Management
System

true_categories = tf.concat([y for x, y in test_set], axis=0)Y_true = tf.argmax(true_categories, axis=1)

Y_true

<tf.Tensor: shape=(17572,), dtype=int64, numpy=array([ 0, 0, 0, ..., 37, 37, 37])>

predicted_categories

<tf.Tensor: shape=(17572,), dtype=int64, numpy=array([ 0, 0, 0, ..., 37, 37, 37])>

from sklearn.metrics import confusion_matrix,classification_reportcm =


confusion_matrix(Y_true,predicted_categories)

# Precision Recall

Fscoreprint(classification_report(Y_true,predicted_categories,target_names=class_name))

precision recall f1-score support


Apple___Apple_scab 1.00 0.84 0.91 504 Apple___Black_rot 0.96
0.98 0.97 497 Apple___Cedar_apple_rust 0.95 0.99 0.97 440
Apple___healthy 0.85 0.93 0.89 502 Blueberry___healthy 0.85
0.99 0.92 454 Cherry_(including_sour)___Powdery_mildew 1.00 0.89 0.94 421
Cherry_(including_sour)___healthy 0.95 0.97 0.96
456Corn_(maize)___Cercospora_leaf_spot Gray_leaf_spot 0.96 0.89 0.92 410
Corn_(maize)___Common_rust_ 1.00 0.98 0.99 477
Corn_(maize)___Northern_Leaf_Blight 0.90 0.98 0.94 477
Corn_(maize)___healthy 1.00 0.99 0.99 465 Grape___Black_rot
1.00 0.94 0.97 472 Grape___Esca_(Black_Measles) 0.98 0.99 0.98
480 Grape___Leaf_blight_(Isariopsis_Leaf_Spot) 0.96 1.00 0.98 430
Grape___healthy 0.99 0.99 0.99 423 Orange___Haunglongbing_(Citrus_greening)
0.93 0.99 0.96 503 Peach___Bacterial_spot 0.91 0.95 0.93 459
Peach___healthy 0.94 0.99 0.96 432 Pepper,_bell___Bacterial_spot 0.99
0.89 0.93 478 Pepper,_bell___healthy 0.99 0.81 0.89 497
Potato___Early_blight 0.99 0.94 0.96 485 Potato___Late_blight 0.90
0.98 0.94 485 Potato___healthy 0.91 0.97 0.94 456
Raspberry___healthy 0.89 1.00 0.94 445 Soybean___healthy 0.95
0.99 0.97 505 Squash___Powdery_mildew 1.00 0.92 0.96 434

30 of 57
Ai-Driven Leaf Disease Prediction and Management
System

Strawberry___Leaf_scorch 0.96 0.96 0.96 444 Strawberry___healthy


0.98 0.98 0.98 456 Tomato___Bacterial_spot 0.97 0.96 0.96 425
Tomato___Early_blight 0.85 0.90 0.87 480 Tomato___Late_blight
0.86 0.91 0.89 463 Tomato___Leaf_Mold 0.98 0.94 0.96 470
Tomato___Septoria_leaf_spot 0.95 0.82 0.88 436 Tomato___Spider_mites Two-
spotted_spider_mite 0.89 0.97 0.93 435 Tomato___Target_Spot 0.92
0.88 0.90 457 Tomato___Tomato_Yellow_Leaf_Curl_Virus 0.99 0.98 0.99
490 Tomato___Tomato_mosaic_virus 1.00 0.91 0.95 448
Tomato___healthy 0.97 0.98 0.98 481 accuracy
0.95 17572 macro avg 0.95 0.95 0.95 17572
weighted avg 0.95 0.95 0.95 17572

Confusion Matrix Visualization

plt.figure(figsize=(40, 40))sns.heatmap(cm,annot=True,annot_kws={"size": 10})plt.xlabel('Predicted


Class',fontsize = 20)plt.ylabel('Actual Class',fontsize = 20)plt.title('Plant Disease Prediction Confusion
Matrix',fontsize = 25)plt.show()

31 of 57
Ai-Driven Leaf Disease Prediction and Management
System

32 of 57
Ai-Driven Leaf Disease Prediction and Management
System

Importing Libraries

import numpy as npimport tensorflow as tffrom keras.preprocessing.image import


ImageDataGeneratorimport matplotlib.pyplot as plt

Dataset Link: https://www.kaggle.com/datasets/vipoooool/new-plant-diseases-dataset

Test set Image Processing

validation_set = tf.keras.utils.image_dataset_from_directory( 'valid', labels="inferred",


label_mode="categorical", class_names=None, color_mode="rgb", batch_size=32,
image_size=(128, 128), shuffle=True, seed=None, validation_split=None, subset=None,
interpolation="bilinear", follow_links=False, crop_to_aspect_ratio=False)class_name =
validation_set.class_namesprint(class_name)

Found 17572 files belonging to 38 classes.['Apple___Apple_scab', 'Apple___Black_rot',


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

Loading Model

33 of 57
Ai-Driven Leaf Disease Prediction and Management
System

cnn = tf.keras.models.load_model('trained_plant_disease_model.keras')

#Visualising and Performing Prediction on Single image

#Test Image Visualizationimport cv2image_path = 'test/test/AppleCedarRust1.JPG'# Reading an

image in default modeimg = cv2.imread(image_path)img =


cv2.cvtColor(img,cv2.COLOR_BGR2RGB) #Converting BGR to RGB# Displaying the image
plt.imshow(img)plt.title('Test Image')plt.xticks([])plt.yticks([])plt.show()

Fig.5.1 Test Image

34 of 57
Ai-Driven Leaf Disease Prediction and Management
System

Testing Model

image = tf.keras.preprocessing.image.load_img(image_path,target_size=(128,128))input_arr =
tf.keras.preprocessing.image.img_to_array(image)input_arr = np.array([input_arr]) # Convert

single image to a batch.predictions = cnn.predict(input_arr)

1/1 [==============================] - 0s 88ms/step

print(predictions)

[[1.60827910e-18 7.49215634e-19 1.00000000e+00 3.50870104e-21 6.62113161e-15


3.72800738e-19 6.22405827e-23 1.73148090e-22 9.68881529e-32 7.88248896e-30
0.00000000e+00 8.97615743e-16 1.06374877e-20 5.08190569e-23 5.31838410e-22
1.90433500e-18 1.14590100e-13 2.27567313e-17 1.18931435e-13 6.58217716e-14
3.66812160e-28 1.39664321e-23 4.35163745e-19 3.02238021e-15 1.16397265e-25
1.54493438e-24 1.05048023e-23 4.27499594e-27 7.81312593e-15 6.82029129e-16
6.72198825e-15 8.81169657e-20 3.34497043e-16 1.75652755e-23 1.14647985e-14
2.73689167e-18 8.47499852e-20 5.76455676e-22]]

result_index = np.argmax(predictions) #Return index of max elementprint(result_index)

# Displaying the disease prediction

model_prediction = class_name[result_index]plt.imshow(img)plt.title(f"Disease Name:


{model_prediction}")plt.xticks([])plt.yticks([])plt.show()

35 of 57
Ai-Driven Leaf Disease Prediction and Management
System

Fig.5.2 Disease Name finding

36 of 57
Ai-Driven Leaf Disease Prediction and Management
System

CHAPTER - 6
METHODOLOGY
6.1 Data Collection and Pre-processing

The first step involves collecting a diverse dataset of plant leaf images, encompassing both
diseased and healthy samples. High-quality images are sourced from publicly available datasets
like Plant Village, as well as field data when accessible. These images are then pre-processed to
enhance their suitability for CNN models. Pre-processing steps include resizing images to a
consistent resolution, normalization to scale pixel values, and data augmentation techniques like
flipping, rotation, and cropping to increase dataset variability and improve model generalization.

Fig.6.1 Data Collection

37 of 57
Ai-Driven Leaf Disease Prediction and Management
System

6.2 CNN Model Design

Collecting a varied dataset of plant leaf photos, including both healthy and damaged samples, is
the first stage. Publicly accessible datasets such as Plant Village and, when available, field data
are the sources of high-quality photos. After that, these photos undergo pre-processing to
improve their CNN model appropriateness. To increase dataset heterogeneity and enhance model
generalisation, pre-processing methods include scaling photos to a consistent resolution,
normalising pixel values to scale, and using data augmentation techniques like flipping, rotation,
and cropping.

Fig.6.2 Model Design

38 of 57
Ai-Driven Leaf Disease Prediction and Management
System

6.3 Model Training

Collecting a varied dataset of plant leaf photos, including both healthy and damaged samples, is
the first stage. Publicly accessible datasets such as Plant Village and, when available, field data
are the sources of high-quality photos. After that, these photos undergo pre-processing to improve
their CNN model appropriateness. To increase dataset heterogeneity and enhance model
generalisation, pre-processing methods include scaling photos to a consistent resolution,
normalising pixel values to scale, and using data augmentation techniques like flipping, rotation,
and cropping.

6.4 Fine-Tuned CNN Transfer Learning-Based Model

Naturally when information is included, the crucial stages of training and testing demand a
significant amount of storage space and computational power. On the other hand, the transfer
learning-based model's fine-tuning method, which uses "network surgery" to extract features, is a
helpful way to modify resource utilisation. Fine-tuning optimises memory utilisation and makes
changes to the real architecture. It might be challenging to build and validate a CNN model by
figuring out the best parameters through trial-and-error techniques, such as learning rate, number
of layers, number of nodes, etc. CNN may be fine-tuned in a number of ways, such as by retraining
the model, altering the architecture, and partially freezing layers to use some of the previously
trained weights.

Initially the process of fine-tuning consists of four main steps:


1. The CNN model is pre-trained.

2. The last output layer is truncated, and all model designs and parameters are copied to generate
a new CNN.

3. The head of the CNN is replaced with a set of fully connected layers. Then the model parameters
are initialized randomly.

39 of 57
Ai-Driven Leaf Disease Prediction and Management
System

4. The output layer is trained from scratch, with all parameters fine-tuned based on the initial
model.

Fig.6.3 CNN Tensorflow

6.5 Model Evaluation

The model is tested on a different validation dataset to guarantee robustness and dependability.
The model's ability to accurately identify leaf diseases is evaluated using performance indicators
like accuracy, precision, recall, and F1-score. AUC-ROC curves and confusion matrices are

40 of 57
Ai-Driven Leaf Disease Prediction and Management
System

produced to offer more detailed information on how well the model performs across various
disease categories.

6.6 Deployment and Application

The Trained CNN model is implemented in an intuitive application after validation. Users of the
system, including farmers and agricultural experts, can input leaf photos for immediate diagnosis.
The program offers comprehensive details about the ailment that has been discovered and
recommends suitable management techniques to lessen its effects.

6.7 Applications & Limitations of AI in Leaf Disease Prediction


4.1 Applications

✓ Early Disease Detection: By using sophisticated picture recognition techniques, AI makes it possible to
identify illnesses early, enabling farmers to take timely action and minimise crop damage.

✓ Precision Agriculture: AI-driven technologies help with precise pesticide or fertiliser application,
reducing waste and environmental damage by accurately classifying and diagnosing diseases.

✓ Automated Monitoring: AI makes it possible to use drones or cameras to monitor vast agricultural areas
in real time, giving constant insights into crop health without requiring physical inspections.

✓ Data-Driven Insights: By analysing large datasets, artificial intelligence (AI) models provide forecasts
of probable disease outdreaks based on past patterns, meteorological conditions, and environmental
variables.

4.2 Limitation

 Dataset Dependency: Big, diversified, and high-quality datasets are essential to AI models.
Inadequate or unrepresentative data may restrict the system's precision and applicability.
 Disease Complexity: Without extra contextual information, AI may find it difficult to
distinguish between certain diseases due to their overlapping symptoms.
 Environmental Variability: AI models' performance can be impacted by variables such as soil
type, lighting conditions, and image background noise, which can result in inaccurate
forecasts.

41 of 57
Ai-Driven Leaf Disease Prediction and Management
System

 High Initial Costs: Especially for small-scale farmers, putting AI-based systems into place,
including gear like cameras, sensors, or drones, can be expensive.
 Technical expertise: Making effective use of AI tools frequently calls for a degree of technical
know-how that not all users, particularly those in rural regions, may have easy access to.

42 of 57
Ai-Driven Leaf Disease Prediction and Management
System

CHAPTER - 7

IMAGE PROCESSING
Introduction to Image Processing:

It is a technique for translating a physical image to digital form so that it can be manipulated, added
to, or extracted information from. In the field of image science, image processing denotes to any
category of indication treating where the contribution is an image, such as a picture or video frame,
and the yield can either be another copy or a set of parameters or characteristics that relate to the
image. Although optical and analogue image processing are also feasible, digital image processing
is the most common type. Imaging is the process of acquiring images, which initially produces the
input image.

Image processing is used to improve an existing image or to extract useful data commencing it.
This is significant in various Deep Learning-based Computer Visualization applications, because
such pre-processing can significantly improve model performance. Another application,
particularly in the entertainment business, is picture manipulation, such as adding or deleting items
from photos.

The bulk of image processing algorithms treat the image as a two-dimensional signal, which is
subsequently processed using standard signal processing techniques. Sub-images in a photograph
might be thought of as ROIS plain counties. This concept considers the fact that images typically
comprise clusters of elements, each of which might serve as the foundation for an entire province.
Because the damaged portion will be the focus of attention, image processing has been employed
to detect surface imperfections. It is currently one of the most rapidly emerging technology, with
applications popular a wide range of industries. Image processing is a key study topic in the
manufacturing.

Image processing fundamentally includes the succeeding three steps:

 Uploading the image by a digital camera or an optical scanner.

43 of 57
Ai-Driven Leaf Disease Prediction and Management
System

 Data compression, picture augmentation, and the detection of patterns that are invisible to
the human eye are all examples of image analysis and manipulation.
 The output step is the final one when a portrait or report based on image examination might
be adjusted.

Purpose of Image Processing:


Image processing is classified into five categories.

They are as follows:

1. Visualization - Pay consideration to the articles that exist not apparent.

2. Image polishing and re-establishment - Towards improve the quality of an image.

3. Measurement of pattern - Regulates the size of discrete things in an image.


4. Image acknowledgement - Categorize things in an image.

Types of Images:
The image's intensity or gray level at any pair of coordinates (x, y) is the amplitude off at that
location. An image is a two-dimensional function with the coordinates x and y being spatial (plane).

The image is referred to as a digital image .The use of a digital computer to process digital images
is referred to as digital image processing.

The amplitude off at that location is the strength or gray level of the image at any pair of
coordinates (x, y). An image is a two-dimensional function with the coordinates x and y being
spatial.

The field of digital image processing refers towards the use of a digital computer to process digital
pictures.

In most cases, each pixel in an image has a value that is made up of one or more values (samples)
that are linked to that pixel's "position" in some 2-D region. Python can deal with two types of
images.

 Binary images
 Grey scale images

44 of 57
Ai-Driven Leaf Disease Prediction and Management
System

Binary Image:
This type of images are stored in a logical array. It are also referred to as bi-level or two- level
images. (This idea is known as black and white, or B&W). Certain i/o equipment, for instance
laser printers and computer displays, can only be utilised with bi-level images.

Fig.7.1 Binary Image

A binary image will be shown in the figure 3. In this, each pixel undertakes one of only two
isolated principles: 1 or 0.

Gray Scale Images:

Fig.7.2 Gray Scale Image

This type of image is frequently collected of ranging from dark at the lowest concentration to white
at the highest. This is because the value of each pixel represents a particular trial. Grayscale images
are frequently produced when measuring the intensity of light at each pixel in a single band of the

45 of 57
Ai-Driven Leaf Disease Prediction and Management
System

electromagnetic spectrum. (For example, infrared, visible light, ultraviolet, and so on). Grey scale
images are frequently created by gauging the strength of images at towards each pixel. It is for
visual displays are commonly saved with 8 bit per sample pixel in order to record 256 intensities,
or shades of grey.

Kinds of Image Processing:


The two types of image processing used are:

 Analog
 Digital

Analog Image Processing:


Analogue image processing is a term used in and computer science to describe any work done on
two-dimensional analogue signals using analogue methods. (instead of using digital picture
processing). Image processing techniques for tangible copies like prints and photos might be
analogue or visual.

Image analysts use various interpretive fundamentals when utilising these visual approaches. The
image processing is constrained by analyst skill as well as the area that needs research. Reminder
is a critical module of image processing that uses visual techniques. Analysts thus integrate their
own knowledge with minor data when analysing pictures.

Digital Image Processing:


Computer-based numerical picture variation is made possible with the use of digital processing
techniques. Defects can be found in the raw data from satellite imaging sensors. Information must
go through a number of processing stages in order to overcome these defects and get originality.
When employing digital technique, all forms of data must go through three general phases: pre-
processing, enhancement and display, and information extraction.

Digital computers are utilised in this instance to process the image. A digital scanner-digitizer will
be used to turn the image into digital form, which will then be processed. It is described as the
process of performing a sequence of operations on a numerical representation of an item to produce

46 of 57
Ai-Driven Leaf Disease Prediction and Management
System

the desired outcome. Starting with a single image, it creates altered form of the original.
Consequently, a picture which transforms one image into a new.

47 of 57
Ai-Driven Leaf Disease Prediction and Management
System

CHAPTER - 6

OUTCOMES
The implementation of the proposed system will result in several tangible and intangible benefits
for farmers, researchers, and the agricultural sector at large.

1. Enhanced Disease Detection

Accurate and real-time identification of leaf diseases, minimizing reliance on manual inspection
or expert consultation.

Reduction in false positives/negatives due to advanced AI/ML models.

2. Improved Crop Health and Yield

Early detection of diseases allows timely intervention, reducing crop damage and improving
overall yield.

Implementation of recommended management strategies enhances crop resilience.

3. Cost Savings

Decreases the need for frequent expert consultations and laboratory testing.

Reduces crop loss, minimizing economic impact on farmers.

4. Increased Accessibility

An easy-to-use interface and multilingual support enable farmers from diverse backgrounds to
access the system.

Offline functionality ensures usability in remote areas with limited internet connectivity.

5. Better Decision-Making

Farmers gain insights into disease patterns and trends through detailed reports and analytics.

6. Sustainable Agriculture Practices

Encourages environmentally friendly disease management solutions, such as organic and


preventive measures.
48 of 57
Ai-Driven Leaf Disease Prediction and Management
System

Promotes optimal use of pesticides, reducing environmental harm.

7. Knowledge Sharing

The system serves as a repository of information, aiding researchers and policymakers in


understanding disease prevalence and impact.

Facilitates collaborative efforts to combat plant diseases on a larger scale.

8. Scalability and Adaptability

The system can be scaled to include more crops, regions, and diseases over time.

Adaptable to changing agricultural challenges and technological advancements.

49 of 57
Ai-Driven Leaf Disease Prediction and Management
System

CHAPTER - 8

RESULTS AND DISCUSSION

The dataset is given as an input to perform Pre-processing and Data Augmentation. After that
features are extracted using Resnet50 by pooling and model is trained for the given
dataset(70%trained) and for the model, video is given as input and gives output as healthy or
diseased leaf as shown in Fig.8.1,Fig.8.2,Fig.8.3,Fig.8.4, Fig.8.5 and Fig.8.6.

Fig.8.1 Infected Leaf

50 of 57
Ai-Driven Leaf Disease Prediction and Management
System

Fig.8.2 Healthy leaf

Fig.8.3 Diseased leaf

51 of 57
Ai-Driven Leaf Disease Prediction and Management
System

Fig.8.4 Diseased with tomato early blight

Fig.8.5 Diseased with Tomato spider mites

52 of 57
Ai-Driven Leaf Disease Prediction and Management
System

Fig.8.6 Diseased with Tomato late blight

53 of 57
Ai-Driven Leaf Disease Prediction and Management
System

CHAPTER - 9

CONCLUSION

The AI-Driven Leaf Disease Prediction and Management System demonstrates a significant
breakthrough in agricultural technology, offering a reliable and efficient solution for early disease
detection and effective management. By leveraging Convolutional Neural Networks (CNN), the
system achieves exceptional accuracy, providing farmers with a scalable, real-time tool to
safeguard their crops. This innovation not only minimizes crop losses but also promotes
sustainable agricultural practices by reducing the excessive use of pesticides. While challenges
like environmental variability and the need for broader datasets persist, the system’s adaptability
and practicality mark it as a pivotal step toward revolutionizing crop management. Future
enhancements will focus on improving system scalability and integrating advanced technologies
for comprehensive agricultural monitoring.

Plant leaf disease detection using machine learning algorithms has shown promising results in
recent years. Machine learning algorithms can accurately classify plant leaves into healthy and
diseased categories, thus helping farmers to identify and treat plant diseases early on, and
preventing crop damage and yield loss.

Overall, the results of our experiments show that Random Forests Classifier outperform other
algorithms in terms of accuracy and generalization on image datasets and Resnet-50 for video
datasets. Therefore, these algorithms can be used as a reliable and efficient algorithm for plant leaf
disease detection.

The use of automated monitoring and management systems are gaining increasing demand with
technological advancement. .In the agricultural field loss of yield mainly occurs due to widespread
disease. Mostly the detection and identification of the disease is noticed when the disease advances
to severe stage therefore, causing the loss in terms of yield, time and money. The proposed system
is capable of detecting the disease at the earlier stage as soon as it occurs on the leaf, hence saving
the loss and reducing the dependency on the expert to a certain extent is possible. It can provide

54 of 57
Ai-Driven Leaf Disease Prediction and Management
System

the help for a person having less knowledge about the disease, depending on these goals, we have
to extract the features corresponding to the diseases.

55 of 57
Ai-Driven Leaf Disease Prediction and Management
System

REFERENCES

[1]. FAO, "Plant Pests and Their Global Impact," Food and Agriculture Organization of the United
Nations, Rome, 2020

[2]. Mohanty, S.P., Hughes, D.P., & Salathé, M., "Using Deep Learning for Image-Based Plant
Disease Detection," Frontiers in Plant Science, 2016.

[3]. Ferentinos, K.P., "Deep Learning Models for Plant Disease Detection and Diagnosis,"
Computers and Electronics in Agriculture, 2018.

[4]. Zhang, X., Wang, Y., & Liu, Z., "Deep Learning Applications in Plant Disease Detection,"
Journal of Agricultural Science and Technology, 2022.

[5]. Johnson, K., & Brown, P., "Image Processing Techniques for Leaf Disease Detection,"
Journal of Plant Pathology Research, 2021.

[6]. Saleem, M.H., et al., "Plant Disease Detection via Machine Learning Models," Sustainability,
2019.

[7]. Aravind, K.R., Raja, P., & Bosco, S.J., "Applications of Machine Learning in Precision
Agriculture," Computers and Electronics in Agriculture, 2018.

[8]. Kumar, A., Sharma, M., & Gupta, P., "Machine Learning in Agriculture: Challenges and
Opportunities," IEEE Access, 2021.

[9]. Liakos, K.G., et al., "Machine Learning in Agriculture: A Review," Sensors, 2018.

[10].Sladojevic, S., et al., "Deep Neural Networks for Plant Disease Detection," Computers and
Electronics in Agriculture, 2016.

[11].Pantazi, X.E., et al., "Assessment of Crop Diseases Using Machine Learning Models,"
Biosystems Engineering, 2019.

[12].Shafique, S., et al., "A Review of AI-Based Applications for Precision Agriculture," Sensors,
2020.

56 of 57
Ai-Driven Leaf Disease Prediction and Management
System

[13].Goel, A., et al., "IoT-Based Crop Disease Detection System," Journal of Precision Agriculture,
2021.

[14].Yoo, J., et al., "Drone-Assisted Precision Agriculture," Remote Sensing, 2019.

[15].Kamilaris, A., & Prenafeta-Boldú, F.X., "Deep Learning in Agriculture: A Survey,"


Computers and Electronics in Agriculture, 2018.

[16].Haseeb Nazki, Sook Yoon, Alvaro Fuentes, Dong Sun Park “Unsupervised image translation
using adversarial networks for improved plant disease recognition” Published by Elsevier
B.V,(2020).

[17].Shanwen Zhang, Subing Zhang, Chuanlei Zhang, Xianfeng Wang, Yun Shi “Cucumber leaf
disease identification with global pooling dilated convolutional neural network” Published by
Elsevier B.V, (2019).

[18].Uday Pratap Singh, Siddharth Singh Chouhan, Sukirty Jain, And Sanjeev Jain “Multilayer
Convolution Neural Network for the Classification of Mango Leaves Infected by Anthracnose

[19].Vijai Singh “Sunflower leaf diseases detection using image segmentation based on particle
swarm optimization” 2019 Published by Elsevier,(2019).

[20].Sumita Mishra, Rishabh Sachan, Diksha Rajpal “Deep Convolutional Neural Network based
Detection System for Real-time Corn Plant Disease Recognition” 2020 Published by Elsevier B.V,
(2019)

57 of 57

You might also like