0% found this document useful (0 votes)
8 views11 pages

Plant Disease Detection Using Convolution Neural Networks

Uploaded by

Krishna kumar
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)
8 views11 pages

Plant Disease Detection Using Convolution Neural Networks

Uploaded by

Krishna kumar
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/ 11

Soft computing

(EAEPC16)
PRACTICAL RECORD FILE
2024-2025

NETAJI SUBHAS UNIVERSITY OF TECHNOLOGY


EAST CAMPUS, GEETA
COLONY, NEW DELHI-
110031

Submitted by: Submitted to:


Mayank- 2022UEA6528 Dr.Aarti Jain
Abhay Patel - 2022UEA6502 Mr. Shivam Ahuja
Kumari Palak- 2022UEA6509
Saransh Thakran- 2022UEA6507
Krishna Kumar - 2022UEA4562
INDEX

S.no Contents Page Signature

1 Objective & Introduction 3

2 Methodology & Data prep 4

3 Model Architecture 5

4 Block Diagram 6

5 Implementation 7

6 Techniques used to Enhance 8


Performance

7 Code 9

8 Conclusion 10

2
Objective
● The objective is to develop a model that uses deep learning to
identify plant diseases from images, enabling farmers to detect
issues early and enhance crop health.

Introduction
● Early and precise identification of plant diseases allows farmers
to take timely measures, such as targeted treatment,
quarantining affected plants, or optimizing irrigation and soil
conditions to prevent spread. This proactive approach minimizes
the use of pesticides, which lowers environmental impact and
reduces costs. Early intervention reduces crop losses, helping
stabilize agricultural incomes and contribute to food security by
ensuring steady production levels. Machine learning and deep
learning technologies can greatly assist in these early
detections, providing farmers with accessible, efficient tools for
disease management.

3
Methodology
In this project, a Convolutional Neural Network (CNN) is
employed as the primary deep learning architecture for
classifying plant diseases from images. CNNs are well-suited for
image classification tasks because of their ability to capture
spatial hierarchies in images through hierarchical feature
extraction. This architecture effectively learns patterns in image
data, such as textures and shapes, making it ideal for identifying
disease symptoms in plant leaves.

Dataset and preprocessing


The project utilizes the "New Plant Diseases Dataset" from
Kaggle, which contains images across various plant disease
classes. The dataset is split into training, validation, and test sets
to evaluate model performance accurately. Several
preprocessing steps are applied to the images:

● Resizing: Each image is resized to a consistent size to


standardize inputs to the model.
● Normalization: Image pixel values are normalized to ensure
uniform input, which helps stabilize and speed up the training
process.

4
● Augmentation (implicitly): During training, images are
transformed to tensors, allowing the CNN to generalize better
and avoid overfitting.

Model architecture
The custom CNN model is designed with the following architecture:
● Convolutional Layers: Several convolutional blocks are used
to extract hierarchical features. Each block consists of a
convolutional layer followed by batch normalization and a ReLU
activation function, which helps in capturing non-linear patterns
and improving convergence.
● Residual Connections: Two residual blocks are incorporated
into the architecture. These blocks pass information forward and
bypass certain layers, helping the model retain important
features from earlier layers and mitigating issues like vanishing
gradients.
● Pooling Layers: Max-pooling layers are used after specific
convolutional layers to down-sample the feature maps, reducing
computational complexity and focusing on prominent features.
● Fully Connected Layer: After feature extraction, a final fully
connected layer serves as the classifier, mapping the extracted
features to probabilities across disease classes.
● Output Layer: The output layer provides the classification result
by applying the softmax function, predicting the likelihood of
each class.

5
6
Block Diagram

7
Implementation
Loss - For training, the CNN model uses a cross-entropy loss
function, which is widely used in multi-class classification
tasks. Cross-entropy loss penalizes incorrect predictions,
helping the model learn to classify images accurately by
adjusting weights based on the difference between predicted
and actual classes.

● Optimizer - The Adam optimizer is chosen for its efficient


handling of sparse gradients and adaptive learning rates,
making it suitable for deep learning tasks with large datasets.
● In this implementation, a One-Cycle Learning Rate scheduler
is employed, gradually increasing the learning rate at the start
and then decreasing it as training progresses. This approach
helps the model converge faster while reducing the likelihood of
getting stuck in local minima.
● Evaluation Metrics - Model performance is primarily evaluated
using accuracy on the validation set, which provides a
straightforward measure of the model's ability to correctly
classify images.

8
Techniques used to Enhance Performance
Batch Normalization: A technique to stabilize and
accelerate training by normalizing activations within a
mini-batch.

Residual Connections: A shortcut that adds the input


of a layer to its output, enabling deeper networks by
mitigating gradient vanishing.

One-Cycle Learning Rate: A learning rate schedule


that increases the rate to a peak and then decreases,
helping the model converge faster and more effectively.

9
Code
Model architecture:
class CNN_NeuralNet(ImageClassificationBase):
def __init__(self, in_channels, num_diseases): super().__init__()
self.conv1 = ConvBlock(in_channels, 64) self.conv2 =
ConvBlock(64, 128, pool=True) self.res1 =
nn.Sequential(ConvBlock(128, 128), ConvBlock(128, 128))
self.conv3 = ConvBlock(128, 256, pool=True) self.conv4 =
ConvBlock(256, 512, pool=True) self.res2 =
nn.Sequential(ConvBlock(512, 512), ConvBlock(512, 512))
self.classifier = nn.Sequential(nn.MaxPool2d(4),
nn.Flatten(),
nn.Linear(512,
num_diseases))
def forward(self, x): # x is the loaded batch
out =
self.conv1(x) out
= self.conv2(out)
out =
self.res1(out) +
out out =
self.conv3(out)
out =
self.conv4(out)
out =
self.res2(out) +
out out =
self.classifier(out
) return out

Sample prediction:
def predict_image(img, model):
xb = to_device(img.unsqueeze(0),
device) yb = model(xb)
, preds = torch.max(yb, dim=1)

return train.classes[preds[0].item()]

10
Conclusion
This CNN-based plant disease predictor has the
potential to significantly reduce crop losses by
providing farmers with a reliable tool for early disease
detection. By enabling timely intervention and
informed decision-making, the model supports
sustainable farming practices. Its integration into
mobile applications and agricultural monitoring
systems can empower farmers, enhance productivity,
and promote resource-efficient agriculture. Ultimately,
leveraging this technology contributes to the
resilience of agricultural systems and ensures food
security in an era of increasing environmental
challenges.

11

You might also like