You are on page 1of 9

International Journal of Informatics and Computation (IJICOM)

Vol. 2, No.2, December 2020


ISSN: 2685-8711, E-ISSN: 2714-5263 DOI : 10.35842/ijicom

Implementation of Deep Learning for Classification


of Fungi Using the Convolutional Neural Network
(CNN) Algorithm
Imam Mahfudz I’tisyam1, R. Nurhadi Wijaya2, Marselina Endah H3

Abstract
Fungi are a type of low-level plant that lacks chlorophyll. One of the advantages of fungi is that they are
commonly utilized as food items in the community. Fungi come in a variety of shapes and sizes, including edible
and non-edible varieties. The issue that frequently arises is a lack of public awareness about which fungi can be
consumed and which cannot.
This study was carried out in order to develop an app that can distinguish between edible and non-edible
fungi. This application was created using the Python and Java programming languages and the Tensorflow
framework, and it makes use of Deep Learning technology and the Convolutional Neural Network method.
This study was carried out in order to develop an app that can identify edible and non-edible mushroom
varieties. Using Deep Learning technology and the Convolutional Neural Network technique, this application
was created using the Python and Java programming languages and the Tensorflow framework.
Keywords:
Mushroom, Classification, Deep Learning, CNN

This is an open-access article under the CC BY-SA license

1. Introduction
Fungi are fruiting bodies produced by a collection of fungus formed like an umbrella
that arises on the surface of the growing medium. The hood, blade, ring, stem/stalk, cup,
and pseudo root are the parts that make up the mushroom fruiting body's form. Fungi are
a type of low-level plant that lacks chlorophyll. Fungi have a variety of uses in human
existence, one of which is as a dietary element that is commonly consumed by the
population.
Fungi come in a variety of shapes and sizes, including edible and non-edible
varieties. Poisonous fungi are fungi that can't be eaten. People frequently make blunders
discriminating between edible fungi and those that cannot be eaten or are dangerous
while identifying mushroom kinds. As a result, several people consumed the incorrect
fungi, resulting in poisoning.
The Convolutional Neural Network (CNN) approach is a deep learning method that
can do object identification, object extraction, and classification in an autonomous
learning process. CNN is a convolutional neural network that integrates several layers of
processing, employs several parallel elements, and is inspired by the biological nervous
system.
The Convolutional Neural Network (CNN) approach is one of the Deep Learning
methods used in mushroom classification. The assumption for this network is that the
input is an image (image). This network features a particular layer called a convolution
layer, which takes an input image and creates a pattern from various sections of it,
making it easier to identify afterward. This method can speed up the implementation of
the image learning function.

Corresponding Author:
1 Imam Mahfudz I’tisyam (Author, University of Respati Yogyakarta, portgaschip@gmail.com)
2 R. Nurhadi Wijaya, S.T.,M.Kom. (University of Respati Yogyakarta, nurhadi@respati.ac.id)
3 Marselina Endah H., S.T., M.Cs. (University of Respati Yogyakarta, marsel.endah@respati.ac.id)
It is envisaged that the CNN algorithm would be able to identify or detect the type of
fungus. Then a thesis with the title "IMPLEMENTATION OF DEEP LEARNING FOR
CLASSIFICATION OF FUNGI USING CONVOLUTION NEURAL NETWORK (CNN)
ALGORITHM" was assigned, which is supposed to aid the public in determining which
fungi may be consumed, which cannot be taken, and which are toxic.

2. Object and Basis Theory

With 8 fungi as objects, research on "Implementation of Deep Learning for


Classification of Fungi Using the Convolution Neural Network (CNN) Algorithm." The total
number of mushroom photos used was 8000, including 6400 training data and 1600
validation data, with an 80:20 train validation data comparison. For training and validation,
the accuracy results for categorizing mushroom photos using CNN are 100%.
Deep Learning is a form of Machine Learning that uses an artificial neural network
with many hidden layers to model the human cortex [5]. Deep Learning is a subset of the
Neural Network, which has a more complex architecture and uses more layers, allowing it
to handle more complex issues with more data [2].

3. The Method
CNN stands for Convolutional Neural Network and is the most widely used neural
network technology. CNN can handle data with several dimensions, such as movies and
photographs [3]. The working mechanism of CNN is identical to that of standard neural
networks, with the exception that each unit in the CNN array uses a kernel of two sizes or
huge sizes to try convolution. CNN process flow in figure 1

Figure 1 CNN Process Flow

1. Convolution Layer
The convolution layer extracts items from the input image using filters [1].
Weights are utilized to determine the character of objects such as edges, curves, and
colors in this filter. The goal of convolution is to make a linear transformation of the
input image that corresponds to the spatial data in the data. A sequence of receptive
fields is created by applying the filter many times.

2. Pooling Layer
The pooling layer is a function layer that takes feature maps as input and
performs statistical operations on them depending on the closest pixel value [4]. The
pooling layer is only used on CNN to lower the image's dimensions so that a
convolution layer with the same stride as the relevant pooling layer can readily replace
it.
3. Fully Connected Layer
A fully linked layer is one that is made up of convolution process results [4]. This
structure uses prior processes and input to discover which attributes are related to or
correlate with a specific class. Furthermore, the completely linked layer's job is to
integrate all nodes into one dimension.

4. System Design
Figure 2 shows use case diagram

Figure 2 Use case diagram

1. Preparing Dataset
We employ a mushroom-image dataset as a source of data. 8000 images make
up the dataset. There are 1000 images for each mushroom type. The training dataset
was 6400 and the validation dataset was by 224x224 pixels are the dimensions of the
image. A Dataset is an example of a collection of data that can be seen in Figure 3.

