JPSP 2022 017

Download as pdf or txt
Download as pdf or txt
You are on page 1of 9

Journal of Positive School Psychology http://journalppw.

com
2022, Vol. 6, No. 5, 193 – 201

Plant Disease Detection using Deep Transfer Learning

1Sukhwinder Kaur, 2Saurabh Sharma

1
Research Scholar, Sant Baba Bhag Singh University, Jalandhar, [email protected]
2
Assistant Professor, Sant Baba Bhag Singh University, Jalandhar

Abstract
A country’s economy largely depends on crops. Crops are the most important factor in food
production. Healthy plants lead to healthy crops. If the plants are infected, this can adversely affect
the food production. Plant diseases are mainly caused by viral or bacterial organisms. Disease on a
plant can be identified by a change in colour of the leaf or even shape. It becomes very important to
detect plant diseases as early as possible so that food production doesn’t get affected. Detecting plant
diseases via technology is a significant step in this direction. Using Deep Learning methods for this
task can help us to identify diseases in plants. In this study, we use the VGGNet-19 model that is pre-
trained using the weights of the ‘ImageNet’ dataset. By freezing the top layers and using transfer
learning, we add a few layers to the model to try and improve the performance and accuracy of the
model. This results in the accuracy of 97.52per cent for apple leaves and 95.75 per cent for grape
leaves after running the model for 20 epochs.

Keywords: Deep Learning, Plant diseases, Transfer Learning, VGGNet-19.

1. INTRODUCTION
To Distinguish a plant diseases accurately
when it initially appears is crucial stage for
efficient disease management. Detecting
diseases in plants has become increasingly
significant in order to protect the crops. Early
detection of diseases on plants is necessary so
as not to infect the total crop and also to boost
the quality of agricultural products.
Most of the symptoms of plant disease can be
seen on the leaves and spotted. Different types
of plant disease exist, but the majority of these
diseases can be categorized into the three
different categories which are bacterial disease,
viral disease and fungal disease. Apple trees are Fig. 1. Apple leaves in Plant Village dataset
vulnerable to numerous diseases. Diseases such Manual identification of diseases in plants is a
as apple scab, black rot canker, powdery time consuming and inefficient process.
mildew can affect apple trees in various ways. Therefore, using Deep Learning helps in
Grape trees are also affected by diseases such reducing the effort required to identify plants
as black rot, leaf blight and esca, black measle with diseases.
etc.
Sukhwinder Kaur 194

1.1 Deep Learning 2. Related Work


Deep learning is a machine learning technique Patil et al. [5] developed a deep CNN model to
that allows computers to learn by example in detect diseases in cotton plants. Augmentation,
the same way that humans do [1]. In deep fine tuning and image processing was
learning, computer models learn to perform performed on the leaves and different test cases
classification tasks directly from images, text, gave an efficient outcome for detecting
or voice. Deep learning models can achieve diseases in cotton plants. These methods can
cutting-edge precision that can exceed human- help farmers detect diseases as early as possible
level performance. The model is trained using a and prevent their crops from being damaged.
large amount of labelled data and neural Chen et al. [6] studied the transfer learning of
network architecture with many layers [2][3]. deep convolutional neural networks for
Models such as CNN (Convolutional Neural detecting plant diseases. They selected the
Networks) are used to classify images for both VGGNet-19 model pre-trained on ImageNet
large and small datasets. Deep learning dataset, combining with the Inception Module.
frameworks need a lot of information to return The proposed approach was able to give
accurate outcomes. Data is fed in the forms of validation accuracy of around 92% even under
datasets. While handling the information, complex background conditions. Chohan et
artificial neural networks are able to classify al.[7] proposed a Plant Disease detector which
data with the responses received from a uses pictures of plants to detect the diseases.
progression of parallel true or false inquiries Convolutional Neural Network with multiple
including exceptionally complex numerical convolution and pooling layers is used on
estimations. PlantVillage dataset with 15 percent data
chosen for testing. They proposed that this
1.2 Deep Transfer Learning model could be integrated with drones and
Transfer learning is a machine learning method other systems for disease detection in
in which an already developed task is reused as plants.Sibiya et al.[8] utilised CNN (GUI) in
a continuation point for a novel task. In transfer maize to detect diseases like northern corn leaf
learning, a new model need not be developed blight, grey leaf spot and common rust with
for every task [4]. Instead, we can use pre- accuracies 99.9%, 91% and 87%, respectively.
trained models and their weights so that The healthy leaf detection percentage was at
computation power requirements are reduced 93.5% and the overall accuracy was 92.85%.
and the target can be achieved quickly as Binh et al. [9] proposed a method to detect gray
compared to time required in training a new spots on tea leaves using computer vision and
model from scratch. In short, including the pre- image processing algorithms. They used a
trained models in a new model leads to lower Neural of Multi-Layer Perceptron (MLP) built
training time and lower generalisation error. with extracted identifying features on the gray
spots tea leaves. They combined image
processing algorithms, neural networks with
computer vision to determine gray spots on tea
leaves. Barbedo [10] used individual lesions
and spots for detecting plant diseases instead of
considering the entire leaf. This was done to
increase the variability of data. Multiple
diseases could be detected on a single leaf with
this approach. Better results were achieved
using this approach. Also, each crop had an
accuracy of at least 75%.
Fig. 2. Transfer Learning Türkoğlu et al., [11] compared some of the
very common architectures of deep learning to
195 Journal of Positive School Psychology

