Plant Disease Classification Using Convolutional Networks and Generative
Plant Disease Classification Using Convolutional Networks and Generative
Adverserial Networks
Emanuel Cortes
Stanford University
[email protected]
4321
identify the type of disease. This method is quite interesting 5. Spatial Pooling: Spatial Pooling (also called subsam-
in that it breaks down the process disease identification in pling or downsampling) reduces the dimensionality of
two steps. It will be interesting to compare and contrast with each feature map but retains the most important infor-
more recent papers, where healthy leaves are treated as just mation. Spatial Pooling can be of different types: Max,
another class label. As a result, classification is just done Average, Sum etc. These networks have grown in the
in a single step. In addition, the research paper introduces a number of layers leading to architectures such as Rest-
method for optimizing the loss function using a genetic al- Net and AlexNet that have been trained on images such
gorithm, which can be compared to natural selection where as Cifar-10 and then fined tune to other problems, such
only the strong hyper parameters will survive. I need to do as plant classification.
more research in how genetic algorithms compare in other
forms of computing loss, such as Adam, RmsProp, and etc. 3. Method
Lastly, similar to the paper, A Model of Plant Identifica-
3.1. Background Segmentation
tion System Using GLCM, Lacunarity, and Shen Features,
there was a focus on identifying important features of the In the research paper, ”Using Deep Learning for Image-
image to help in the classification process. In both papers, Based Plant Disease Detection,” Mohanty and his col-
they used gray-level co-occurrence matrix (GLCM) to ex- leagues worked with three different versions of the leaf im-
tract information about the distribution of pixel values. ages from PlantVillage. One of these versions included leaf
images that were segmented to to exclude the background.
2.2. Plant Disease Classification with Convolutions According to Mohanty and his colleagues, these segmented
Other work moved towards using convolutional net- images of the whole dataset was prepared to investigate the
works to get better performances. Convolutional Networks role of the background on the learning algorithm.
are a category of Neural Networks that have proven very ef- In order to segment the background, I would be using
fective in areas such as image recognition and classification. a model that is inspired by the Boris Conforty tutorial on
ConNets have been successful in identifying faces, objects, segmenting images from PlantVillage. If you take a pic-
and traffic signs apart from powering vision in robots and ture of a uniform background under non-uniform lightning
self driving cars. conditions, you’ll end up with a gradient in all R, G and
ConvNets derive their name from the ”convolution” op- B channels (in the RGB color space), whereas only the L
erator. The primary purpose of Convolution in case of a channel will be affected (in the Lab color space). Here is an
ConvNet is to extract features from the input image. Con- example image expressed in the channels of the lab colore
volution preserves the spatial relationship between pixels by space:
learning image features using small filters.
There are many important parts of the Convolution Net-
work. These includes the following properties
4322
on more than two classes. As part of my attempt to design loss = None
a semi-supervised approach, I implemented a loss function N, C = logits_real.size()
that could create a discriminator that could act as a classifier fake_labels =
for different plant diseases. Variable((torch.zeros(N)+23).type(dtype).long())
Before explaining my multi-label categorical generative return softmax_loss(logits_real, true_labels) +
network, previous work has been done that influenced how softmax_loss(logits_fake, fake_labels)
I constuctured my model. In ”Semi-Supervised Learning
with Generative Adverserial Networks,” Augustus Odena
proposed that the descirminator network D can be imple- The discriminator loss function will contain the sum of
mented with a softmax output layer with one unit for each of two softmax functions. One of softmax will try to reduce
the classes [REAL, FAKE]. Once this modification is made, the negative log likilhood with respect to the given labels
its simple to see that D could have N+1 output units corre- of the real data. The other softmax function will reduce
sponding to CLASS-1, CLASS-2, . . . CLASS-N, FAKE]. the negative log likilhood with respect the fake labels of the
Therefore the discriminator can act as a classifier. In both fake data. A loss function that reduces the sum of these soft-
my research paper and in Odena’s work, this type of dis- max functions would create a discriminator that discrimi-
crimnatory is referred to as D/C. nate between real and fake data and if given an real image,
Odena further describes that training this type of GAN the discriminator can produce a label or identify a particular
is quite similar to training a normal GAN. D/C is trained type of disease for that image.
to minimize the negative log likelihood with respect to the
given labels and G is trained to maximize it. Therefore, the 4. Dataset and Features
following algorithm is proposed to train my algorithm
There is a total of 86,147 images of diseased and healthy
Algorithm 1 SGAN Training Algorithm plants. These images span 25 different species of plants.
1: Input:I : number of total iterations
Each set of images, such as the training, validation, and
2: for i > 1 to i == 10 do
testing, span 25 different species of plants. The training set
3: Draw m noise samples includes 55,135 images of disease and healthy plant leaves.
4: Draw m examples from the real data that also span 25 different species of plants. The valida-
5: Perform gradient descent to minimize the D/C loss tion set includes 13,783 images of disease and healthy plant
6: function with respect to real and fake lables leaves. The testing set includes 17, 229 images of disease
7: Draw m noise samples and healthy plant leaves.
8: Perform gradient descent on the parameters of G All images were segmented to remove the background.
w.r.t. In addition, all images were resized to have a width of 64
9: the NLL of D/Cs outputs on the minibatch of size pixels and a height of 64 pixels. Then this was repeated for
m. images that were segmented.
4323
Unflatten(BATCH_SIZE, NUM_CHANNELS, I
MAGE_HEIGHT, IMAGE_WIDTH),
nn.Conv2d(NUM_CHANNELS, 32,
kernel_size=5, stride=1),
nn.LeakyReLU(0.01, inplace=True),
nn.MaxPool2d(kernel_size=2, stride=2),
nn.Conv2d(32, 64, kernel_size=5, stride=1),
nn.LeakyReLU(0.01, inplace=True),
nn.MaxPool2d(kernel_size=2, stride=2),
Flatten(),
nn.Linear(10816, 4*4*64),
nn.LeakyReLU(0.01, inplace=True),
nn.Linear(4*4*64, NUM_CLASSES)
4324
nn.Conv2d(16, 3, kernel_size=2, stride=1),
nn.LeakyReLU(0.01, inplace=True),
nn.MaxPool2d(kernel_size=1, stride=2),
nn.Tanh(),
Flatten()
6. Conclusion
Using Gans may hold promise to classify diseases in
classifying plant disease. Unfortunately segmenting based
on background did not improve accuracy. One possible idea
for future work is to implement segmentation with Mask
RCNN.
1.) Strange RN, Scott PR (2005) Plant disease: a threat
to global food security. Phytopathology 43
2.) Dirzo, Rodolfo; Hillary S. Young; Mauro Galetti;
Gerardo Ceballos; Nick J. B. Isaac; Ben Collen (2014).”De-
faunation in the Anthropocene”(PDF).Science.345(6195):
401406. 3.) UNEP (2013) Smallholders, food security, and
the environment.
Here is the final improved image at the beginning of
4.) Harvey CA et al. (2014) Extreme vulnerability of
training:
smallholder farmers to agricultural risks andclimate change
in madagascar. Philosophical Transactions of the Royal So-
ciety of London B:Biological Sciences 369(1639). 5.) Mo-
hanty, S. P., Hughes, D. P., Salath, M. (2016). Using Deep
Learning for Image-Based Plant Disease Detection. Fron-
tiers in Plant Science, 7. doi:10.3389/fpls.2016.01419 6.)
Hanson, A.J., Joy, A., Francis, J. Francis, J. (2017). Plant
Leaf Disease Detection using Deep Learning and Convo-
lutional Neural Network. IJESC, Volume 7 Issue No.3 .
7.) Sladojevic, S, Arsenovic, M., Anderla, A., Culibrk,
Dubravko, Sefanovic, D. (2016). Deep Neural Networks
Based Recognition of Plant Disease by Leaf Image Classi-
fication. 8.) Naik, M.R., Sivappagari, C. (2016). Plant Leaf
and Disease Detection by Using HSV Features and SVM.
IJESC, Volume 6 Issue No.12. 9.) Kadir, A. (2014). A
Model of Plant Identification System Using GLCM, Lacu-
narity and Shen Features. Research Journal of Pharmaceu-
tical, Biological, and Chemical Sciences Vol.5(2)
4325