0% found this document useful (0 votes)
27 views6 pages

Poisonous Mushroom Detection Using Graph Neural Networks

This study explores the use of Graph Neural Networks (GNNs) for classifying poisonous and edible mushrooms through image data, addressing the limitations of manual identification methods. The research compares three GNN architectures—Graph Convolutional Network (GCN), GraphSAGE, and Graph Isomorphism Network (GIN)—and evaluates their performance using different optimizers, highlighting the effectiveness of GNNs in capturing pixel relationships for accurate classification. The findings contribute to advancements in mushroom toxicity prevention and enhance image classification techniques.

Uploaded by

shreyaamin2411
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)
27 views6 pages

Poisonous Mushroom Detection Using Graph Neural Networks

This study explores the use of Graph Neural Networks (GNNs) for classifying poisonous and edible mushrooms through image data, addressing the limitations of manual identification methods. The research compares three GNN architectures—Graph Convolutional Network (GCN), GraphSAGE, and Graph Isomorphism Network (GIN)—and evaluates their performance using different optimizers, highlighting the effectiveness of GNNs in capturing pixel relationships for accurate classification. The findings contribute to advancements in mushroom toxicity prevention and enhance image classification techniques.

Uploaded by

shreyaamin2411
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/ 6

Poisonous Mushroom Detection using Graph Neural

Networks
D.P.C.H Pathirana R.M.T.U. Rajapaksha H.M. Samadhi Chathuranga
Faculty of Computing Faculty of Computing Rathnayake
Sri Lanka Institute of Information Sri Lanka Institute of Information Faculty of Computing
Technogy Technogy Sri Lanka Institute of Information
Sri Lanka Sri Lanka Technology
it20161088@my.sliit.lk it20155698@my.sliit.lk Sri Lanka
samadhi.r@sliit.lk
Kosala Sirisena Udara Samarathunga
Faculty of Technology Faculty of Computing
University of Colombo Sri Lanka Institute of Information
Sri Lanka Technology
kosala@et.cmb.ac.lk Sri Lanka
udara.s@sliit.lk
2023 5th International Conference on Advancements in Computing (ICAC) | 979-8-3503-5813-1/23/$31.00 ©2023 IEEE | DOI: 10.1109/ICAC60630.2023.10417353

Abstract— This study delves into the use of Graph Neural inherent graph structure of mushroom images to build a
Networks (GNNs) for the classification of poisonous and edible robust and accurate classification model. Our proposed
mushrooms based on image data, aiming to address the approach involves converting each mushroom image into a
limitations of manual identification methods. Three GNN graph representation, where pixels are treated as nodes and
architectures, Graph Convolutional Network (GCN),
their spatial relationships as edges. This graph-based
GraphSAGE, and Graph Isomorphism Network (GIN), are
examined, with a comparison of the Adam and Stochastic representation enables us to exploit the rich structural
Gradient Descent (SGD) optimizers within each. The results information present in the images.
underscore GNNs' effectiveness in discerning toxic mushrooms
by capturing nuanced pixel relationships, offering a valuable We compare our GNN-based approach against traditional
contribution to the fields of biology and toxicology, with machine learning methods and other deep learning
practical implications for mushroom toxicity prevention. architectures. To achieve this, we employ the PyTorch
Geometric library, which provides specialized tools for
Keywords— Mushroom classification, Graph Neural Networks, working with graph data and GNNs. Our experimentation
Deep Learning, Poisonous Mushroom Detection, Image
Processing
involves implementing various GNN architectures, including
Graph Isomorphism Networks (GIN), and assessing their
I. INTRODUCTION performance on a real-world dataset of mushroom images.
In recent years, the application of Graph Neural Networks
(GNNs) has attracted substantial interest across various The remainder of the paper is structured as follows:
domains due to their effectiveness in modelling structured Section 2 gives a thorough summary of related work in the
data. Graph Neural Networks are a subset of deep learning fields of mushroom classification and GNNs. Section 3
models designed specifically to handle data structured as describes the dataset used for our experiments and the
graphs, where objects are represented as nodes and preprocessing steps involved in preparing the data for GNN
connections between them are represented as edges. One such training. Section 4 presents the methodology, detailing the
application of GNNs is in the field of image classification, GNN architectures employed and the training process. In
where graphs can be used to represent images and their Section 5, we present the experimental results and
features. In this study, we explore the use of GNNs to identify performance comparisons. Finally, Sections 6 and 7
poisonous and edible mushrooms based on photographs of summarize our results, discuss their implications, and offer
their morphological characteristics. potential directions for future research.