detect diseases in plants. The experiment was network(CNN) as a feature extractor and
conducted using disease and pest images from Support Vector Machine (SVM) as a classifier
Turkey. Deep feature extraction and and identified the disease with 91.37%
SVM/ELM classifications produced better accuracy.
results as compared to transfer learning.
Brahimi et al. [16] proposed a deep models
Wallelign et al. [12] designed a model using method to create a classifier for detection of
CNN classifier to classify Soybean plant disease. They used a large dataset containing
diseases by taking leaf images of four classes 14828 images and nine diseases of tomato.
from the PlantVillage database. Their model They also showed that Deep Models with pre-
obtained 99.32% accuracy which shows that training improves accuracy than those without
important features can be extracted and plant pre-training. Ferentinos [17] applied deep
diseases classified using CNN . learning classification technique for recognition
of diseases in crops by using an open database
Park et al. [13] used deep learning to diagnose
of 87848 images of 25 different plants in a set
the disease of strawberry leaf image and with
of 58 distinct classes of plant disease
method based on convolution neural networks
combination and achieved with accuracy
to classify the disease of strawberry plants into
99.53%.
healthy and diseased strawberry images and
obtained 92% accuracy for classification .
Pooja et al. [14] proposed a disease detection 3. Research Methodology
and classification technique with the help of
machine learning mechanisms and image VGGNet is a convolutional neural network
processing tools. To begin with, they captured Architecture proposed by Karen Simonyan and
Andrew Zisserman from the Visual Geometry
the infected area of the leaf and then
Group of Oxford University in 2014[18].
performed image processing. The Support
Vector Machine (SVM) classifier was used for It consists of 16 or more convolution, pooling
classification and it was able to provide better and fully-connected layers , as shown in Fig. 3.
results than previously used techniques. The VGGNet includes two typical models such
Shrivastava et al. [15] used transfer learning of as the VGGNet-16 and VGGNet-19, which are
available as the pretrained models with the 16
deep CNN for classification of rice disease.
and 19 wt layers trained on the ImageNet
Images of rice plant disease belonging to the
four classes Rice Blast (RB), Bacterial Leaf dataset. 19 layers of VGGNet19 consist of 16
Blight (BLB) and Sheath Blight (SB) were convolutional layers, 3 fully connected layers
taken along with healthy (HL) images.They and 5 pooling layers as shown in Fig.
3.VGGnet19 consists of the following layers:
used pre-trained deep convolution neural
Fully Connected (4096)

Fully Connected (4096)


Fully Connected (1000)
Conv3x3 (128)
Conv3x3 (128)

Conv3x3 (256)
Conv3x3 (256)
Conv3x3 (256)
Conv3x3 (256)

Conv3x3 (512)
Conv3x3 (512)
Conv3x3 (512)
Conv3x3 (512)

Conv3x3 (512)
Conv3x3 (512)
Conv3x3 (512)
Conv3x3 (512)
Conv3x3 (64)
(64)
MaxPool

MaxPool

MaxPool

MaxPool

MaxPool
Conv3x3

SoftMax
Input

Fig. 3. The architecture of VGGNet19