Figure 3 Example datasets

In terms of the explanation and operation of the research, the variables


employed in this study are listed in Table 1:

Table 1 Variables and operational definitions of research


Variable Operational Definition
Fungi are neither edible nor toxic. Amanita phalloides, Gyromitra
Esculenta, Hygrocybe Conica, and
Omphalotus Olearius
Agaricus portobello, Cantharellus
Mushroom consumption types cibarius, Hygrocybe Sp. and Morchella
Esculenta.

2. Dataset training
The dataset training flow can be seen in Figure 4

Figure 4 Dataset Training Flow

5. Result and Implementation


The stage of implementation is when a system is ready to be used in a real-world
context. A system must have been tested for practicality prior to this level. To reduce the
possibility of errors, extra caution is required. The final system must adhere to the
previously completed analysis and design.

1. Variable
Figure 5 shows the script variables.

Figure 5 Script Variables

2. Image data preprocessing


To scale the image, use image data preprocessing. The directory, picture size,
and batch size can all be specified. Figure 6 illustrates the script.
Figure 6 Script image data generator

Figure 7 shows the output of the previous script.

Figure 7 Output script image data preprocessing

3. Model
Figure 8 shows the script model in action.

Figure 8 Script model

Figure 9 illustrates the model output.

Figure 9 Output model

4. Train the model


Figure 9 shows how to script train the model.
Figure 10 Script train the model

In Figure 11, you can see the output of the trained model.

Figure 11 Output train the model

Figure 11 shows a 15-epoch output train model. The training data set yields an
accuracy of 1.0000 with a loss of 0.0013, whereas the test data set yields an accuracy
of 0.9075 with a loss of 0.4329. With a total of 1 hour 35 minutes 52 seconds of
training time.

5. Learning Curves TensorBoard


Figure 12 shows the accuracy and loss graphs.

Figure 12 Accuracy and Loss Charts

Figure 12 shows the results of the 15th epoch accuracy with the training data
(orange line) and validation accuracy (blue line).

6. Classification Report
The accuracy, precision, recall, and f1-score outcomes of the classification
report will be discussed. The categorization report and confusion matrix results, as
shown in Figures 13 and 14, are as follows.
Figure 13 Classification Report

Figure 14 depicts the following Confusion Matrix.

Figure 14 Confusion Matrix

Figure 14 shows a confusion matrix with the data correctly predicted by the
model is 1520 and the data wrongly predicted being 80. The formula for calculating
the accuracy value is as follows.

N true
Accuracy= x 100 % …[6]
N
The following is the result of the above-mentioned confusion matrix computation.

200+194 +200+200+ 184+150+200+ 192 1520


Accuracy= = x 100 %=0 , 95
200+6+ 194+200+200+ 184+13+3+ 150+50 1600
+200+192+6 +2
7. System Implementation
As illustrated in Figure 15, the application can detect the fungus Amanita
Phalloides with a prediction rate of 99.94 %.
Figure 15 Detection of Amanita Phalloides Fungus

The detection of the fungus Agaricus Californicus with the description ✘ or


Poisonous or cannot be consumed resulted in Figure 15.

6. Conclusion
Following the completion of all stages of the investigation, the following
conclusions can be drawn:

1. The researchers used eight fungi, including Agaricus Portobello, Amanita


Phalloides, Cantharellus Cibarius, Gyromitra Esculenta, Hygrocybe Conica,
Hygrocybe Sp, Morchella Esculenta, and Omphalotus Orealius, to build a deep
learning application for the classification of edible and non-consumable or toxic
types of fungi using the Convolutional Neural Network (CNN) algorithm. The total
number of mushroom photos utilized was 8000, with 6400 training data and 1600
validation data. The train validation data comparison was 80 %: 20%, the kernel
size was 3x3, the Adam optimizer was employed, 15 epochs were used, and the
learning rate was 0.0001. For training and validation, the accuracy results for
categorizing mushroom photos using CNN are 100 % and Validation rate of 95%
2. The average accuracy rate in the Agaricus Portobello test was % -99.89 %, % -
99.89 % in the Amanita Phalloides test, % -99.59 % in the Cantharellus Cibarius
test, % -98.89 % in the Gyromitra Esculenta test, % -99.96 % in the Hygrocybe
Conica, and % -99.93 % in the Omphalotus Orealius.
3. The software can help people figure out what kinds of fungi they can eat and which
ones they shouldn't eat or are dangerous.

Acknowledgment
Thank you to all lecturers at the University of Respati Yogyakarta informatics
studies program.

Reference
[1] Arrofiqoh, E. N., & Harintaka. (2018). Implementasi Metode Convolutional Neural
Network Untuk Klasifikasi Tanaman Pada Citra Resolusi Tinggi. Geomatika, 61-
68.
[2] Giarsyani, N., Hidayatullah, A. F., & Rahmadi, R. (2020). Komparasi Algoritma
Machine Learning Dan Deep Learning Untuk Named Entity Recognition : Studi
Kasus Data Kebencanaan. JIRE (Jurnal Informatika & Rekayasa Elektronika), 51.
[3] Khan, S., Rahmani, H., Shah, S. A., & Bennamoun, M. (2018). A Guide to
Convolutional Neural Networks for Computer Vision. New York: Morgan &
Claypool Publishers.
[4] Putri, O. N. (2020). Implementasi Metode Cnn Dalam Klasifikasi Gambar Jamur
Pada Analisis Image Processing. Tugas Akhir, 16-27.
[5] Santoso, A., & Gunawan, A. (2018). Implementasi Deep Learning Berbasis Keras
Untuk Pengenalan Wajah. Emitor: Jurnal Teknik Elektro, 16-17.

You might also like