Classifying mushrooms into poisonous and edible In summary, this study provides an important contribution
categories is of paramount importance in ensuring public to the mushroom classification field by exploring the
safety and preventing accidental ingestion of toxic application of Graph Neural Networks to image-based
mushrooms [1] [2]. Traditional approaches to mushroom mushroom classification. By harnessing the power of GNNs,
classification rely heavily on feature engineering and hand- we aim to develop a more accurate and efficient approach to
crafted extraction methods, which may not be able to capture differentiating between edible and poisonous mushrooms,
the intricate relationships and patterns present within the data. enhancing public safety, and advancing the capabilities of
In contrast, Graph Neural Networks offer a data-driven image classification techniques.
approach that can automatically learn relevant features and
relationships from the graph representation of the data.

In this work, we present a novel approach to mushroom


classification using GNNs. We focus on leveraging the

979-8-3503-5813-1/23/$31.00 ©2023 IEEE


328
Authorized licensed use limited to: MANGALORE INSTITUTE OF TECHNOLOGY & ENGINEERING. Downloaded on March 18,2025 at 08:29:48 UTC from IEEE Xplore. Restrictions apply.
II. LITERATURE REVIEW effective message passing among graph nodes. Variants like
Graph Convolutional Network (GCN), Graph Attention
A. Mushroom Classification Network (GAT), and Graph Recurrent Network (GRN) have
showcased remarkable performance in computer vision using
“Mushrooms, some of which are edible, and some of deep learning. While Convolutional Neural Networks (CNNs)
which are poisonous, contribute to numerous deaths every excel in object recognition, GNNs offer new avenues for
year due to the consumption of toxic varieties [3]. image categorization, video analysis, human-object
Determining whether a mushroom is poisonous solely based interaction, and more. [7] Highlights GNNs' role, design,
on its appearance requires expertise” [4] .The study involved applications, and challenges in computer vision. The ongoing
the creation of a machine learning model based on 22 expansion of GNN applications underscores their potential in
features, which can be utilized to classify mushrooms as deciphering complex graph data and signals an exciting field
poisonous or edible. These features include cap shape, cap for further research and innovation.
surface, gill size, gill color, stalk shape, veil color, veil type, III. DATA GATHERING AND PREPROCESSING
ring type, and habitat, among others. Machine learning
algorithms such as Support Vector Machine (SVM), Naive
Bayes (NB), Decision Tree (DT), and AdaBoost (AB) were
employed for classification purposes. Among these,
AdaBoost (AB) achieved the highest accuracy of 100%,
effectively leveraging the physical appearance features of the
mushrooms.
Volvariella valvacea Pleurotus Agaricus biscporus
In the study of [5] the authors collected a comprehensive
image dataset of Chinese fungi, leveraging crowd-sourcing Fig. 1. Edible Mushroom Images (Kaggle.com)
and established checklists for edible and poisonous species.
To address the inherent challenges of imbalanced datasets
and limited sample sizes, the study employs well-known deep
convolutional neural networks pretrained on ImageNet.
These networks, including AlexNet, VGG16, DenseNet121,
and ResNet50, were fine-tuned for the binary classification
of poisonous and edible mushrooms. Notably, the ResNet50
model outperformed others, exhibiting a high accuracy of
0.756 and a strong area under the receiver operating
Amantia flavoconia Cortinarius eartoxicus Ramaria
characteristic curve (AUC) of 0.809.
Fig. 2. Poisonous Mushroom Images (Kaggle.com)
The next research [6] used an Artificial Neural Network
model to classify whether a given mushroom is poisonous or We obtained a dataset comprising images of both
edible. The ANN model has been trained using a dataset of poisonous and edible mushrooms for our classification task. It
descriptions of hypothetical samples corresponding to 23 includes images of 93 poisonous species and 62 edible
species of gilled mushrooms in the Agaricus and Lepiota species. Poisonous class has 2425 images and edible class has
families of mushrooms. 22 morphological features such as 2438 images. The dataset was organized into two categories:
cap shape, cap surface, odor, gill size, gill color, stalk shape, 'Poisonous' and 'Edible'. Each category contained images of
veil type, veil color, ring type and population have been used mushrooms that were annotated with corresponding labels
to classify poisonous and edible mushrooms. This model has indicating their toxicity. The images were gray scaled and
achieved 99% accuracy. resized to a uniform dimension of 32x32 pixels to ensure
consistency in input dimensions for the GNN.