VGGNet19 is pre-trained on ImageNet dataset kernel of 3*3 and a stride of 1 pixel allowed the
with 14,197,122 images. VGGNet19 takes an model to cover an entire image.
input of size 224*224 RGB image, Using a
Sukhwinder Kaur 196

Dataset 5. Load the VGGNet model with


ImageNet weights.
PlantVillage dataset developed by
Hughes & Salathe (2015) consists of 54303 6. Freeze the top layers and add new
healthy and unhealthy leaf images. This dataset layers for transfer learning.
is divided into 38 categories.
7. Provide the dataset as a directory to the
ImageDataGenerator class.
8. Compile and train the model.
9. Plot the accuracy and loss graphically.
10. Test the model by providing an input
image.
The above steps in detail are
The apple dataset is uploaded to Google drive
and we mount the drive in Google colab.

Fig 5. Mounting Google Drive in Colab


Fig. 4. Potato and Tomato leaves in
PlantVillage dataset The uploaded zip folder for PlantVillage
dataset is extracted to two separate train and
Around 1600 healthy apple leaf images and
test folders.
1300 apple leaves with scab and black rot are
provided as input to the model with 40 percent
data used for testing and 60 percent data used
for training. Each image is converted to a size
of 224*224, which is the default image size for
VGGNet architecture.
We use Google Colab to perform plant disease
detection with GPU in order to reduce the time
required for training the model.
Following steps are performed to classify
healthy and diseased apple leaves using
Transfer Learning:
1. Upload the dataset as zip to google Fig 6. Unzipping the apple leaf images
drive and mount the drive to the Google colab
account. The required libraries such as tensorflow,
keras, ImageDataGenerator as well as the
2. Unzip the dataset in separate train and VGGNet19 model are imported.
test folders.
3. Import the necessary and required
libraries.
4. Perform data augmentation to increase
the variability of data.
197 Journal of Positive School Psychology

Fig 7. Importing the required libraries


The layers loaded in the VGGNet19 are frozen
and new layers are created to modify the
existing model. The base VGGNet19 model is
combined with the new layers.

Fig. 9. Model Summary


Fig 8. Creating new layers and combining them
with VGGNet19 The model is compiled using the adam
optimizer and finally the model is trained for
The following image shows the summary of the 20 epochs. The images in the test folder are
model just created: used as validation data.

Fig 10. Model compilation

4. Results
Training the model for 20 epochs gives an
accuracy of around 97 percent. Using Google
Colab Pro GPU took an average of 34 seconds
for each epoch. The experiment was performed
Sukhwinder Kaur 198

on the apple leaves with 3 classes: Apple Scab, Apple black rot and healthy apple leaves.

Fig. 11. Model training for 20 epochs (apple)


The following figures show the accuracy and
loss graphs which are plotted using the
matplotlib library:

Fig. 12. Model Accuracy


Fig. 14. Testing the model on an apple black
rot leaf
The same experiment was conducted on grape
leaf dataset which has four classes:
Grape_Black_rot,
Grape_Esca_(Black_Measles), Grape_healthy,
Grape_Leaf_blight_(Isariopsis_Leaf_spot)

Fig. 13. Model loss


Testing the model by uploading a random apple
leaf image detects the disease correctly.
199 Journal of Positive School Psychology

Fig. 15. Grape leaves in PlantVillage dataset


Training the model for 20 epochs provides a
validation accuracy of around 96 percent.

Fig. 16: Model training for 20 epochs (grapes)

Fig. 17: Model Loss


Fig. 18. Model Accuracy
The following table shows the comparison of
accuracy and loss for apple and grape leaves
for 20 epochs:
Sukhwinder Kaur 200

