Mca project
Mca project
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
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.
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.
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.
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
5 of 57
Ai-Driven Leaf Disease Prediction and Management
System
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.
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.
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
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.
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 .
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
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.
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.
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. 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.
11 of 57
Ai-Driven Leaf Disease Prediction and Management
System
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)
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.
6. Output Layer
Provides the final prediction using a softmax activation function.
Outputs the probability of each disease class.
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.
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.
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.
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
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.
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.
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
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
3. Stakeholders
4. Functional Requirements
1. Data Input
2. Disease Detection
3. Database Management
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).
5. User Management
6. Multilingual Support
18 of 57
Ai-Driven Leaf Disease Prediction and Management
System
5. Non-Functional Requirements
1. Performance
2. Scalability
3. Reliability
4. Usability
5. Security
6. Availability
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.
Farmers consult plant pathologists or agricultural experts for diagnosis and advice.
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.
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.
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.
Use of AI/ML algorithms to analyse leaf images and identify diseases with high accuracy.
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.
4. User-Friendly Interface
Easy-to-use mobile or web application for farmers, researchers, and agricultural experts.
6. Offline Functionality
Basic disease detection available without internet connectivity to support remote areas.
1. High Accuracy
Machine learning models trained on extensive datasets ensure reliable disease detection.
2. Time-Efficient
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
Importing Dataset
Importing libraries
Data Preprocessing
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()
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.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)
26 of 57
Ai-Driven Leaf Disease Prediction and Management
System
Evaluating Model
Saving Model
cnn.save('trained_plant_disease_model.keras')
27 of 57
Ai-Driven Leaf Disease Prediction and Management
System
print(training_history.history.keys())
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
29 of 57
Ai-Driven Leaf Disease Prediction and Management
System
Y_true
predicted_categories
# Precision Recall
Fscoreprint(classification_report(Y_true,predicted_categories,target_names=class_name))
30 of 57
Ai-Driven Leaf Disease Prediction and Management
System
31 of 57
Ai-Driven Leaf Disease Prediction and Management
System
32 of 57
Ai-Driven Leaf Disease Prediction and Management
System
Importing Libraries
Loading Model
33 of 57
Ai-Driven Leaf Disease Prediction and Management
System
cnn = tf.keras.models.load_model('trained_plant_disease_model.keras')
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
print(predictions)
35 of 57
Ai-Driven Leaf Disease Prediction and Management
System
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.
37 of 57
Ai-Driven Leaf Disease Prediction and Management
System
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.
38 of 57
Ai-Driven Leaf Disease Prediction and Management
System
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.
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.
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.
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.
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.
✓ 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.
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.
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.
A binary image will be shown in the figure 3. In this, each pixel undertakes one of only two
isolated principles: 1 or 0.
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.
Analog
Digital
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 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.
Accurate and real-time identification of leaf diseases, minimizing reliance on manual inspection
or expert consultation.
Early detection of diseases allows timely intervention, reducing crop damage and improving
overall yield.
3. Cost Savings
Decreases the need for frequent expert consultations and laboratory testing.
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.
7. Knowledge Sharing
The system can be scaled to include more crops, regions, and diseases over time.
49 of 57
Ai-Driven Leaf Disease Prediction and Management
System
CHAPTER - 8
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.
50 of 57
Ai-Driven Leaf Disease Prediction and Management
System
51 of 57
Ai-Driven Leaf Disease Prediction and Management
System
52 of 57
Ai-Driven Leaf Disease Prediction and Management
System
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.
[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