B. Graph Neural Networks


Study [5] introduces WaveMesh, a novel image
classification method using graph neural networks (GNNs).
Unlike fixed super pixel grids, WaveMesh generates image-
specific multiscale super pixels through a wavelet-based
algorithm, resulting in unique graph structures. WaveMesh
performs similarly to traditional methods with fixed
superpixels. A new pooling strategy, WavePool, designed for
WaveMesh superpixels, surpasses other strategies. The
research underscores the importance of proper cluster
assignment when learning from multiscale super pixels.
“Design and implementation of Graph Neural Network
(GNN) for computer vision (CV) applications is currently an
active and ongoing research topic for various application
domains not only limited to CV” [7]. Graph Neural Networks Fig. 3. Image to Graph conversion.
(GNNs) have revolutionized information processing through

329
Authorized licensed use limited to: MANGALORE INSTITUTE OF TECHNOLOGY & ENGINEERING. Downloaded on March 18,2025 at 08:29:48 UTC from IEEE Xplore. Restrictions apply.
IV. METHODOLOGY
In this section, we elaborate on the methodology adopted 3) Graph Isomorphism Network (GIN): The GIN
for our research project, focusing on the detection of architecture employs multiple GINConv layers that
poisonous mushrooms using Graph Neural Networks (GNNs). iteratively update node features by aggregating information
We delve into the GNN architectures applied, optimization from neighboring nodes. GINConv layers use multi-layer
techniques employed, the process of converting images into perceptron to capture and propagate graph structure
graph representations, model training procedures, and the information.
evaluation metrics used to gauge model performance.

C. Optimizers

Two optimization algorithms, Adam, and Stochastic


Gradient Descent (SGD) were employed to train the GNN
models. These optimizers were selected due to their wide
usage in training deep learning models.

1) Adam Optimizer: Adam (Adaptive Moment


Estimation) combines adaptive learning rates for each
parameter with momentum-based updates, providing
efficient and rapid convergence.

2) SGD Optimizer: Stochastic Gradient Descent updates


model parameters based on the gradient of the loss function
with respect to a random subset of the training data.
Momentum was incorporated to accelerate the optimization
Fig. 4. System Overview Diagram process.

D. Traininig and Evaluation


A. Graph Representation Conversion
The image data was converted into graph representations 1) Data Splitting: The dataset was split into training and
to facilitate GNN processing. Each pixel in the image was testing sets using an 80-20 ratio. This ensured that both the
treated as a node, and edges were introduced between training and testing sets had representative distributions of
adjacent pixels to capture spatial relationships. The image edible and poisonous mushrooms.
was resized to 32x32 pixels, and pixel values were
normalized to the range [0, 1]. 2) Model Architecture: For each GNN architecture
(GCN, GraphSAGE, and GIN), a specific model structure
B. Graph Neural Network Architectures was defined. The number of layers, hidden dimensions, and
output dimensions were adjusted to suit each architecture.
Three distinct Graph Neural Network (GNN)
architectures were explored in this study: Graph
Convolutional Network (GCN), GraphSAGE, and Graph 3) Model Training: The training process involved
Isomorphism Network (GIN). These architectures were iterating through batches of training data using the
chosen due to their effectiveness in capturing graph-based DataLoader. For each batch, the optimizer's gradients were
relationships within image data. zeroed before computing the forward pass, loss calculation,
and backpropagation. The model parameters were then
1) Graph Convolutional Network (GCN): The GCN updated based on the optimizer's update rules.
architecture consists of multiple graph convolutional layers
that process node features by aggregating information from 4) Model Evaluation: During the evaluation, the trained
neighboring nodes. Each GCN layer applies a convolution models were tested on the separate testing dataset. The GNN
operation to update node representations based on their local models were set to evaluation mode to disable gradient
graph structure. computation and improve efficiency. Accuracy was
computed by comparing the model's predicted labels with the
2) Graph SAGE: The GraphSAGE architecture utilizes ground truth labels. The evaluation metrics employed
aggregation functions to gather information from a node's include:
neighbors, enabling the model to learn from both local and • Accuracy: The ratio of accurately classified samples
global graph contexts. GraphSAGE layers generate node to the total samples.
embeddings by sampling and aggregating features from • Precision: The proportion of true positive
nearby nodes. predictions to the total predicted positives.