Table 1: Comparison of accuracy and loss for Artificial Neural Networks; Springer:
apple and grape leaves Berlin/Heidelberg, Germany, 2018; pp.
270–279
Plant Accuracy Loss [5] Patil, B. V., &Patil, P. S. (2021).
(20 epochs) ( 20 epochs)
Computational method for Cotton Plant
disease detection of crop management
Apple 97.52 % 0.0649 using deep learning and internet of things
platforms. In Evolutionary Computing and
Grape 95.75% 0.1133 Mobile Sustainable Networks (pp. 875-
885). Springer, Singapore.
[6] Chen, J., Zhang, D., Sun, Y.,
5. Conclusion and Future Scope &Nanehkaran, Y. A. (2020). Using deep
transfer learning for image-based plant
Detecting plant diseases using Deep Learning disease identification. Computers and
can help farmers protect and minimise the Electronics in Agriculture, 173, 105393.
damage to the crops. Using pre-trained models [7] Chohan, M., Khan, A., Chohan, R.,
such as VGGNet19 and modifying a few Katpar, S. H., &Mahar, M. S. (2020).
parameters can significantly increase the Plant disease detection using deep
accuracy in classifying images of plants. learning. International Journal of Recent
Technology and Engineering, 9(1), 909-
Transfer learning is a great method that can 914.
reduce the time and computation power [8] Sibiya, M., & Sumbwanyambe, M. (2019).
required to train the models. Using VGGNet19 A computational procedure for the
and adding a few layers can provide better recognition and classification of maize leaf
results for classifying and detecting diseases in diseases out of healthy leaves using
convolutional neural networks.
plants. Also, these methods can be used to
AgriEngineering, 1(1), 119-131.
predict and classify images for a wider range of [9] Binh, P. T., Nhung, T. C., & Du, D. H.
plants and other crops. Moreover, Deep (2019, December). Detection and
Transfer Learning can be used in other real Diagnosis Gray Spots on Tea Leaves
world applications using mobile devices for Using Computer Vision and Multi-layer
classifications and predictions using images. Perceptron. In International Conference on
Engineering Research and Applications
(pp. 229-237). Springer, Cham.
Reference [10] Barbedo, J. G. A. (2019). Plant disease
identification from individual lesions and
[1] Pouyanfar, S.; Sadiq, S.; Yan, Y.; Tian, spots using deep learning. Biosystems
H.; Tao, Y.; Reyes, M.P.; Shyu, M.L.; Engineering, 180, 96-107.
Chen, S.C.; Iyengar, S. A survey on deep [11] Türkoğlu, M., &Hanbay, D. (2019). Plant
learning: Algorithms, techniques, and disease and pest detection using deep
applications. ACM Comput.Surv. (CSUR) learning-based features. Turkish Journal of
2018, 51, 1–36. Electrical Engineering & Computer
[2] Liu, J., & Wang, X. (2021). Plant diseases Sciences, 27(3), 1636-1651.
and pests detection based on deep [12] Wallelign, S., Polceanu, M., &Buche, C.
learning: a review. Plant Methods, 17(1), (2018, May). Soybean plant disease
1-18. identification using convolutional neural
[3] Too, E. C., Yujian, L., Njuki, S., networks. In The thirty-first international
&Yingchun, L. (2019). A comparative flairs conference.
study of fine-tuning deep learning models [13] Park H., Jeesook E., & Kim S.H., “Crops
for plant disease identification. Computers Disease Diagnosing Using Image Based
and Electronics in Agriculture, 161, 272- Deep Learning Mechanism,” 2018
279. International Conference on Computing
[4] Tan, C.; Sun, F.; Kong, T.; Zhang, W.; and Network Communications
Yang, C.; Liu, C.A survey on deep transfer (CoCoNet), 2018.
learning. In International Conference on
201 Journal of Positive School Psychology

[14] Pooja, V., Das, R., &Kanchana, V. (2017,


April). Identification of plant leaf diseases
using image processing techniques. In
2017 IEEE Technological Innovations in
ICT for Agriculture and Rural
Development (TIAR) (pp. 130-133).
IEEE.
[15] Shrivastava, V. K., Pradhan, M. K., Minz,
S., & Thakur, M. P. (2019). Rice Plant
Disease Classification Using Transfer
Learning of Deep Convolution Neural
Network. International Archives of the
Photogrammetry, Remote Sensing and
Spatial Information Sciences, 42(3/W6).
[16] Brahimi, M., Boukhalfa, K., & Moussaoui,
A. (2017). Deep learning for tomato
diseases: classification and symptoms
visualization. Applied Artificial
Intelligence, 31(4), 299-315.
[17] Ferentinos, K. P. (2018). Deep learning
models for plant disease detection and
diagnosis. Computers and Electronics in
Agriculture, 145, 311-318.
[18] Simonyan,K, Zisserman,A.,(2015). Very
deep convolutional networks for large-
scale image recognition. In:Int. Conf.
Learn.Represent.pp1-14.

You might also like