330
Authorized licensed use limited to: MANGALORE INSTITUTE OF TECHNOLOGY & ENGINEERING. Downloaded on March 18,2025 at 08:29:48 UTC from IEEE Xplore. Restrictions apply.
• Recall: The ratio of true positive predictions to the
total actual positives.
• F1 Score: The harmonic mean of precision and
recall, indicating the trade-off between the two
metrics.

This methodology encompassed exploring various GNN


architectures, comparing different optimizers, converting
image data into graph representations, and conducting
rigorous training and evaluation processes. The resulting Fig. 6. Precision, Recall, and F1 Score Variations (GCN Model)
insights contribute to a comprehensive understanding of
GNNs' performance in identifying poisonous mushrooms and
demonstrate the viability of utilizing GNNs for complex
image classification tasks.

V. RESULTS
In this section, we present the outcomes of our
experiments conducted to classify poisonous and edible
mushrooms using a Graph Convolutional Network (GCN).
We evaluated the performance of different optimizers, Fig. 7. Accuracy Graph (GraphSage Model)
including Adam and SGD, in terms of accuracy. Our dataset
was split into training and testing sets, with a test size of 20%
and a random seed of 42 for reproducibility.

TABLE I- MODEL ACCURACY (USING SGD OPTIMIZER)


Accuracy GNN Architecture
Comparison GCN GraphSage GIN
Accuracy% 63.82 66.60 64.03

TABLE II- MODEL ACCURACY (USING ADAM OPTIMIZER) Fig. 8. Precision, Recall and F1 Score Variations (GraphSage Model)
Accuracy GNN Architecture
Comparison GCN GraphSage GIN
Accuracy% 49.74 50.26 52

The performance of each model in terms of accuracy,


precision, recall, and F1 score were analyzed, providing
insights into their efficacy in distinguishing between edible
and poisonous mushrooms.

Fig. 9. Accuracy Graph (GIN Model)

Fig. 5. Accuracy Graph (GCN Model)

Fig. 10. Precision, Recall and F1 Score Variations (GIN Model)

The obtained results highlight the effectiveness of the


GraphSAGE architecture, particularly when combined with

331
Authorized licensed use limited to: MANGALORE INSTITUTE OF TECHNOLOGY & ENGINEERING. Downloaded on March 18,2025 at 08:29:48 UTC from IEEE Xplore. Restrictions apply.
the SGD optimizer. GraphSAGE consistently outperformed
both GCN and GIN, achieving the highest accuracy among As “GNNs are often considered as black-box models,”
the tested models. Although accuracy is an important metric, future work could focus on developing techniques to interpret
precision, recall, and F1 score give a fuller picture of model and explain the models' decisions. This is particularly
performance. important in applications like toxicology, where
understanding the reasoning behind model predictions is
Across all architectures, the SGD optimizer yielded better crucial for trust and accountability.
results compared to Adam. This could be attributed to SGD's
adaptability to varying learning rates for different model In conclusion, our research project serves as a
parameters, resulting in faster convergence and improved foundational exploration into the realm of poisonous
performance. mushroom detection using GNNs. Addressing the limitations
and pursuing the outlined future directions could lead to more
sophisticated, accurate, and practical solutions for
VI. CONCLUSION AND IMPLICATATION automating mushroom toxicity assessment, enhancing food
The results indicate that the GraphSAGE architecture, safety, and safeguarding human health.
combined with the SGD optimizer, offers the most promising
approach for detecting poisonous mushrooms. The accuracy ACKNOWLEDGEMENT
achieved is significant, considering the complexity of We extend our sincere gratitude to our dedicated
distinguishing between the two classes. Our findings suggest supervisors for their invaluable guidance and faithful support
that the GraphSAGE architecture's ability to aggregate throughout this research project. Their insightful feedback,
information from local neighborhoods is particularly encouragement, and expertise have been instrumental in
beneficial for this task. shaping the direction and quality of this study. We would like
to express our heartfelt appreciation to our supervisor Mr.
Further analysis and comparison of precision, recall, and Samadhi Chathuranga Rathnayake co-supervisor Mr. Udara
F1 score provide a nuanced understanding of the models' Samarathunga, and our external supervisor, Dr. Kosala
strengths and weaknesses, informing potential adjustments Sirisena, for their valuable inputs, mentorship, and valuable
for improved performance. Moreover, the learning trends contributions that have enriched the depth and scope of our
over epochs offer insights into the models' convergence research. Our gratitude also extends to "Samal Mushroom
behavior and potential points of intervention to prevent Farm" in Divlapitiya for graciously providing the essential
overfitting. data that formed the foundation of this study. The
collaboration with the farm has been integral to our research's
In summary, our experimentation reveals that the success. We would also like to extend our thanks to the
GraphSAGE architecture with the Adam optimizer is well- farmers who generously participated in our surveys, sharing
suited for poisonous mushroom detection, showcasing their insights and experiences, which contributed to the
promising accuracy and a balanced trade-off between empirical basis of our work. We would like to acknowledge
precision and recall. These results have implications for the the support of our friends and family for their encouragement,
advancement of automated toxicological analysis and understanding, and patience during the various phases of this
highlight the potential of graph-based deep learning research journey. Their unwavering belief in our abilities has
approaches in similar domains. been a constant source of motivation. Lastly, we appreciate
the collective efforts of everyone who has played a role, no
VII. LIMITATIONS AND FUTURE WORKS matter how small, in the realization of this research. Your
support has been invaluable, and we are profoundly grateful
While our research project provides valuable insights into for your contributions.
the application of Graph Neural Networks (GNNs) for the
detection of poisonous mushrooms, certain limitations, and REFERENCES
areas for future exploration warrant consideration.
[1] J. D. H. Z. X. Y. Yingying Wang, "Mushroom Toxicity Recognition
One of the primary limitations of our study is Based on Multigrained Cascade Forest," Scientific Programming,
hyperparameter tuning. Although we performed 2020.
hyperparameter tuning to some extent, a more exhaustive [2] B. L. Y.-G. F. R. D. C. G. Y. Z. E. T. Xiaomei XIE, "Identification of
search of hyperparameters could yield further performance Gyromitra infula: A Rapid and Visual Method Based on Loop-
improvements. Exploring various learning rates, activation Mediated Isothermal Amplification," METHODS , 2022.
functions, and layer configurations could lead to enhanced [3] A. L. J. Huu H Tran, "Mushroom Toxity," National Institute of Health,
USA.
model accuracy and convergence behavior.
[4] R. K. I. C. M. K. Kemal Tutuncu, "Edible and Poisonous Mushrooms
Classification by Machine Learning Algorithms," Mediterranean
Our models currently rely solely on pixel intensities for Conference on Embedded Computing (MECO), 2022.
graph construction. Incorporating structural information, [5] Y. Z. Z. L. Baiming Zhang, "USING DEEP CONVOLUTIONAL
such as mushroom shape and spatial relationships between NEURAL NETWORKS TO CLASSIFY POISONOUS AND
various parts, could enhance the models' ability to capture EDIBLE MUSHROOMS FOUND IN CHINA," ResearchGate, 22
October 2022.
critical features. This could involve more sophisticated graph
construction methods that consider the hierarchical structure [6] A. P. Gupta, "Classification Of Mushrooms Using Artificial Neural
Networks," Creative Commons, 03 September 2022.
of mushrooms.

332
Authorized licensed use limited to: MANGALORE INSTITUTE OF TECHNOLOGY & ENGINEERING. Downloaded on March 18,2025 at 08:29:48 UTC from IEEE Xplore. Restrictions apply.
[7] S. G. P. M. Pradhyumna P, "Graph Neural Network (GNN) in Image [8] M. B. M. T. I. L. X. Varun Vasudevan, "Image classification using
and Video Understanding Using Deep Learning for Computer Vision graph neural network and multiscale wavelet superpixels," 2023.
Applications," 2021.

333
Authorized licensed use limited to: MANGALORE INSTITUTE OF TECHNOLOGY & ENGINEERING. Downloaded on March 18,2025 at 08:29:48 UTC from IEEE Xplore. Restrictions apply.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy